Introduction
Hardhat is a powerful development environment that simplifies the creation, testing, deployment, and verification of smart contracts. This guide will walk you through deploying a smart contract specifically on the Nero Chain Testnet.
Node.js installed (Download Node.js)
Your wallet's private key (for testnet)
An API key from Neroscan (Get here)
Nero Chain Testnet tokens (Request from faucet)
Create a fresh directory for your smart contract and start your project:
mkdir NeroContract
cd NeroContract
npm init -y
Install Hardhat and its necessary tools:
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-ignition-ethers
Then initialize Hardhat:
Choose the option "Create a JavaScript project" and complete the setup.
You can write your own Solidity contract or quickly start using OpenZeppelin’s template for ERC-20 tokens:
Save your contract file inside the contracts folder created by Hardhat.
Create .env file in the root directory:
NERO_TESTNET_PROVIDER_URL=https://rpc-testnet.nerochain.io
PRIVATE_KEY=<your_private_key>
API_KEY=<your_neroscan_api_key>
Now configure hardhat.config.js:
require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-ignition-ethers");
require('dotenv').config();
module.exports = {
solidity: "0.8.24",
defaultNetwork: "nero_testnet",
networks: {
nero_testnet: {
url: process.env.NERO_TESTNET_PROVIDER_URL,
accounts: [process.env.PRIVATE_KEY]
}
},
etherscan: {
apiKey: process.env.API_KEY,
customChains: [
{
network: "nero_testnet",
chainId: 689,
urls: {
apiURL: "https://api-testnet.neroscan.io/api",
browserURL: "https://testnet.neroscan.io"
}
}
],
enabled: true
}
};
First, compile your smart contract:
npx hardhat compile
Deploy using Hardhat Ignition:
npx hardhat ignition deploy ./ignition/modules/YourDeployScript.js --network nero_testnet
Ensure you replace YourDeployScript.js with your actual deploy script filename.
Check your smart contract deployment on the Nero Testnet Explorer.

You've successfully created, deployed, and verified your smart contract on the Nero Chain Testnet. You're now ready to explore further possibilities with Hardhat and Nero Chain's robust environment.
Explore deployment to Nero Mainnet by adjusting configurations accordingly, and continue building secure and innovative blockchain applications.

