ERC-721: Non-Fungible Token Standard

ยท

Authors

Created: 2018-01-24
Requires: EIP-165

Table of Contents

  1. Simple Summary
  2. Abstract
  3. Motivation
  4. Specification

  5. Rationale
  6. Backwards Compatibility
  7. Test Cases
  8. Implementations
  9. References
  10. 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:

Motivation

Standardization allows interoperability across wallets, marketplaces, and applications. Key benefits:

๐Ÿ‘‰ Explore NFT use cases

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

  1. Metadata (ERC721Metadata):

    • Provides token names, symbols, and URIs for off-chain data.
  2. Enumeration (ERC721Enumerable):

    • Allows querying NFTs by index or owner.

Caveats

Rationale

Design Choices

๐Ÿ‘‰ Learn about NFT security best practices

Backwards Compatibility

Test Cases

See 0xcert ERC721 tests for Truffle-based implementations.

Implementations

ProjectDescriptionLink
0xcertReference implementationGitHub
Su SquaresAdvertising platformWebsite
XXXXERC721Scalability demoGitHub

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

  1. ERC-20 Standard
  2. ERC-165 Interface Detection
  3. CryptoKitties Whitepaper

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