An ethereum playground powered on top of the hardhat framework and ethers.js library. Smart contracts
are written in solidity language and thoroughly tested using the chai.js unit testing framework.
The contracts' source code are published on the Gรถrli ethereum testnet and verified on etherscan.io using hardhat-etherscan. See Verified on Etherscan for the list of verified contracts.
git clone https://github.com/logann131/ethereum-dev-sandbox.git
cd ethereum-dev-sandbox/smart_contract
yarn
- create a
.env
file using the.example.env
as the template and fill out the variables.PRIVATE_KEY:
The private key of your metamask account. See Helpers.PRIVATE-KEY on how to export yourPRIVATE KEY
. NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT AND DO NOT SHARE YOUR PRIVATE KEY.GOERLI_RPC_URL
: This is url of thegoerli
testnet node you're working with then deploy thesmart contracts
to. Setup with one for free from Alchemy. See Helpers.GOERLI-RPC-URL on how to export aGOERLI_RPC_URL
from Alchemy.COINMARKETCAP_API_KEY
: This is mainly for thehardhat-gas-report
pluggin so this is optional. If you want to play withhardhat-gas-report
pluggin, first go tohardhat.config.ts
, toggle thegasReporter.enabled
to true. Then see Helpers.COINMARKETCAP_API_KEY on how to export yourCOINMARKETCAP_API_KEY
- Head to Goerli Faucet
- Sign into the site using the Alchemy account you've created for the
GOERLI_RPC_URL
- Paste your metamask
PUBLIC_KEY
a.k.aaccount's address
(notPRIVATE_KEY
) - Hit
Send Me ETH
to get some freeGoerli ETH
. Now,0.5 Goerli ETH
should show up in your metamask account
yarn hardhat compile
yarn hardhat test
yarn hardhat run scripts/deploy.ts --network goerli
yarn hardhat node
then leave this terminal session open. This will set up a list of 20 fake ethereum accounts with fake ethers to serve testing purposes
- Open new terminal session, run
yarn hardhat run scripts --network hardhat
6. Verify
smart contracts on etherscan
yarn hardhat verify --network goerli DEPLOYED_CONTRACT_ADDRESS "Constructor args..."
@notice: replace Constructor args
with associate variables for each contract
1. How to export PRIVATE_KEY
from your metamask
How to export an account's private key
2. How to export a GOERLI_RPC_URL
from Alchemy.
- Go to Alchemy =>
Signup
=>Signin
- Hit
CREATE APP
=> fill out the form{ NAME: 'ANY', DESCRIPTION: 'ANY', CHAIN: 'Ethereum', NETWORK: 'Goerli` }
- Now, go to the app you just created. Find and click on the
VIEW KEY
button top-right. - The
URL
underHTTPS
is theGOERLI_RPC_URL
you want. - Copy the
URL
and paste it to your.env
file underGOERLI_RPC_URL
3. How to export a COINMARKETCAP_API_KEY
from coinmarketcap
- Go here and pick the first plan-
GET FREE API KEY
. - Signup with your email then sign into coinmarketcap
- Now copy the API Key there and paste it to your
.env
file underCOINMARKETCAP_API_KEY