The Big Corda Code Club Slot Machine Challenge

UPDATE: The final of the Corda Code Club Slot Machine Challenge was Corda Code Club’s presentation at CordaCon2020, click here to find out which team won the award for Best Cordapp 2020, or follow this URL: https://www.r3.com/cordacon/create-a-live-playable-slot-machine-cordapp/

Play the Wizards’ Corda Slot Machine by clicking here and the CoSMA’ Corda Slot Machine by clicking here (More details below)

.

The Wizards

Xavier Lepretre
Chris Wells
Dimash Danabek

Play the Wizards’ Corda Slot Machine by clicking here

The player node and the casino node participate in a commit-reveal pattern for a random number game.

  1. When both parties commit, they also lock tokens, for instance 1 for the player and 199 for the casino.
  2. From this point, all they have to do is reveal their random numbers and
  3. Resolve the game with them in order to unlock the tokens, whose payout, up to 200, is controlled by contract and does not require any signature.

In these 1.5 seconds, 4 Corda transactions are created:

  • 1 commit + locking of tokens transaction
  • 2 independent reveal transactions
  • 1 resolve + releasing of tokens transaction

CoSMa

Yash Karkera
Florian Pautot
Awie Nel

Play the CoSMA’ Corda Slot Machine by clicking here

The COSMA slot machine is built to be distributed and decentralized.
All the Corda Nodes are Casino nodes, and each Casino node can host as many users as they want. We could represent the nodes as Casino Franchises.
In order to be able to participate to the Casino Franchise network, each node need to stake a certain amount in a shared account that will be locked. If a casino has not locked the funds in the stake account, each of his transactions will be rejected.

For the “explorer” part at the top (just click on the movable pink “explorer” sign) :

You can explore the content of our Corda Casino network by using the Corda Node Explorer.
For that you can go to http://ec2-18-217-149-77.us-east-2.compute.amazonaws.com:3000/
The node host is ec2-18-217-149-77.us-east-2.compute.amazonaws.com
For the port there are :

  • Casino A : 10006
  • Casino B 10009
  • Casino C: 10011
    For the credentials:
  • User : user1
  • Password: test

In terms of slot machine game, the process is the following:

  • The process start when a user creates an account, he is then credited with 100 tokens
  • Every time a user will spin the slot machine it will create a game state
  • The game will follow these steps:
    • the game state will get created
    • the tokens will be reserved from the user, and the casinos. Each Casino will lock the maximum amount the user can win , divided by the number of casino in the franchise network, inside a reserve account. The user tokens will also be locked in a reserve account
    • A result is then generated by the initiating casino, and each casino of the network will then verify the result to prove that is actually the one we expect. For that we used a deterministic random generator that generates a combination based on a seed. With the same seed, we should always have the same result.
    • Based on the result, if the user won, the payout will be divided between all the casinos, and they will each send the reward, divided by the number of casinos in the network
    • If the user has lost, the user stake is shared between the casinos.
    • After that, all the tokens are moved back to the main casino or user account from the reserve account

%d bloggers like this: