Hardhat
Hardhat is a powerful Ethereum development environment that supports editing, compiling, deploying, and verifying smart contracts. This guide walks you through deploying smart contracts to the Neura Testnet using Hardhat in a TypeScript project setup.
Tooling Requirements
Before getting started, ensure your system has the following items:
Node.js version v24.2.0 or later
A modern package manager (npm or yarn)
Project Setup
Follow the steps below to create a TypeScript Hardhat project configured for Neura.
Create and initialize the project:
mkdir neura-hardhat-template
cd neura-hardhat-template
npm init -y
npm install --save-dev hardhat
npx hardhat initInstall required dependencies:
npm install --save-dev @nomicfoundation/hardhat-toolbox
npm install --save-dev @nomicfoundation/hardhat-verify
npm install dotenvEnvironment Configuration
Create a .env file in the root directory and add your deployer private key:
⚠️ Security Warning:
Never commit your
.envfile to version control. Make sure.envis listed in.gitignore.Do not expose your private key in any frontend or client-side code.
Use dedicated accounts and rotate keys regularly for test deployments.
Hardhat Configuration for Neura
Configure hardhat.config.ts with the Neura testnet settings:
Example Smart Contract
You can use either of the following sample contracts:
contracts/SimpleStorage.sol
contracts/Lock.sol(optional) — use this contract for parameterized deployment examples.
Smart Contract Deployment
Supported Deployment Methods:
Hardhat scripts (manual)
Hardhat Ignition (modular, preferred for parameterized setups)
Deploy to Local Hardhat Node
Start the local node:
In a separate terminal, deploy using Hardhat Ignition:
Or deploy manually via a script:
Deploy to Neura Testnet
Script-based deployment:
Ignition-based deployment:
Redeploy with a new address:
Deploy with constructor parameters:
Deployment Scripts
Deploy Using a Hardhat Script
Create
scripts/deploy.ts:
Deploy with the following command:
Deploy Using Hardhat Ignition
Create
ignition/modules/SimpleStorageModule.ts:
Deploy with the following command:
Testnet Faucet
To deploy contracts on the Neura Testnet, you'll need testnet ANKR tokens for gas.
Claim testnet funds from the faucet:
Deployment Output Examples
Here’s what successful deployments look like using both Hardhat scripts and Hardhat Ignition:
Script-Based Deployment
Deployment:
Output:
Ignition-Based Deployment
Deployment:
When prompted:
Output:
Last updated