ERC-4910 · Final · ERC · 2022-03-14
ERC-4910: Royalty Bearing NFTs
An ERC-721 extension that enforces royalties on-chain: the NFT contract owns every token, takes all sale payments itself and splits them through a tree of royalty accounts that can span originals and their prints.
What problem does it solve?
Royalty standards such as ERC-2981 only report how much a creator should receive; marketplaces can ignore it, and sellers can trade privately to avoid paying. Royalties also get complicated when works are derived from other works: a print of a painting, a song sampled in another song, distribution through chains of affiliates. Each level may owe something to the one above.
ERC-4910 tries to make royalties unavoidable and hierarchical by moving the whole sale, payment and royalty distribution process into the NFT contract itself.
How it works
- The contract owns every NFT. At mint,
owneris set to the NFT contract and the real holder is the approved address. This keeps it ERC-721 compatible while letting the contract control every transfer. - Royalty Accounts (RAs). Each token gets an RA made of sub-accounts with percentage splits that must always sum to 100 %. A sub-account can be an individual or another RA, which forms a royalty tree linking a child (print) to its parent. Distribution walks the tree one layer at a time up to the root.
- Buyers pay the contract, never the seller.
- Direct sale: the seller calls
listNFT(tokenIds, price, tokenType). The buyer approves an ERC-20 and callsexecutePayment(...)withtrxnType = 0, or sends ETH to a payablefallbackwith the encoded data. - Exchange-mediated sale (
trxnType = 1): the payment is registered first, then the exchange callssafeTransferFromwith trade data in_data.
- Direct sale: the seller calls
- Only one transfer path.
transferFromandsafeTransferFromwithout data MUST be disabled; the remainingsafeTransferFrom(from, to, tokenId, data)validates the payment, credits every sub-account, and only then transfers. - Pull payouts. Balances accumulate in sub-accounts and are withdrawn with
royaltyPayOut(tokenId, subaccount, payoutAccount, amount)(non-reentrant).reversePaymentrefunds a buyer if a sale fails or is abandoned. - Other functions:
mint(to, NFTToken[], tokenType),getRoyaltyAccount,updateRoyaltyAccount(strict rules: a holder can only give away part of their own split),deleteRoyaltyAccount(only when the token and all relatives are burned and balances are zero),removeNFTListing.
Sample code
Buying a listed NFT with an ERC-20 (ethers v6). The function signatures follow the spec; check your implementation's exact ABI:
import { Contract, parseUnits } from "ethers";
const nft = new Contract(nftAddr, [
"function executePayment(address receiver, address seller, uint256[] tokenIds, uint256 payment, string tokenType, int256 trxnType) returns (bool)",
], buyer);
const dai = new Contract(daiAddr, ["function approve(address,uint256) returns (bool)"], buyer);
const price = parseUnits("100", 18);
await (await dai.approve(nftAddr, price)).wait(); // 1. allow the NFT contract to pull
await (await nft.executePayment(
await buyer.getAddress(), seller, [42n], price, "DAI", 0n // 2. direct sale
)).wait();
Things to know
- Status: Final, but it is a heavy, opinionated design. Because the contract owns all tokens and blocks plain transfers, these NFTs do not behave like normal ERC-721s on most marketplaces and wallets.
- Royalties still cannot stop off-chain deals such as selling a private key, or trading a smart-contract wallet that holds the NFT. The spec suggests blocking contract holders unless whitelisted.
- Deep or wide royalty trees can exceed gas limits. Creators should cap generations, sub-accounts, prints per print and listing size.
- The function signatures in the spec contain typos (e.g.
uint 256[]); treat the reference implementation as the source of truth and get an audit.