This project was bootstrapped with Create React App.
To start hardhat project, run the following command:
npx hardhatTo compile, run the following command:
npx hardhat compileTo deply to the local network, you first need to start local test node.
npx hardhat nodeNow we can run deploy script on other terminal.
npx hardhat run scripts/deploy.js --network localhostNote: Before deploy, you have to include below require commands at the heading of hardhat.config.js
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-waffle");To deploy to the live test network - Goerli, run the following script:
npx hardhat run scripts/deploy.js --network goerli🏗️ Important
To use .env file in React frontend, you need to include react-dotenv
Runs the app in the development mode.
npm startOpen http://localhost:3000 to view it in your browser.
To run hardhat task, first define task into hardhat.config.js
task("cocoa", "Printes the list of accounts", async (taskArg, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});Then run task as below.
npx hardhat cocoa