npx degit github:mcisne4/template-hardhat my-project
cd my-project
yarn install
contracts/
- Directory for the Solidiy smart contractsdeploy/
- Directory for the deployment scriptstest/
- Directory for unit tests
- hardhat - Smart contract development environment
- hardhat-deploy - To simplify smart contract deployment
- hardhat-watcher - To watch for file changes and restart hardhat actions
- chai - For testing
- dotenv - To store sensitive data
- prettier - For code formatting
hardhat
- Default. Uses the local hardhat networklocalhost
- Uses the local hardhat networkganache
- Uses a running Ganache GUI network- Note: You might need to update the Network ID inside of Ganache to match that of hardhat (
31337
)
- Note: You might need to update the Network ID inside of Ganache to match that of hardhat (
// File: 'hardhat.config.js'
module.exports = {
networks: [
network_name: {
url: process.env.NETWORK_RPC_URL,
accounts: [process.env.ACCOUNT_PRIVATE_KEY],
chainId: process.env.NETWORK_CHAIN_ID
}
]
}
Name | ChainID |
---|---|
Ethereum Mainnet | 1 |
Binance Smart Chain | 56 |
Avalance C-Chain | 43114 |
Polygon Mainnet | 137 |
Rinkeby Ethereum Testnet | 4 |
Ropsten Ethereum Testnet | 3 |
Mumbai Polygon Testnet | 80001 |
clean
- To clear the cache and delete artifactscompile
- To compile your smart contractsnode
- Launches a local hardhat nodetest
- Runs smart contract testsdeploy
- Runs your deployment scripts
recompile
- Watches for file changes in thecontracts/
directory and runshardhat compile
as neededretest
- Watches for*.test.js
file chanes in thetest/
directory and runshardhat test
as neededredeploy
- Watches for file changes in thedeploy/
directory and runshardhat deploy
as needed