A project to practice React with Hardhat, Solidity smart contract, Metamask and Ethers.js.
-
Clone the Repository
git clone https://github.com/codebatine/Degen-Contract.git -
Navigate to the Project Directory
cd Degen-Contract -
Install Dependencies
npm i -y -
Install Hardhat
npm i hardhat -
Set Up Metamask
- Install the Metamask extension for your browser.
- Create an account or import an existing one.
- Connect to the Hardhat Network by clicking on the network dropdown (usually it will say "Ethereum Mainnet").
- Select "Custom RPC" to add the Hardhat Network details:
- Network Name: Hardhat
- New RPC URL: http://localhost:8545
- Chain ID: 31337
- Currency Symbol (optional): ETH
-
Compile your smart contracts with:
npx hardhat compile -
Then deploy them to the Hardhat Network with:
npx hardhat run --network localhost scripts/deploy.jsReplace scripts/deploy.js with the path to your deployment script.
-
Update the Smart Contract Address
After deploying your smart contracts, Hardhat will output the address of the deployed contract. You need to take this address and update your application's configuration to use it.
Open the
config.jsfile (or wherever your contract address is stored), and replace the existing contract address with the new one. -
Run the Project
npm run dev
