- 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;
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
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 )
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
!!!)
You are now set to start your local server. Make sure you're still in COINFLIP 2.0
and type:
yarn start