Estimated time: 4 minutes read
What are royalties in an NFT contract?
Royalties in an NFT contract represent the fraction of the token’s sale price on a marketplace that should be received by the content creator.
The concept is very simple and develops one of the most common narratives in the Web3 world: the fair distribution of commercial benefits to content creators in a system without intermediaries.
It is a mechanism that should be applied exclusively when a commercial transaction occurs, excluding ownership transfers between addresses with no economic value.
How are royalties defined in an NFT contract?
Originally, the ERC-721 standard that defines the base contract for NFTs did not include the concept of royalties. It was the introduction of the ERC-2981 standard that laid the foundation for defining how much and who should receive value from NFT commercial transactions.
It is a very simple interface that only defines this read method:
/// @notice Called with the sale price to determine how much royalty
// is owed and to whom.
/// @param _tokenId - the NFT asset queried for royalty information
/// @param _salePrice - the sale price of the NFT asset specified by _tokenId
/// @return receiver - address of who should be sent the royalty payment
/// @return royaltyAmount - the royalty payment amount for _salePrice
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (
address receiver,
uint256 royaltyAmount
);
In this way, when a specific token is sold through a marketplace, it will be possible to know what fraction of the sale price (royaltyAmount) and to which address (receiver) should be transferred to respect the royalties.
Usually, the following Solidity structure is defined to store the information about royalties:
struct RoyaltyInfo {
address recipient;
uint16 bps;
}
It can be observed that the percentage is calculated in the form of BPS or basis points (100 BPS = 1%). This is a standard unit to represent percentages precisely without using decimals, since the EVM does not support floating-point numbers. The calculation of the royalties would be done as follows:
royaltyAmount = (_salePrice * bps) / 10_000;
On the other hand, the standard defines a single beneficiary address for the royalties. For more complex schemes involving more than one receiver, it is possible to develop a custom contract or use some of the existing implementations. Among them are:
- OpenZeppelin’s PaymentSplitter. Currently, it has been excluded from version 5.0 of their contracts for this reason.
- The Split contract.
- The fee splitter contract from Immutable.
What other alternatives are there?
The ERC-2981 standard is not the only way to define royalties in NFT contracts.
On one hand, the marketplaces themselves have defined their own standards for managing royalties. Among them, we can mention:
On the other hand, contracts that do not implement the ERC-2981 standard would be excluded from royalty management.
With the goal of unifying royalty management across different marketplaces and allowing older contracts to manage them, the Royalty Registry has emerged. It consists of two components:
- The royalty registry configuration: this is a contract that allows the collection owner to define the royalty information for any NFT contract. It is primarily designed for contracts that do not establish royalties in any way.
- The royalty lookup engine: a contract that provides an easy way to query the royalties of an NFT contract. If a configuration has been set in the Royalty Registry, that information will be used. Otherwise, it will try to obtain it from specifications like EIP-2981 or from a compatible marketplace.
An example of a query made to the registry would be the following:
Conclusion: Distributing the benefits to creators
Managing royalties without intermediaries is one of the paradigms in the Web3 narrative.
While the concept is very interesting and appealing, its real-world implementation is far from ideal.
The first challenges lie in defining how much and who should receive the royalties. Initiatives like the ERC-2981 standard or the Royalty Registry have helped unify and extend mechanisms compared to the private initiatives of different marketplaces.
However, the most important point remains unresolved: how to ensure that the defined royalties are actually respected when a commercial transaction occurs in the NFT contract? I will address this in my next article.
Have you ever had to enforce the distribution of royalties in an NFT contract or in any other situation? What solutions have you found within Web3 to achieve this? I invite you to share your own experiences.
If you need to enforce royalties in your Web3 project, I can help. Get in touch, and we’ll see which option is best suited for your case. Thank you very much!