Hardhat Tutorial:
For new users, the Hardhat tutorial provides step-by-step instructions and explains essential concepts for developing smart contracts.
Prerequisites
Node.js
Install Node.js following the official documentation. MANTRA Chain requires Node.js ≥ 18.0, but we recommend using the latest LTS version (currently v22).nvm is an excellent tool to easily manage multiple Node.js versions on your local machine. More details here!Installation
Create a new Hardhat project:- JavaScript or TypeScript project
- Create a sample project to get started quickly
Configuring for MANTRA Chain
Updatehardhat.config.js (or hardhat.config.ts) to add MANTRA Chain networks:
Building Contracts
Compile your contracts:Testing
Run tests:Deploying
Create a deployment script inscripts/deploy.js:
Hardhat Ignition (recommended for structured deployments)
Hardhat Ignition is useful when you want repeatable deployments as “modules”.- Add a network entry (example using Hardhat config vars):
- Set the private key (interactive):
- Deploy an Ignition module:
Example Project
Check out our example project and follow the README for a complete walkthrough.Next Steps
- Learn about deploying contracts
- Understand contract verification
- Explore EVM development