Ethereum roulette

European roulette PoC deployed to the ropsten network

Status: Live
Customer: Personal project

http://ethereum-roulette.ga
https://github.com/bordalix/ethereum-roulette

DevOps
Nginx, AWS
Database
Ethereum blockchain
Business logic
Ethereum smart contract
API Layer / MVC
Metamask, web3js
Design / UI
Bootstrap

Full story

Motivation

I decided to learn more about developing smart contracts, and since I learn by building stuff, so I decided to implement a casino roulette, with the business logic being implemented in Solidity, the language of choice to develop smart contracts in the Ethereum blockchain.

The frontend is a regular html page, with the web3 javascript library, which makes it possible to interact with the Ethereum blockchain via javascript. The web3 library is injected in the page by the Chrome extension Metamask.

How to play

You’ll need to have the Metamask Chrome extension installed, have an account on the ropsten network, have some ether and access the dapp

Every bet has a fixed amount of 0.01 ether (around €6) and you can bet by clicking on the board. The roulette just accepts a bet when has sufficient funds to pay for it and every other active bet.

Different people can be playing at the same time.

One of the players will click the “Spin Wheel” button, which will generate a random number and all bets will be dealt with accordingly.

When a player wins a bet, the payout is credited on his personal account. The player can, at any moment, click the “Cash out” button and receive their winnings.

What you’ll need

  • Ganache: you can download a self-contained prebuilt Ganache binary for your platform of choice using the "Download" button on the Ganache website. After, run it and keep it running, this will deploy a private Ethereum network on your machine, port 7545
  • npm: follow this instructions to install npm
  • Metamask Chrome extension installed and running

How to lunch the ethereum roulette on your machine

Run Ganache and keep it running.

Clone the repo from github:

        
  git clone https://github.com/bordalix/ethereum-roulette.git
  cd ethereum-roulette
  npm install
      

Deploy the contract to your private blockchain:

        
  truffle deploy --reset
      

Run the webserver

        
  npm run dev
      

You now have the ethereum roulette on http://localhost:3000.

Have fun.