ERC-721: The Standard for Non-Fungible Tokens (NFTs)

Introduction

ERC-721 is the standard for non-fungible tokens (NFTs), meaning each token is unique and cannot be replaced (e.g., CryptoKitties, Bored Apes).

Architecture

An ERC-721 token smart contract includes:

  • Token Ownership Mapping: Each token has a unique tokenId linked to an address.

  • Metadata Storage: Stores information like name, image, and description.

  • Transfer Functions: Allows ownership to be transferred.

Key Functions of ERC-721

Function
Description

balanceOf(address)

Returns the number of NFTs owned by an address

ownerOf(uint256 tokenId)

Returns the owner of a specific NFT

transferFrom(address, address, uint256)

Transfers ownership of an NFT

approve(address, uint256)

Approves another address to manage an NFT

safeTransferFrom(address, address, uint256)

Ensures safe NFT transfer

Workflow of ERC-721 Transactions

  1. Minting: A unique tokenId is created and assigned to an owner.

  2. Transfer: The NFT can be transferred using transferFrom().

  3. Approval & Marketplace Integration:

    • The owner approves a marketplace contract to manage their NFT using approve().

    • The marketplace can then transfer the NFT on behalf of the owner.

Example: ERC-721 Smart Contract

ERC-721 NFT Flow

Last updated

Was this helpful?