European roulette PoC deployed to the ropsten network
Customer: Personal project
Ethereum smart contract
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.
How to play
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.