NFTs and ERC-721: Unique Tokens, Metadata, Minting, IPFS and Marketplace Basics
Fungible Versus Non-Fungible
| Fungible (ERC-20) | Non-fungible (ERC-721) | |
|---|---|---|
| Units | All identical | Each token has a unique ID |
| Example | 100 rupee notes | A concert ticket with a seat number |
| Balance | A number | A list of token IDs you own |
What an NFT Really Stores
- The chain stores who owns token ID N and a token URI (a link)
- The link points to metadata JSON that describes the item and links to an image
- Large files are not stored on-chain because it is too costly. They are usually on IPFS or similar storage
Metadata Example
json
{
"name": "Campus Badge #1",
"description": "Awarded for finishing the blockchain course.",
"image": "ipfs://EXAMPLE_CID/badge1.png",
"attributes": [
{ "trait_type": "Level", "value": "Beginner" }
]
}
IPFS in One Line
IPFS addresses files by a hash of their content (CID), so the link changes if the file changes. You still need someone to pin the file so it stays available.
A Mintable NFT Contract
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract CampusBadge is ERC721URIStorage, Ownable {
uint256 private _nextId;
constructor() ERC721("Campus Badge", "BADGE") Ownable(msg.sender) {}
function mint(address to, string memory uri) external onlyOwner returns (uint256) {
uint256 id = _nextId++;
_safeMint(to, id);
_setTokenURI(id, uri);
return id;
}
}
_safeMintchecks that a receiving contract can handle NFTsownerOf(id)tells the owner.transferFromandsafeTransferFrommove tokenstokenURI(id)returns the metadata link
Related Standards
| Standard | Use |
|---|---|
| ERC-1155 | One contract with many token types, fungible and non-fungible. Good for games |
| ERC-2981 | Standard way to signal royalty information (marketplaces may or may not honor it) |
Honest Notes
- Owning an NFT usually means owning the token, not copyright of the artwork
- If metadata sits on a normal web server that goes offline, the NFT may lose its image
- Prices can be very volatile. This is a technology lesson, not investment advice
Useful Non-Art Uses
- Event tickets and passes
- Course completion certificates
- Membership cards
- In-game items
- Proof of ownership for real-world assets (with legal support)
Practice
- Mint two badges and call
ownerOfandtokenURI - Why is the image usually not stored on-chain?
- What is the difference between ERC-721 and ERC-1155?
Conclusion
ERC-721 tokens are unique. The chain stores ownership and a URI, while the image and details live in metadata, usually on IPFS.
Quick Summary: NFT vs fungible; stored data; metadata; IPFS; contract; standards; notes; uses.

