-
npx create-react-app hardhat-react-dapp
-
yarn add ethers hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers
-
npx hardhat
- Rename the script to
deploy.js
. - In the config, add the path to
artifacts
and the local hardhat network.
- Rename the script to
-
npx hardhat compile
artifacts
get generated;Greeter.json
contains the info that we will need for the front-end.
-
npx hardhat node
- Start local network. Acccounts are generated.
-
npx hardhat run scripts/deploy.js --network localhost
- Deploy the contract to the local network. Address of the contract is returned.
-
In the Metamask wallet, import account #0 by supplying its private key.
-
React app.
npm start
App.js
.-
- Import from
react
andethers
. ImportGreeter.json
ABI.
- Import from
-
- const
contractAddress
.useState()
->greeting
,setGreetingValue
.
- const
-
- Functions
fetchGreeting
,setGreeting
,requestAccount
.
- Functions
-
Notifications
You must be signed in to change notification settings - Fork 0
igortn/hardhat-react-dapp
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
The full stack dApp with React, Ethers.js, Solidity and Hardhat.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published