Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
- Create an ERC-721 NFT collection contract with OpenZeppelin
- Deploy to Monad mainnet with Hardhat
- Mint NFTs programmatically using ethers.js and web3.py
- Query NFT ownership and metadata
- Understand how Monad’s fast finality helps NFT apps
Prerequisites
- Chainstack account with a Monad node endpoint
- Node.js v16+ and Python 3.8+
- Basic Solidity knowledge
- MON tokens for gas fees
Overview
NFTs on Monad benefit from:- Fast ownership confirmation: A mint is finalized within about a second of being included in a block
- High throughput: Mint thousands of NFTs without network congestion
- Low latency: Real-time updates for marketplaces and galleries
- No reorganizations after finality: Ownership is permanent once the block is finalized
Create the NFT contract
Set up the project
Configure environment variables
Create a.env file:
.env
Configure Hardhat
Replacehardhat.config.js:
hardhat.config.js
Write the NFT contract
Createcontracts/MonadNFT.sol:
contracts/MonadNFT.sol
- Mintable NFTs with customizable metadata URIs
- Max supply to limit collection size
- Mint price for public mints
- Owner minting for free mints by the contract owner
- Events for tracking mints
Deploy the contract
Createscripts/deploy.js:
scripts/deploy.js
Mint NFTs with JavaScript
Createscripts/mint.js:
scripts/mint.js
Mint NFTs with Python
Install web3.py:mint.py:
mint.py
Query NFT data
Get all NFTs owned by an address
Batch minting
For minting multiple NFTs efficiently:Monad-specific notes
Why Monad is ideal for NFTs:
- Fast finality: A purchase is finalized within about a second of being included in a block.
- No reorganizations after finality: Once the mint’s block is finalized, ownership is permanent.
- High throughput: Mint large collections or handle high-volume drops without network congestion.
- Instant marketplace updates: Listings and sales reflect immediately on-chain.
Complete project structure
Next steps
Now that you can mint NFTs on Monad, you can:- Add metadata to IPFS using services like Pinata or NFT.Storage
- Build a minting frontend with React or Next.js
- Create a marketplace interface
- Implement royalties with ERC-2981
- Add batch minting for efficient large-scale mints