Skip to content

๐ŸŽ‹ A playground that utilizes the Hardhat framework and ethers.js library, providing a dynamic and user-friendly environment for the creation and testing of smart contracts written in Solidity, with the use of the Chai.js unit testing framework ensuring the robustness and security of the contracts.

Notifications You must be signed in to change notification settings

quiet-node/ethereum-dev-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

97 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Ethereum Development Sandbox

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.

Getting Started

Requirement

Quickstart

git clone https://github.com/logann131/ethereum-dev-sandbox.git
cd ethereum-dev-sandbox/smart_contract
yarn

Running the project

1. Set environment variables

  • 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 your PRIVATE 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 the goerli testnet node you're working with then deploy the smart contracts to. Setup with one for free from Alchemy. See Helpers.GOERLI-RPC-URL on how to export a GOERLI_RPC_URL from Alchemy.
    • COINMARKETCAP_API_KEY: This is mainly for the hardhat-gas-report pluggin so this is optional. If you want to play with hardhat-gas-report pluggin, first go to hardhat.config.ts, toggle the gasReporter.enabled to true. Then see Helpers.COINMARKETCAP_API_KEY on how to export your COINMARKETCAP_API_KEY

2. Get testnet Goerli ETH

  • 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.a account's address (not PRIVATE_KEY)
  • Hit Send Me ETH to get some free Goerli ETH. Now, 0.5 Goerli ETH should show up in your metamask account

3. Compile smart contracts

yarn hardhat compile

4. Test smart contracts

yarn hardhat test

5.1 Deploy smart contracts to Goerli Testnet

yarn hardhat run scripts/deploy.ts --network goerli

5.2 Deploy smart contracts to localhost/hardhat network

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

Helpers

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 under HTTPS is the GOERLI_RPC_URL you want.
  • Copy the URL and paste it to your .env file under GOERLI_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 under COINMARKETCAP_API_KEY

Verified on Etherscan

About

๐ŸŽ‹ A playground that utilizes the Hardhat framework and ethers.js library, providing a dynamic and user-friendly environment for the creation and testing of smart contracts written in Solidity, with the use of the Chai.js unit testing framework ensuring the robustness and security of the contracts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published