- Created a game where users can place Ether as bet (either selecting low representing 1,2,3 of the dice or high representing 4,5,6 of the dice) and obtain twice the amount of Ether if they win. If the user slection is wrong, Ether which he bet was not returned to the user.
- The decision of winning or losing is taken with the help of random number generated using Chainlink's Verifiable Random Function.
- Truffle box for Local DAPP Developemnt: https://github.com/truffle-box/react-box
- Metamask for Deploying it in Test networks: https://metamask.io/
- ChainLink's VRF function to generate Random number : https://blog.chain.link/random-number-generation-solidity/
- npm install -g truffle ---> Truffle intsallation
- truffle unbox react ---> Unbox the React box
- Run the React Application using "npm run start", this will start our React application in localhost:3000
- We will be provided with an option to chose either low(representing 1,2,3 in the dice) or high(representing 4,5,6 in the dice) and bet amount to be supplied as input.
- Since we are using rinkeby test network to deploy the application ("truffle migrate --network rinkeby_infura --reset"), we need some ETH in that network.
- We also need LINK for generating the random number by chainlink's VRF function.
- We need to supply the ETH and LINK to the Smart Contracts Address (we get this by deploying the application) for performing betting.
- Once we bet, according to the random number that gets generated, Match is performed between the generated random number and supplied low or high values.
- If the match is successful, The player gets twice the amount that he bet. Otherwise, he loses the game.