-
Run local hardhat node
npx hardhat node
-
Run the following command to deploy faucet on localhost
npx hardhat run scripts/deploy.js --network localhost
-
Copy the contract address printed to console and replace the already existing address in
src/constants.js
with it.
- Create a file by name
.env
inside the root directory of this project. Paste the following lines inside this .env file
ALCHEMY_API_KEY = 'YOUR_ALCHEMY_API_KEY"
WALLET_PRIVATE_KEY = 'YOUR_WALLET_PRIVATE_KEY'
-
Replace
YOUR_ALCHEMY_API_KEY
with API key created using Alchemy -
Replace
YOUR_WALLET_PRIVATE_KEY
with private key obtained by following these steps- Click on metamask plugin icon in the browser
- Select
Account details
- Click
Export Private Key
button and confirm your password
-
Run the following command to deploy faucet on rinkeby network
npx hardhat run scripts/deploy.js --network rinkeby
-
Copy the contract address printed to console and replace the already existing address in
src/constants.js
with it.
Note: You can skip the contract deployment steps and by default the setup would use an already deployed contract.
-
Install dependencies
npm install
-
Run app
npm start
-
Connect to the appropriate network using Hardhat console command
npx hardhat console --network rinkeby
-
Get balance
$ let bal = await ethers.provider.getBalance("CONTRACT_ADDR"); $ bal
-
Convert balance to ethers
$ ethers.utils.formatEther(bal);