Skip to main content
Hardhat is a development environment for Ethereum software that helps developers manage and automate recurring tasks involved in building smart contracts and decentralized applications (dApps).
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:
Follow the prompts to set up your project. Choose:
  • JavaScript or TypeScript project
  • Create a sample project to get started quickly

Configuring for MANTRA Chain

Update hardhat.config.js (or hardhat.config.ts) to add MANTRA Chain networks:

Building Contracts

Compile your contracts:

Testing

Run tests:

Deploying

Create a deployment script in scripts/deploy.js:
Deploy to testnet:
Hardhat Ignition is useful when you want repeatable deployments as “modules”.
  1. Add a network entry (example using Hardhat config vars):
  1. Set the private key (interactive):
  1. Deploy an Ignition module:

Example Project

Check out our example project and follow the README for a complete walkthrough.

Next Steps