The project was built with React and Ethers.js. I also created and deployed smart contracts with Solidity, and Hardhat. It consists of a Casino in which you’re able to bet against players on a coin flip, if it’s heads you win, if not, you lose. The project handles the creation, management, and history of games, also the creation and history of gambles. The game contract receives the money from the gamblers and also sends the money to the winner.
20 hours
-
install dependencies by running
npm install
-
create a
.env
file and add theREACT_APP_CONTRACT_ADDRESS
environment variable with the address of the Casino contract instance.You could use the Casino contract instance deployed in the Rinkeby Network by adding this line to the
.env
file:
REACT_APP_CONTRACT_ADDRESS=0x3A4d5EB2668Bd13e429874876EC339F6c5F2090A
- run
npm start
to start the app.
-
First create a gambler, it'll create an instance of the
Gambler
contract. This contract will keep a record of the games played and receive the earnings from the games won. -
After registering as a gambler, you'll be able to play games or create a new one.
-
To play, click the play button, this will determine how is the winner and send the money to the winner's gambler contract.
-
If you win, you'll be able to withdraw the funds by clicking the wallet badge.
The project is in a beta stage, in which there are many parts that can be improved:
- The smarts contracts have to be optimized and audited.
- The UI can take advantage of the screen size.
- Alert the user if a transaction was completed successfully or if an error has occurred.