Digital collectibles compatible with the ERC-721 standard have surged in popularity, especially since the rise of projects like Cryptokitties. This guide will walk you through creating and deploying your own NFT using the OpenZeppelin standard, covering everything from metadata creation to smart contract deployment.
What You Will Learn
- Key concepts of Non-Fungible Tokens (NFTs)
- How to create and host metadata for ERC-721 tokens
- Steps to upload files to decentralized storage (IPFS)
- Writing and deploying an ERC-721 contract using Remix IDE
Key Requirements
- A QuickNode endpoint (free tier available)
- A Web3 wallet (e.g., MetaMask) with test ETH
- IPFS CLI installed (or use QuickNode’s IPFS service)
- Modern web browser (Chrome recommended)
Understanding NFTs and ERC-721
What Are Non-Fungible Tokens?
NFTs are unique digital assets that cannot be replicated or exchanged 1:1 like cryptocurrencies. Each NFT has distinct attributes, making it ideal for representing:
- Digital art
- Collectibles
- Event tickets
- Virtual real estate
👉 Learn more about NFT use cases
ERC-721 Standard Explained
ERC-721 is the technical standard for NFTs on Ethereum. It defines:
- Core Functions:
balanceOf,ownerOf,safeTransferFrom, etc. - Events:
Transfer,Approval, tracking ownership changes - Metadata: Unique URIs linked to each token
Step-by-Step Guide
1. Hosting NFT Assets on IPFS
Option A: Standard IPFS CLI Method
- Install IPFS CLI.
Add files via:
ipfs add art.png ipfs add nft.json- Use the returned hashes (e.g.,
Qm...) to access files viahttps://ipfs.io/ipfs/Qm....
Option B: QuickNode IPFS (Simplified)
- Upload files via QuickNode’s dashboard.
- Copy the auto-generated IPFS URL (e.g.,
https://qn-shared.quicknode-ipfs.com/ipfs/Qm...).
2. Writing the ERC-721 Smart Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract MyToken is ERC721, ERC721URIStorage {
constructor() ERC721("MyToken", "MTK") {}
function mintNFT(address to, uint256 tokenId, string memory uri) public {
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}
}3. Deploying the Contract
- Compile and deploy via Remix IDE (Ethereum Sepolia testnet).
Call
mintNFTwith:- Recipient address
- Token ID (e.g.,
1) - IPFS JSON URL
👉 Explore advanced NFT contracts
FAQs
1. How much does it cost to mint an NFT?
Deployment costs depend on gas fees. Testnets like Sepolia allow free minting with test ETH.
2. Can I update NFT metadata after minting?
No. ERC-721 metadata is immutable once deployed. Plan metadata carefully.
3. What’s the difference between ERC-721 and ERC-1155?
ERC-1155 supports both fungible and non-fungible tokens in a single contract.
Conclusion
By following this guide, you’ve:
- Created NFT metadata hosted on IPFS
- Deployed a secure ERC-721 contract
- Minted your first NFT
For further reading, check out OpenZeppelin’s ERC-721 Wizard.
Need help? Join our Discord community for developer support!
### Key Features:
- **SEO Optimization**: Keywords like "ERC-721," "NFT minting," and "IPFS" are naturally integrated.
- **Structured Format**: Clear headings, bullet points, and FAQs enhance readability.
- **Engagement**: Anchor texts and a friendly tone encourage interaction.