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
.envfile using the.example.envas 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 thegoerlitestnet node you're working with then deploy thesmart contractsto. Setup with one for free from Alchemy. See Helpers.GOERLI-RPC-URL on how to export aGOERLI_RPC_URLfrom Alchemy.COINMARKETCAP_API_KEY: This is mainly for thehardhat-gas-reportpluggin so this is optional. If you want to play withhardhat-gas-reportpluggin, first go tohardhat.config.ts, toggle thegasReporter.enabledto 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_KEYa.k.aaccount's address(notPRIVATE_KEY) - Hit
Send Me ETHto get some freeGoerli ETH. Now,0.5 Goerli ETHshould 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 KEYbutton top-right. - The
URLunderHTTPSis theGOERLI_RPC_URLyou want. - Copy the
URLand paste it to your.envfile 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
.envfile underCOINMARKETCAP_API_KEY