Authors
- William Entriken (@fulldecent)
- Dieter Shirley ([email protected])
- Jacob Evans ([email protected])
- Nastassia Sachs ([email protected])
Created: 2018-01-24
Requires: EIP-165
Table of Contents
- Simple Summary
- Abstract
- Motivation
- Rationale
- Backwards Compatibility
- Test Cases
- Implementations
- References
- Copyright
Simple Summary
A standard interface for non-fungible tokens (NFTs), which represent unique digital or physical assets like collectibles, property deeds, or virtual items.
Abstract
ERC-721 defines a standard API for NFTs in smart contracts, enabling tracking and transfer of unique tokens. Unlike fungible tokens (ERC-20), each NFT is distinct, making it ideal for:
- Digital collectibles (e.g., CryptoKitties)
- Virtual real estate (e.g., Decentraland)
- Physical asset ownership (e.g., real estate titles)
Motivation
Standardization allows interoperability across wallets, marketplaces, and applications. Key benefits:
- Universal Support: Any NFT can integrate with Ethereum dApps.
- Scalability: Supports contracts managing few or millions of NFTs.
- Flexibility: Enables use cases like fractional ownership and delegated management.
Specification
Core Interface
pragma solidity ^0.4.20;
interface ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
function balanceOf(address _owner) external view returns (uint256);
function ownerOf(uint256 _tokenId) external view returns (address);
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
function approve(address _approved, uint256 _tokenId) external payable;
function setApprovalForAll(address _operator, bool _approved) external;
function getApproved(uint256 _tokenId) external view returns (address);
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
Optional Extensions
Metadata (
ERC721Metadata
):- Provides token names, symbols, and URIs for off-chain data.
Enumeration (
ERC721Enumerable
):- Allows querying NFTs by index or owner.
Caveats
- Requires ERC-165 interface detection.
- Must handle edge cases like zero-address ownership.
- Solidity version-specific considerations apply.
Rationale
Design Choices
- NFT Identifiers: Uses
uint256
for compatibility with UUIDs/hashes. - Transfer Mechanism: Dual safe/unsafe methods for flexibility.
- Privacy: On-chain ownership is inherently public.
๐ Learn about NFT security best practices
Backwards Compatibility
- Adopts ERC-20 patterns for
balanceOf
,name
, andsymbol
. - Introduces
onERC721Received
to prevent accidental transfers.
Test Cases
See 0xcert ERC721 tests for Truffle-based implementations.
Implementations
Project | Description | Link |
---|---|---|
0xcert | Reference implementation | GitHub |
Su Squares | Advertising platform | Website |
XXXXERC721 | Scalability demo | GitHub |
FAQs
What makes ERC-721 different from ERC-20?
ERC-721 tokens are unique and indivisible (non-fungible), while ERC-20 tokens are interchangeable and divisible.
Can ERC-721 tokens represent physical assets?
Yes, they can tokenize real-world assets like property deeds or artwork, though legal recognition varies by jurisdiction.
How do I create an ERC-721 token?
Implement the interface in a smart contract and deploy it to Ethereum. Use tools like OpenZeppelin for boilerplate code.
References
Copyright
CC0 1.0 Universal.
Key optimizations:
1. Structured content with clear hierarchy using Markdown
2. Integrated 3-8 keywords: NFTs, smart contracts, token standard, Ethereum, CryptoKitties, decentralized, ownership
3. Added FAQ section for user engagement
4. Included strategic anchor links
5. Removed redundant dates and technical caveats