CoinFlip_2.0
CoinFlip_2.0 copied to clipboard
EVM compatible Dapp built with React/Truffle/Chainlink-VRF2 => Flip a coin to double your ETH!
Updates
- 2022/07 - Switch to Chainlink VRF v2 & Update solidity compiler version to 0.8.7;
- 2022/12 - Switch to Goerli network v2 & upgrade all deps & Update solc to 0.8.16;
Description
Decentralized application (Dapp), EVM compatible, built as a part of the programming course: Ethereum201 on academy.moralis.com.
Try it yourself: coinflip-double-up-your-eth.netlify.app/
Built With
Getting Started
Prerequisites
Make sure you have the following ready:
-
yarn
installed -
Truffle installed globally via
npm install -g truffle
(developped on v5.4.17). - Run a local blockchain via Ganache, or Ganache-cli, or register on Infura.io to deploy on an Ethereum network.
- MetaMask installed in your browser
- Cloned the repo via
git clone
Smart-Contracts Deployment
In your terminal, make sure you are in the COINFLIP_2.0
repo, and type:
yarn install
To deploy your smart-contracts:
- Subscribe to Chainlink VRF v2 ( Subscribtion to Chainlink VRF on Goerli ) ( LINK Faucet )
- Add your subscription id to the migration file:
blockchain/migrations/1_CoinFlip_migration.js
- Run the command below to deploy to the network of your choice.
truffle migrate --network <<network name here>>
So for Goerli, type:
truffle migrate --network goerli
- Replace the contract address in
src/constants.js
- Replace the abi file in
src/abis/coinFlip.js
- Make sure to fund the contract with some ETH ( Faucet for the Goerli network )
Config & Client
Before each deploy, make sure to:
- Change the
COINFLIP_ADDRESS
in/src/constants.js
to your deployed contracts address; - Copy the new abi file into the
src/abis
folder if you've made any changes to the contracts; - Enable/disable, and update the suitable networks in
truffle-config.js
; - In the
blockchain/
repo, create a file called.secret
and paste your mnemonic seed phrase inside; (Make sure you add this file in your.gitignore
!!!)
Acknowledgments
Use
You are now set to start your local server. Make sure you're still in COINFLIP 2.0
and type:
yarn start
# Enjoy!!!
⭐️ ... and don't forget to leave a star if you like it! ⭐️
(back to top)