Project to practice building a smart contract handling domain name records, and interacting with the contract via a React front-end.
Try it out here! https://andromeda-naming-service.vercel.app/
See useful setup and deployment instructions below.
To get started, clone this repo and follow these commands:
- Run
npm install
at the root of your directory - Run
npx hardhat run scripts/run.js
to deploy the contract within the Hardhat local development blockchain and create an example record - Run
npx hardhat run scripts/deploy.js --network mumbai
to deploy the contract to the Polygon Mumbai Testnet. See src/utils/networks.js for other networks. - Run
npm start
to start the React development server and automatically open the app in a new browser window
When changing the code in the smart contract, it must be redeployed. Run the command in step 3 above to deploy it to the Mumbai Testnet. The deploy script will log the address of the deployed contract to the console when it deploys successfully.
The compilation of the new contract will result in a new Application Binary Interface (ABI). Copy this from the local artifacts directory to the assets directory src/assets
.
Finally, copy the new deployed contract address and replace the CONTRACT_ADDRESS
constant within App.js
so that the front end is communicating
with the newly deployed contract.