Blockchain development continues to evolve at a rapid pace, and Berachain has emerged as a powerful EVM-compatible, Cosmos-based Layer 1 chain designed for high performance, scalability, and developer innovation. With its unique Proof-of-Liquidity (PoL) consensus mechanism and seamless Ethereum compatibility, Berachain offers an ideal environment for building and testing decentralized applications (dApps), particularly non-fungible tokens (NFTs).
This comprehensive guide walks you through deploying and verifying an ERC-721 smart contract on the Berachain Artio testnet using Hardhat, one of the most popular Ethereum development environments. Whether you're a seasoned Solidity developer or stepping into Web3 development, this tutorial ensures a smooth onboarding experience.
Why Berachain Artio Testnet?
The Berachain Artio testnet serves as a critical sandbox for developers preparing for the upcoming Berachain mainnet launch. It allows full simulation of deployment, interaction, and verification processes in a risk-free environment. With EVM compatibility, developers can leverage existing Ethereum tooling—like Hardhat, MetaMask, and OpenZeppelin—to build and test dApps efficiently.
Artio supports ERC-721 and ERC-20 standards, making it perfect for experimenting with NFTs and DeFi protocols. Early adopters gain valuable insights and positioning ahead of mainnet incentives.
👉 Start building on one of the fastest-evolving EVM chains today.
Why Use Hardhat for Smart Contract Development?
Hardhat is a powerful development environment tailored for Ethereum and EVM-compatible blockchains. It provides essential tools for compiling, testing, debugging, deploying, and verifying smart contracts—all within a single framework.
Think of Hardhat as your developer workshop: equipped with console.log debugging (yes, it works on-chain!), automated testing via built-in network forks, and plugin support for advanced functionality like contract verification.
Its integration with ethers.js and TypeScript ensures modern, type-safe development practices while maintaining flexibility across networks—including Berachain.
What You’ll Build: An ERC-721 NFT Contract
In this tutorial, you will:
- Set up a Hardhat project
- Write a minimal ERC-721 NFT contract using OpenZeppelin
- Deploy it to the Berachain Artio testnet
- Verify the contract source code on Beratrail (Berachain’s block explorer)
By the end, you’ll have a verified NFT contract ready for real-world use or further enhancement with metadata, royalties, or minting logic.
Prerequisites
Before diving in, ensure you have the following:
- Basic understanding of blockchain and smart contracts
- Proficiency in Solidity programming language
- Node.js (v18 or higher) and npm installed
- MetaMask wallet configured
- Testnet BERA tokens (available via Berachain faucet)
You can check your Node version with:
node -vStep 1: Initialize Your Node.js Project
Create a dedicated project folder and initialize it with default settings:
mkdir bera-hardhat && cd bera-hardhat
npm init -yThis creates a package.json file to manage dependencies.
Step 2: Install and Configure Hardhat
Install Hardhat as a dev dependency:
npm install --save-dev hardhatThen initialize the project:
npx hardhat initChoose:
- Create a TypeScript project
- Add
.gitignore - Install sample dependencies (includes
@nomicfoundation/hardhat-toolbox)
After setup completes, verify everything works:
npx hardhat testA successful output shows 9 passing tests—your environment is ready.
Step 3: Develop Your ERC-721 NFT Contract
Navigate to the contracts/ directory and create NFT.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NFT is ERC721 {
uint256 public currentTokenId;
constructor() ERC721("Bear NFT", "BNFT") {}
function mint(address recipient) public payable returns (uint256) {
uint256 newItemId = ++currentTokenId;
_safeMint(recipient, newItemId);
return newItemId;
}
}Install OpenZeppelin contracts:
npm install @openzeppelin/contractsThis contract allows anyone to mint a new NFT by calling the mint() function. The token ID auto-increments, ensuring uniqueness.
Step 4: Set Up Environment Variables
Install dotenv to securely store private keys:
npm install dotenv --saveCreate a .env file in the root:
WALLET_KEY=0xYourMetaMaskPrivateKeyHere🔒 Never commit this file to version control. Add.envto.gitignore.
Step 5: Configure Hardhat for Berachain Artio
Update hardhat.config.ts with Berachain network settings:
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-verify";
require("dotenv").config();
const config: HardhatUserConfig = {
solidity: "0.8.23",
networks: {
"berachain-artio": {
url: "https://rpc.ankr.com/berachain_testnet",
accounts: [process.env.WALLET_KEY as string],
chainId: 80085,
gasPrice: 10000000000,
},
},
etherscan: {
apiKey: {
berachainArtio: "placeholder", // No real API key required
},
customChains: [
{
network: "berachainArtio",
chainId: 80085,
urls: {
apiURL: "https://api.routescan.io/v2/network/testnet/evm/80085/etherscan",
browserURL: "https://artio.beratrail.io",
},
},
],
},
};
export default config;This configuration connects your project to the Artio testnet via Ankr RPC and enables verification through Routescan-powered Beratrail.
Step 6: Create Deployment Script
In the scripts/ folder, create deploy.ts:
import { ethers } from 'hardhat';
async function main() {
const NFT = await ethers.getContractFactory('NFT');
const nft = await NFT.deploy();
await nft.waitForDeployment();
console.log('NFT Contract Deployed at:', await nft.getAddress());
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});This script compiles and deploys your contract to Artio.
Step 7: Deploy to Berachain Artio
Run the deployment command:
npx hardhat run scripts/deploy.ts --network berachain-artioOn success, you’ll see:
NFT Contract Deployed at: 0x...Copy this address—you’ll need it for verification.
👉 Need more gas? Explore top-tier Web3 platforms offering testnet incentives.
Step 8: Verify Your Contract
Install the verification plugin:
npm install --save-dev @nomicfoundation/hardhat-verifyThen verify your contract:
npx hardhat verify --network berachain-artio YOUR_CONTRACT_ADDRESSExample:
npx hardhat verify --network berachain-artio 0xBC862C68CE9EE3aFa762DbF7A51712E3c6E79215Upon success:
The contract has been verified on Etherscan.
https://artio.beratrail.io/address/0x...#codeNow anyone can view your source code on Beratrail—boosting transparency and trust.
Key Tips for Successful Deployment
- Avoid
gas: "auto"in config; set fixedgasPricefor faster transactions. - Ensure Solidity version in contract matches
hardhat.config.ts. - Double-check wallet balance—get free BERA from Berachain faucet.
Frequently Asked Questions (FAQ)
Q1: Is Berachain fully EVM-compatible?
Yes. Berachain is fully EVM-compatible, meaning you can use Ethereum tools like Hardhat, Remix, MetaMask, and Truffle without modification.
Q2: Do I need an API key to verify contracts on Berachain?
No. Unlike Ethereum, Berachain does not require an API key for verification. A placeholder value suffices in the config.
Q3: Where can I get testnet BERA tokens?
Visit the official Berachain faucet and connect your wallet to receive free testnet tokens.
Q4: Can I use JavaScript instead of TypeScript?
Absolutely. While this guide uses TypeScript for better type safety, you can configure Hardhat with JavaScript (hardhat.config.js) if preferred.
Q5: What is the chain ID for Berachain Artio?
The chain ID is 80085. Use this when adding the network to MetaMask or configuring tools.
Q6: Why is contract verification important?
Verification proves that the deployed bytecode matches the public source code. It enhances security, auditability, and user trust—critical for production dApps.
Final Thoughts
Deploying and verifying smart contracts on Berachain Artio is straightforward when using familiar tools like Hardhat, OpenZeppelin, and ethers.js. With EVM compatibility and strong developer tooling support, Berachain lowers the barrier to entry while offering high performance and innovative economic models like Proof-of-Liquidity.
Now that your NFT contract is live and verified, consider extending it with metadata (ERC-721URIStorage), mint limits, or royalty support.
Stay ahead in the Web3 revolution by mastering emerging chains early.
👉 Accelerate your blockchain journey with cutting-edge tools and resources.