ERC-2981 is a standardized smart contract interface that allows an NFT's smart contract to declare how royalties should be paid to its creators or rights holders upon secondary sales. It provides a royaltyInfo function that marketplaces and other applications can call to receive two critical pieces of data: the recipient address for the royalty payment and the royalty amount, calculated as a percentage of the sale price. This creates a universal, on-chain signal that is far more reliable than the off-chain metadata used by earlier systems.
ERC-2981
What is ERC-2981?
ERC-2981 is an Ethereum Request for Comments that defines a standardized, on-chain method for signaling royalty information for Non-Fungible Tokens (NFTs).
The standard was created to solve the fragmentation and unreliability of royalty enforcement across different NFT marketplaces. Prior to ERC-2981, platforms used various ad-hoc methods, such as off-chain metadata fields or proprietary marketplace policies, which were easily ignored or manipulated. By embedding the royalty logic directly into the token's contract code, ERC-2981 provides a permissionless and verifiable standard that any compliant marketplace can query, making royalty payments more transparent and enforceable across the entire ecosystem.
A key technical feature of ERC-2981 is its flexibility. The royaltyInfo function accepts both a tokenId and a salePrice as parameters, allowing for sophisticated royalty schemes. This enables per-token customization (e.g., different royalties for different pieces in a collection) and ensures the royalty amount is always calculated dynamically based on the actual sale price. The function returns the royalty amount in the same denomination as the sale price, simplifying payment processing for marketplaces.
For developers and creators, implementing ERC-2981 involves adding the interface and the royaltyInfo function logic to an NFT's smart contract, often inheriting from a base contract like OpenZeppelin's implementation. Marketplaces and other intermediaries that integrate the standard query this function during a sale to determine the required payment. It is important to note that ERC-2981 is a signaling standard; it does not automatically enforce payments—that responsibility lies with the marketplace or exchange executing the sale.
ERC-2981 has become a foundational standard for the NFT ecosystem, widely adopted by major marketplaces including OpenSea, Rarible, and LooksRare. It is frequently implemented alongside core NFT standards like ERC-721 and ERC-1155. While it significantly improves on-chain signaling, the broader challenge of royalty enforcement—ensuring all platforms respect these on-chain signals—remains an active area of development and discussion within the community.
Etymology & Origin
The development of ERC-2981 is a direct response to the limitations of earlier NFT royalty systems, representing a formalization of a core marketplace feature.
ERC-2981 is an Ethereum Request for Comments (ERC) standard that defines a standardized, on-chain method for signaling royalty payment information for Non-Fungible Tokens (NFTs). Its etymology is straightforward: 'ERC' denotes its status as an Ethereum improvement proposal, while '2981' is its unique sequential identifier within the EIP repository. The standard was formally proposed in September 2020 by developers William Entriken, Diemon, and Radicle, with the explicit goal of creating a universal interface that smart contracts could implement to declare royalty recipients and amounts.
The origin of ERC-2981 lies in the fragmented, off-chain royalty systems that preceded it. Prior to its introduction, NFT marketplaces and platforms relied on proprietary, centralized databases or mutable metadata to determine royalty payouts. This created a fragile ecosystem where royalties could easily be circumvented on secondary sales if a marketplace chose not to honor them. ERC-2981 emerged as a technical solution to embed this financial logic directly into the NFT's smart contract, making royalty claims permissionless and verifiable by any compliant platform.
The standard's design is an elegant example of backward compatibility. It does not replace the ubiquitous ERC-721 or ERC-1155 token standards but instead acts as an extension that existing NFT contracts can adopt. A contract implementing ERC-2981 must expose a royaltyInfo function that, when called with a sale price, returns the recipient address and the royalty amount. This mechanism allows the royalty logic to be as simple as a fixed percentage or as complex as a custom on-chain calculation, providing flexibility for creators.
The proposal and adoption of ERC-2981 marked a significant shift in the NFT ecosystem's infrastructure, moving a critical piece of creator economics from trust-based off-chain agreements to transparent, on-chain execution. Its development was influenced by the practical needs of artists, developers, and marketplace operators, culminating in a standard that has become a foundational component for responsible secondary market trading.
Key Features
ERC-2981 is a standardized interface for NFTs to declare royalty payment information on-chain, enabling automatic and trustless payout splits to creators and other stakeholders.
On-Chain Royalty Standard
Unlike off-chain metadata, ERC-2981 stores royalty information directly in the smart contract. This provides a single, canonical source of truth that marketplaces and other platforms can query programmatically, ensuring creators are paid according to their declared terms on any compliant secondary sale.
RoyaltyInfo Function
The core of the standard is a single function: royaltyInfo(uint256 _tokenId, uint256 _salePrice). It takes the token ID and sale price as inputs and returns two outputs:
- recipient: The address to receive the royalty payment.
- royaltyAmount: The amount to be paid, calculated from the sale price. This function call is the mechanism for any marketplace to determine the correct payout.
Flexible Recipient & Split Logic
The standard allows for sophisticated royalty distribution models. The recipient can be:
- A single creator's wallet.
- A multi-signature wallet for a team.
- A payment splitter contract (like those from OpenZeppelin) to automatically divide funds among multiple parties.
- A DAO treasury or a dedicated royalties vault. This flexibility supports complex creator economies.
Backwards Compatibility
ERC-2981 is designed to be backwards compatible with existing NFT standards like ERC-721 and ERC-1155. An NFT collection can implement both its core standard (e.g., ERC-721) and ERC-2981 simultaneously. This allows older marketplaces to ignore the new interface while enabling modern platforms to support automatic royalty payments.
Marketplace Adoption Driver
The standard provides a clear, technical specification for marketplaces to integrate. By implementing support for royaltyInfo, a marketplace can:
- Automatically calculate and deduct royalties at the point of sale.
- Route payments directly to the designated recipient in the same transaction.
- Build user trust by guaranteeing creator compensation as coded in the contract.
Contrast with Off-Chain Metadata
Prior to ERC-2981, royalty terms were often specified in off-chain metadata (like a JSON file) or required custom marketplace partnerships. This approach was fragile and unenforceable, as terms could be changed or ignored. ERC-2981's on-chain method creates strong, verifiable guarantees that are executed by the protocol itself.
How ERC-2981 Works
A technical breakdown of the mechanism that enables on-chain royalty information for non-fungible tokens (NFTs) on the Ethereum blockchain.
ERC-2981 is an Ethereum Request for Comment (ERC) standard that defines a universal, on-chain method for non-fungible tokens (NFTs) to communicate royalty payment information to marketplaces and other applications. It works by implementing a single, mandatory function, royaltyInfo(uint256 tokenId, uint256 salePrice), which any smart contract can call. This function returns two critical pieces of data: the recipient address where royalties should be sent and the royalty amount to be paid, calculated as a function of the salePrice. This standardized query allows for seamless, permissionless integration across the ecosystem.
The standard's core innovation is its backward compatibility and flexibility. It can be implemented directly in an NFT's core contract (like an ERC-721 or ERC-1155) or deployed as a separate, standalone contract that multiple NFT collections can reference. The royaltyInfo function is intentionally simple, taking only the tokenId and salePrice as inputs. This allows for complex royalty logic—such as fixed amounts, sliding scales, or different recipients per token—to be encapsulated within the function's implementation while presenting a uniform interface to the outside world.
When a secondary sale occurs on a compliant marketplace, the process is automated: 1) The marketplace calls the NFT contract's royaltyInfo function with the sale price. 2) The contract returns the recipient and amount. 3) The marketplace executes the transfer, splitting the payment between the seller and the royalty recipient. This mechanism is enforceable on-chain when integrated by marketplaces, but it is not inherently coercive; it provides the data needed for voluntary compliance. The standard does not dictate royalty rates or governance, leaving those decisions to the contract deployer.
A key technical detail is the handling of the royalty amount. ERC-2981 expresses this amount in the same base units as the sale price (e.g., wei for ETH). For a 5% royalty on a 1 ETH sale, the function would return 50000000000000000 (5e16 wei). This precision avoids rounding errors. Furthermore, the standard supports ERC-165 interface detection, allowing applications to easily check if a contract supports ERC-2981 before attempting to call it, ensuring robust integration and preventing errors.
While ERC-2981 has become the dominant standard for on-chain royalties, its effectiveness depends on marketplace adoption. Major platforms like OpenSea, LooksRare, and others query this function to facilitate automatic royalty payments. However, it is a fee-specification standard, not a fee-enforcement standard; it tells a marketplace what to pay, but does not technically force it to do so. This has led to ongoing discussions and proposals for more coercive mechanisms, but ERC-2981 remains the foundational layer for universal royalty communication in the EVM ecosystem.
Code Example
A practical demonstration of implementing the ERC-2981 royalty standard in a Solidity smart contract, showing the core interface and logic.
The following is a minimal, non-production-ready example of an ERC-2981 compliant contract. It implements the required royaltyInfo function, which returns the royalty recipient address and the amount for a given token sale. This example uses a simple, fixed royalty percentage applied to all tokens minted by the contract, a common pattern for collections with a single beneficiary.
solidity// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; contract ExampleNFT is ERC721, IERC2981 { address private royaltyRecipient; uint96 private royaltyBasisPoints; // e.g., 500 for 5% constructor( string memory name_, string memory symbol_, address recipient_, uint96 basisPoints_ ) ERC721(name_, symbol_) { royaltyRecipient = recipient_; royaltyBasisPoints = basisPoints_; } // ERC-2981 Core Function function royaltyInfo( uint256 /* tokenId */, uint256 salePrice ) external view override returns (address receiver, uint256 royaltyAmount) { receiver = royaltyRecipient; royaltyAmount = (salePrice * royaltyBasisPoints) / 10000; } // Required override to signal interface support function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } }
This code illustrates several key concepts. First, it imports the official IERC2981 interface from OpenZeppelin Contracts, a widely-used library for secure smart contract development. The contract inherits from both ERC721 and IERC2981, making it a Non-Fungible Token (NFT) with built-in royalty functionality. The royaltyInfo function is the heart of the standard; it takes a salePrice as input and calculates the royalty by multiplying it with the royaltyBasisPoints (where 10,000 basis points equal 100%). The function returns the pre-configured royaltyRecipient address and the calculated royaltyAmount. Notably, the tokenId parameter is ignored in this simple implementation, as the royalty scheme is uniform across all tokens.
The supportsInterface function override is critical for interoperability. Marketplaces and other smart contracts use the ERC-165 standard to query which interfaces a contract supports. By returning true for the IERC2981 interface ID, this contract explicitly announces its compliance, allowing platforms to automatically detect and honor its royalties. Without this correct override, even a perfectly coded royaltyInfo function may be ignored by downstream systems. This example uses a global royalty scheme, but more advanced implementations could store royalty information per-token or per-token-series using a mapping, enabling complex scenarios like collaborative works where royalties are split between multiple creators.
Ecosystem Usage & Adoption
ERC-2981 is an Ethereum standard for NFT royalty payments. It defines a universal way for smart contracts, like marketplaces, to query and pay royalties to NFT creators on every secondary sale.
Core Mechanism: Royalty Info Function
The standard introduces a single, mandatory function: royaltyInfo(uint256 _tokenId, uint256 _salePrice). This function returns the royalty recipient address and the royalty amount to be paid, calculated as a percentage of the sale price. This provides a predictable, on-chain method for marketplaces to discover and execute payments.
- Standardized Query: Any marketplace can call this function to get payment details.
- Flexible Logic: Creators can implement custom logic (e.g., different rates per token, split payments).
Adoption by Major Marketplaces
Widespread marketplace integration is critical for the standard's effectiveness. Major platforms like OpenSea, LooksRare, and Blur have implemented support for ERC-2981, often using it alongside their own proprietary royalty systems. This ensures that NFTs compliant with the standard automatically have royalties paid on these platforms, creating a baseline level of creator protection across the ecosystem.
Implementation in NFT Collections
NFT projects implement ERC-2981 by adding the royaltyInfo function to their smart contracts. This is often done via inheritance from popular OpenZeppelin-style implementations. Key implementation patterns include:
- Fixed Royalty: A single percentage applied to all tokens.
- Token-Specific Royalty: Royalty rates stored in a mapping per token ID.
- Royalty Splits: Payments automatically divided between multiple addresses (e.g., creator, DAO treasury).
Interaction with Other Standards
ERC-2981 is designed to be complementary and non-breaking. It works alongside core NFT standards:
- ERC-721 & ERC-1155: The royalty info function is added to these token contracts.
- EIP-5516 (Royalty Registry): A proposed registry contract that can override or provide a fallback royalty setting for NFTs that don't implement ERC-2981 natively.
- Marketplace Policies: Platforms may use ERC-2981 data but apply their own fee and enforcement rules on top.
Limitations and Enforcement Challenges
While ERC-2981 provides a technical standard for declaring royalties, it does not enforce payment. Royalty enforcement depends on marketplace compliance. Optional royalty marketplaces and decentralized exchanges that bypass the standard can circumvent payments. This has led to discussions about stronger enforcement mechanisms, such as transfer hooks or on-chain allowlists, to make royalties non-optional at the protocol level.
Developer Tooling and Resources
A robust set of tools has emerged to help developers work with ERC-2981.
- OpenZeppelin Contracts: Provides a ready-to-use
ERC2981contract for inheritance. - Ethers.js & Web3.js: Libraries can interact with the
royaltyInfofunction. - Testing Suites: Foundry and Hardhat templates include tests for royalty functionality.
- Documentation: The official EIP-2981 specification is the primary technical reference.
Comparison: ERC-2981 vs. Other Royalty Methods
A technical comparison of on-chain royalty enforcement mechanisms, highlighting the trade-offs between standardization, decentralization, and enforcement guarantees.
| Feature / Mechanism | ERC-2981 (NFT Royalty Standard) | Marketplace-Level Enforcement | Creator-Enforced (e.g., Transfer Hooks) |
|---|---|---|---|
Standardization | |||
On-Chain Royalty Info | |||
Decentralized Enforcement | |||
Universal Marketplace Support | |||
Gas Cost Impact | Low | None | High |
Royalty Payment Guarantee | Weak (Opt-in) | Strong (Centralized) | Strong (Programmatic) |
Primary Sale Support | |||
Secondary Sale Support | |||
Implementation Complexity | Low | N/A (Off-chain) | High |
Security & Implementation Considerations
While ERC-2981 standardizes royalty information, its implementation introduces specific security and design considerations for developers and marketplace operators.
Royalty Payment Enforcement
ERC-2981 is a read-only standard; it does not enforce payments. Marketplaces must voluntarily query the royaltyInfo function and forward payments. This creates a trust model where enforcement relies on marketplace compliance, not the smart contract itself. Key considerations:
- Optional Integration: Marketplaces can choose to ignore the standard.
- Centralized Point of Failure: Royalty logic is often centralized in a single contract, making it a target for governance attacks or exploits.
- Implementation Verification: Users must trust that the marketplace's integration correctly reads and processes the royalty data.
Gas Optimization & Call Patterns
The royaltyInfo function should be optimized for gas efficiency as it may be called frequently during sales. Poor implementation can lead to high gas costs for integrating marketplaces.
- Static vs. Dynamic Logic: Complex, on-chain royalty calculations (e.g., based on traits or time) are gas-intensive. Off-chain indexing with on-chain verification is often preferable.
- Reentrancy Considerations: While the standard itself doesn't handle value transfer, the implementation must guard against reentrancy if it performs external calls or state changes within
royaltyInfo. - Caching Strategies: For predictable royalties, marketplaces may cache values, but must have a mechanism to detect and refresh on updates.
Upgradeability & Admin Risks
Many ERC-2981 implementations use upgradeable proxy patterns or have privileged admin functions to update royalty parameters. This introduces centralization and security risks.
- Admin Key Compromise: If a private key for a
DEFAULT_ADMIN_ROLEis lost or stolen, an attacker can redirect all royalty payments. - Proxy Implementation Bugs: Bugs in the upgrade logic or the proxy admin contract can lead to loss of funds or permanent locking of royalty settings.
- Transparency Requirement: Projects should clearly document the upgradeability mechanism and admin key management practices.
Interface Compliance & Fallbacks
Correctly implementing the interface is critical for interoperability. The function must return two values: (address receiver, uint256 royaltyAmount).
- Input Validation: The function should safely handle any
_salePriceinput, including zero, to prevent reverts that break marketplace integrations. - ERC-165 Support: The contract should explicitly declare support for
interfaceId 0x2a55205aviasupportsInterfaceto allow marketplaces to discover compatibility. - Legacy Fallbacks: Some projects implement dual support for ERC-2981 and older, non-standard methods (like
tokenCreator). This can lead to ambiguity if not managed correctly.
Royalty Splitting & Payment Forwards
The receiver address returned by royaltyInfo can be a simple EOA, a multi-signature wallet, or a complex payment splitter contract. Each has distinct implications.
- Splitter Contract Audits: Custom splitter contracts must be thoroughly audited for fair distribution and lack of withdrawal exploits.
- Gas Costs for Splitters: Splitters that iterate over many payees can make the royalty payment transaction expensive for the marketplace.
- Forwarder Contracts: Some implementations use forwarders that can redirect payments based on logic. This adds a layer of complexity and potential failure points.
Marketplace Integration Security
The security of the royalty ecosystem depends on secure marketplace integration. Marketplaces must protect against manipulation when calling royaltyInfo.
- Call Context Verification: Ensure the
royaltyInfocall is made in the correct context (e.g., for the correct token ID) to prevent spoofing. - Handling Malicious Implementations: Defensive coding is required to handle contracts that revert, consume all gas, or return malicious data in
royaltyInfo. - Front-running Royalty Changes: Marketplaces should consider the risk of an artist changing royalty parameters between the time a listing is created and a sale is executed.
Common Misconceptions
ERC-2981 is the standard for NFT Royalties, but its implementation and implications are often misunderstood. This section clarifies the most frequent points of confusion.
No, ERC-2981 does not enforce royalty payments on-chain. It is a read-only standard that provides a standardized way for a marketplace or other intermediary to query what the royalty amount and recipient should be for a given token sale. The standard defines a function, royaltyInfo(uint256 tokenId, uint256 salePrice), which returns an address and a royalty amount. It is entirely up to the marketplace or protocol executing the sale to respect this information and forward the payment. There is no mechanism within ERC-2981 itself to compel payment or block a transfer if royalties are not paid.
Frequently Asked Questions (FAQ)
Common developer questions about the ERC-2981 standard for NFT royalty payments, covering implementation, mechanics, and integration.
ERC-2981 is an Ethereum Request for Comments standard that defines a smart contract interface for reporting royalty payment information on Non-Fungible Token (NFT) secondary market sales. It works by adding a single, standardized function, royaltyInfo(uint256 tokenId, uint256 salePrice), which marketplaces and other platforms can call. This function returns the recipient address and the royalty amount (calculated from the sale price) that should be paid. This provides a universal, on-chain mechanism for royalty enforcement, allowing creators to receive a percentage of all subsequent sales automatically, without relying on off-chain agreements or platform-specific implementations.
Further Reading
Explore the technical foundations, related standards, and practical implementations surrounding the NFT royalty standard.
On-Chain vs. Off-Chain Enforcement
A critical distinction in NFT royalties:
- On-Chain Enforcement: Relies on smart contract logic to automatically route payments. ERC-2981 provides the information but does not enforce payment; enforcement requires integration by marketplaces.
- Off-Chain Enforcement: Relies on marketplace policy and centralized order-book logic to respect royalty data. This has led to a 'royalty war' where some marketplaces bypass fees. True enforcement often requires combining ERC-2981 with other mechanisms like transfer hooks.
Related Standards: ERC-2309 & ERC-4906
Standards that complement ERC-2981 in the creator economy:
- ERC-2309: The Consecutive Transfer standard, which optimizes gas for minting large NFT collections. Efficient minting is a prerequisite for deploying royalty-enabled contracts.
- ERC-4906: The Metadata Update Notification standard. It allows smart contracts to emit an event when metadata changes, which is crucial if royalty information for a token is updated off-chain and needs to be signaled.
Marketplace Integration
For royalties to be paid, secondary marketplaces must actively integrate the standard. The integration flow is:
- Before executing a sale, the marketplace calls
royaltyInfoon the NFT's contract. - It receives the recipient address and royalty amount.
- The marketplace logic must then split the sale price, sending the royalty amount to the designated recipient and the remainder to the seller. Major platforms like OpenSea, LooksRare, and Rarible support ERC-2981.
Limitations & Criticisms
While a landmark standard, ERC-2981 has recognized limitations:
- No Enforcement: It is an information standard, not an enforcement standard. Payments are voluntary for marketplaces.
- Static Recipients: The royalty recipient is often fixed at mint and difficult to update for an entire collection.
- Single Recipient: The standard supports only one recipient address per token, complicating splits between multiple creators or DAOs. These gaps have spurred proposals for more robust solutions.
Get In Touch
today.
Our experts will offer a free quote and a 30min call to discuss your project.