This is a project to learn about writing a simple smart contract using Solidity and using Hardhat's sample project template, deploying it on local and testnet as well as testing with it
-
Create a directory
-
cd
into that directory and run$ npx create-react-app [project name]
-
Install project dependencies
$ npm i -D hardhat ethers chai dotenv @nomiclabs/hardhat-ethers @nomiclabs/hardhat-waffle
- Create a hardhat project by running
$ npx hardhat
- Select
> Create simple project
option
-
Go to
hardhat.config.js
-
Updade Solidity to proper version
-
Set artifacts path in
src
when project is compiled
paths: {
artifacts: "./src/artifacts",
},
- Configure local network for local testing
networks: {
hardhat: {
chainId: 1337,
},
- Create
.env
file in root directory and adddotenv
dependency in config file
$ npx hardhat compile
- Generate hardhat local testing enviroment
npx hardhat node
$ npx hardhat run scripts/deploy.js --network localhost
- Generate hardhat local testing enviroment
$ npx hardhat node
$ npx hardhat run scripts/deploy.js --network [testnet name]
- Import local testing accounts to metamask using private key or get currency from testnet facuet and connect to testnet
- Connect to react
$ npm start