Introduction
NFTs have become one of the most exciting parts of the Web3 world. And now, thanks to Base, deploying your own NFT collection is easier and cheaper than ever. Base is built on the OP Stack and is fully compatible with Ethereum tools, so you can use everything you already know, just faster and with lower fees.
In this article, we will cover
- Creating an ERC-721 smart contract
- Uploading your images and metadata to IPFS
- Minting your NFTs
- Listing them for sale
Let’s get started!
Step 1. Project Setup
Tools you will need:
- Node.js & npm
- MetaMask wallet
- Hardhat (for smart contract deployment)
- Pinata or NFT.storage (for uploading metadata)
Initialize the project
mkdir base-nft-collection
cd base-nft-collection
npm init -y
npm install --save-dev hardhat
npx hardhat
Choose “Create a basic sample project.”
Step 2. Install NFT Dependencies
npm install @openzeppelin/contracts dotenv @nomicfoundation/hardhat-toolbox
These give you
- ERC-721 smart contract templates
- Secure environment variable handling
- Testing and deployment tools
Step 3. Create Your NFT Contract
In the /contracts folder, create a file: MyNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyNFT is ERC721URIStorage, Ownable {
uint256 public tokenCounter;
constructor(address initialOwner) ERC721("MyBaseNFT", "MBNFT") Ownable(initialOwner) {
tokenCounter = 0;
}
function mintNFT(address to, string memory tokenURI) public onlyOwner {
_safeMint(to, tokenCounter);
_setTokenURI(tokenCounter, tokenURI);
tokenCounter++;
}
}
This smart contract lets the owner mint ERC-721 NFTs with a custom URI for each one. It's perfect for creating a small NFT collection where the owner controls all minting.
Step 4. Upload Metadata to IPFS
Use Pinata or NFT.Storage to upload
- Your images
- A metadata JSON file for each NFT. Example
{
"name": "Base NFT #1",
"description": "This is my first NFT on Base",
"image": "ipfs://Qm...yourImageHash"
}
Upload and copy the IPFS CID (link) for each file.

Step 5. Write Deployment Script
Create a file scripts/deploy.js
- This script is used to deploy your MyNFT smart contract to the blockchain using Hardhat and ethers.js. First, it fetches the wallet address (called the deployer) which will be used to deploy the contract. Then, it loads the compiled version of your MyNFT contract using getContractFactory.
- After that, it deploys the contract and passes the deployer's address to the constructor so the deployer becomes the owner of the contract.
- The script then waits for the deployment to finish completely and confirms that the contract is live on the network.
- Finally, it prints out the address of the wallet that deployed the contract and the address where the contract is deployed. If anything goes wrong during the process, it catches the error and displays it in the terminal.





Join the conversation! Your thoughts help the community grow.