This repository contains a sample project that you can use as the starting point for your Ethereum project. It's also a great fit for learning the basics of smart contract development.
This project is intended to be used with the
Hardhat Beginners Tutorial, but you should be
able to follow it by yourself by reading the README and exploring its
contracts
, tests
, scripts
and frontend
directories.
The first things you need to do are cloning this repository and installing its dependencies:
git clone https://github.com/NomicFoundation/hardhat-boilerplate.git
cd hardhat-boilerplate
npm install
Once installed, let's run Hardhat's testing network:
npx hardhat node --fork https://eth-mainnet.g.alchemy.com/v2/i-f8AZApdD3wjWfasumFwAT5Vy19wdx0
// SON-RPC server:
http://127.0.0.1:7545 // Ganache
http://127.0.0.1:8545 // hardhat
// chain id: 31337
Then, on a new terminal, go to the repository's root folder and run this to deploy your contract:
npx hardhat run scripts/deploy.js
npx hardhat run scripts/deploy.js
Deploying the contracts with the account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Account balance: 10800793365606063692000
Token address: 0xc6e7DF5E7b4f2A278906862b61205850344D4e7d
Token total supply: 100000000000000000000000000000000000000000000
Finally, we can run the frontend with:
cd frontend
npm install
npm start
Open http://localhost:3000/ to see your Dapp. You will
need to have Coinbase Wallet or Metamask installed and listening to
localhost 8545
.