On distributed random number generation, hash functions, commit-reveal, code-controlled payment, Corda and garish lights and sounds.

At the Corda Code Club, we gather regularly for pizza and to create new Corda-based projects over a few weeks, with a friendly judging at the end.

Corona-oblige, this time it was all done online. The remit was to create a backend to a ready-made slot machine GUI. Two teams remained, including mine, with Dimash Danabek and Chris Wells.

Screenshot of the slot machine GUI displaying a large win
Screenshot of the slot machine GUI displaying a large win
Whetting your appetite with a large win as I was running out of tokens

You can play it here while stocks last. The first time you load the page, or when you decide to “reset” after losing it all for instance, the page assigns you a random id that acts as your session, and awards…


Lobster diving* into smart contracts. Image credit: Debora Cardenas via Unsplash

Understanding what is going on is important in Ethereum development — which is why we always try to instil a cautious approach at B9lab.

To understand why, let’s have a look at a cunning trap set up very recently by someone who knows a bit more than the average honey badger.

(This post was inspired by this unfortunate incident.)

The smart contract

Here it is, deployed by the transaction 0xb1b4575c0724fe45c817d269f8e967e061eb424b0b9a49b6d131c96885031c88 at address 0x70bf9Df6967Dc96156e76Cc43b928A7eF02E159a:

Functions

Quite simple, but let’s go through the functions anyway:

  • function StartGame(string _question,string _response) lets someone setup the challenge with the question and the answer. This means that from the…


Image credit: Kelly Sikkema via Unsplash

At B9lab, we have a faucet on Ropsten, which gives away 1 test Ether a minute to whoever asks. The 1-minute part is enforced by the contract itself; ask too early and you get nothing.

And since it is meant for those who have no Ether at all, the faucet has a centralised element, written in Javascript and running on AWS, which uses our private key to post the request on others’ behalf.

Anyone can request an Ether, which is typically used by developers or curious people who want to experiment, including our students. And I regularly eyeball the transactions.

Act 1 — are you an idiot?

Xavier Lepretre

Senior Blockchain Developer and Trainer at B9lab

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store