ERC‑721
1 min read
Pronunciation
[ee-are-see seven-twenty-one]
Analogy
ERC‑721 is like a certificate of authenticity for a piece of art—each token ID corresponds to a single, unique item.
Definition
Key Points Intro
ERC‑721 standardizes NFTs via:
Key Points
Functions: `ownerOf`, `transferFrom`, `approve`, `getApproved`, `setApprovalForAll`, `isApprovedForAll`.
Events: `Transfer` and `Approval`.
Metadata extension: `tokenURI` for JSON metadata.
Enumerable extension: `totalSupply` and `tokenOfOwnerByIndex`.
Example
CryptoKitties uses ERC‑721: each cat has a unique `tokenId` and metadata URI pointing to its attributes.
Technical Deep Dive
ERC‑721 contracts maintain `mapping(uint256=>address) owners` and `mapping(address=>uint256) balances`. Metadata extension implements `tokenURI(uint256 id)` returning a URL. Enumerable adds `uint256[] ownerTokens` and indexing mappings.
Security Warning
Storing large metadata on‑chain can be expensive; use off‑chain storage with content hashing.
Caveat
ERC‑721 transfers do not batch; high‑volume operations incur gas overhead.
ERC‑721 - Related Articles
No related articles for this term.