Where are your Smart-Contract enforced royalties now?

Over the past 2 years, while working with clients who needed NFT collections, a subject that came up very often was how to enforce royalties distribution on-chain. There was this myth going around that described NFTs as a way to give a lifetime guarantee to artist that they will receive a piece of all resale proceedings. For a long time (and it is probably still the case), people believed that this rule was encoded into the Smart Contracts that constituted these NFTs, that it was enforced by the whole Blockchain protocol and that no one could circumvent it.

Don’t feel too bad if you believed that too. This was not science fiction at all. It was always possible to enforce the redistribution of royalties via smart contracts. And in a sense, when you purchased an NFT, the whole transaction went through the Marketplace’s own Smart Contract and those smart contracts, as middle-men between the buyer and the seller, did redistribute royalties to the creator according to rules living inside the marketplace’s internal database… until they didn’t.

Most of the project I was invited to work on ended up ditching me in favour of some developer who knew how to enforce royalties. Because what I would tell my prospects then when they mentioned enforced royalties, was that, yeah, it’s perfectly possible to enforce whatever rule they wanted. But in that case, forget about trading on OpenSea and other marketplaces. If you want the smart contract to be able to control the ETH flow between buyers and sellers, then the ETH needs to go through your smart contract at some point. What needed to be built was a…

Self-marketed NFT

If an NFT smart contract manages the sales of the items in its own collection, there is no intermediary between the artist and the collector apart from the code. Secondary sales only need to involve the buyer, the seller and the artist (via their smart contract). After all, the technology was already very much advertised as a way to cut the middle-man, wasn’t it?

As you might expect, when facing the decision between enforcing royalties or being traded on public marketplaces, every client I had decided to be traded on public marketplaces. All but one.

At the end of February 2022, I saw the following request from a very special client:

Our client's project's aim is to fulfill the promise of 1980s conceptual contract-based art on-chain in an artwork!

They are looking for a Solidity developer with experience with NFTs contracts to create a smart contract that enforces the following terms on-chain:

  1. Royalty

  2. Provenance

  3. Exhibition requests

Provenance will require the contract creator's approval to transfer the assets and will store these exchanges over time.

Exhibition requests will require on-chain approval from the contract creator with details about the installation and qualitative parameters.

This unusual request got me super excited and I immediately accepted it.

https://opensea.io/assets/ethereum/0xcc8e138d4997107f57ef6fe4bbbcc87285ecd8a1/1

Here, the artist, Sarah Meyohas, decided to impose very specific rules when it comes to transferring, selling and distributing royalties:

  • A Holder may transfer an NFT for free if the artist approves the new holder

  • A Holder may sell the NFT if the artist approves the new holder and the price

  • For each re-sale, if a profit was made, 15% of that profit is to be perceived by the artist. If no profit was made, no royalties were perceived.

These rules were encoded inside the smart contract and they make this NFT impossible to trade on regular marketplaces unless the artist approves a specific buyer for a specific NFT. To understand why those trades would fail on a typical marketplace, you need to understand how…

NFT trades typically work on a marketplace.

If you just want to know how but you don’t care why, you can skip the next chapter, otherwise, let me go over…

A bit of history

The NFT standard was built as the non-fungible version of the Token Standard (EIP-20).

The Token Standard was published soon (~4 months) after the first block was mined on Ethereum Mainnet and specifies a store of interchangeable things (tokens) that can be minted, held by a wallet, spent (transferred), or burnt. As something that can be spent, but wasn’t built to trigger any particular behaviour on the receiver’s end (unlike native currency transfers), the use-case quickly arose where a wallet would allow another wallet to spend a certain amount from their balance. This was particularly useful when other contracts would accept payments in tokens: since they had no way of getting notified that a payment had arrived, the way you would pay would typically pay a contract in tokens was by giving it an allowance for the desired amount, then the contract would transfer the amount from your address to its own (or a designated recipient).

One very annoying thing with ERC-20 tokens was that you could accidentally transfer them to contracts that are not equipped to do anything with them, effectively locking them there forever. The Standard Interface Detection (EIP-165) came 2 years later to help prevent that from happening. It proposes a method supportsInterface() that contracts would implement to inform their user of wether they support a feature or not. For example, by checking if a contract implements ERC20Receiver you’ll know that it’s safe to send it tokens and that you should call the onERC20Received method afterwards.

In January 2018, a proposal was submitted to have a standard around the idea of unique tokens that can be transferred on Ethereum. Not countable tokens (like a currency) but tokens that represented a specific object. Each object would have a unique identifier and a unique owner. This was the 721st improvement proposal and shall be remembered as the iconic ERC-721.

By the time that proposal was approved, the idea that people may interact with the blockchain behind a smart contract as an intermediary was already generalized among the builders. Gnosis Safes had already raised $12.5M in an ICO and were about to start powering smart contract-based wallets that could hold tokens as well. Therefore, and almost like every smart contract standard that came after January 2018, NFTs extend EIP-165, notably to tell the world that they implement all the methods required to transfer, check the ownership and give allowances. That they are a valid ERC-721 Token. Marketplaces would be able to call supportsInterface on any contract, and when they see a response come back as true, they will know that they will be able to execute…

A typical NFT Trade

In its most standard implementation, an NFT can be transferred from a wallet to another in one of the following scenarios:

  • Transfer by the owner: It is sent directly from the owner of the NFT to any other address. (NB: If the recipient address is a smart contract, it should be a safeTransfer to make sure the transaction fails if the recipient contract is not a valid ERC721Receiver)

  • Transfer by an allowed third-party: with the idea to preserve the behaviour of allowances on ERC-20 tokens (as we’ve seen in techy history, first paragraph), it’s possible for an NFT holder to allow one specific address to transfer one specific token, once. Allowing an address to transfer a specific NFT for you is done by calling the method approve(). In theory, you would imagine that’s how you would list an NFT for sale, in practice I’ve never seen this happen ever. The feature exists and the function is actually necessary in order to be a valid ERC721 token.

  • Transfer by an operator: an NFT holder can designate one or many operators. These are addresses that will be able to transfer ALL of the holder’s NFTs from a specific collection however they please.

When you list an NFT on a marketplace, while the marketplace could totally ask you for a regular approval for that single NFT you want to sell, what it usually does is ask you for a global approval on the whole collection. That way, next time you want to sell another NFT from the same collection, you won’t need to make a gas-consuming transaction, you’ll be able to list it and the marketplace will be able to transfer it just like that.

So the flow for an NFT trade when selling for the first time is the following

  1. The seller grants the power to move all of their NFTs from that collection to the marketplace’s smart contract.

  2. The marketplace marks the NFT as listed for sale (off-chain)

  3. The buyer clicks “Buy now” and executes a transaction between their wallet and the marketplace’s smart contract. They send the required amount to cover the sale price

  4. The marketplace’s smart contract takes from the sent amount their platform fees, if they’re nice, they pay some royalties to the indicated address, they transfer the remaining ETH to the seller’s address and the NFT from the seller’s wallet to the buyer’s (using their power as an operator).

Now in this whole process, the parts that are performed by the marketplace’s smart contract are entirely at the marketplace’s discretion. Since the NFT Royalty Standard came out (EIP-2981), marketplaces have been able to ask the NFT contract via the method royaltyInfos() “Hey, I’m dealing with a sale for token ID #123 for X amount of ETH. How much royalties should I pay, and to whom?” If written properly, the NFT smart contract will reply something like “send X ETH to address 0xABC”, then we have to trust the marketplace to the the right thing.

post image

But wasn’t the whole point of blockchain technology to be able to do stuff without having to trust anyone? What happened to shutting down the middlemen, to “Do not trust, verify” and to “Code is law”?

Another issue with this way of functioning is that it trivializes the act of giving global approvals. People are told it’s okay to give general approval to your NFTs, that’s just how things work. Then one day some hackers sets up a legit looking website that allows you to list your NFT on multiple marketplaces at the same time (convenient, eh?). You connect your wallet, call the setApprovalForAll() method when you are prompted to, and just like that, your most valuable NFTs start jumping one by one to the attacker’s wallet.

Then because you don’t want to admit that you made a mistake, you will further spread the urban myths that you can get your wallet drained simply by visiting a website or by connecting your wallet. So let me blow your ming: No, that’s now how wallets work. But this topic deserves its own article.

“But hey, if I understand what you’re saying…

NFT Marketplaces still pay royalties”

Well… they did at first. Then if you followed the news, in the summer of 2022, a new marketplace was getting very popular with their slicker UX: Blur.io. Blur’s popularity among collectors was also a bit due to the fact that people could buy their NFTs there for a cheaper price. Not that their smart contracts had some special optimization that reduced gas costs, no. They simply made it optional to pay royalties. OpenSea was still well determined to keep distributing royalties to creators but they had to fight back. In order to enforce (funny how that words gets thrown around so easily) creator fees, all NFTs deployed after November 2022 had to include an Operator Filter. To put is simply, if your NFT could be traded on Blur, then OpenSea would not distribute creator fees on them. It’s actually a bit more complex than that but the details aren’t too relevant to this story.

post image

In the following months after that update, the next NFT projects owners who invited me to work with them were now a bit more aware of the situation. So they specifically asked to do the extra work to enforce royalties. What they meant was “do this new thing that OpenSea requires to make sure they send us royalties for secondary sales”. My position on the spectrum makes me very sensitive to imprecise language so I just had to explain the situation. There’s no enforcing royalties on OpenSea. If you want to use the word “enforce”, it means you make sure something happens in a special way. I don’t work at OpenSea so I can’t enforce that they do the right thing.

Anyway, most of them would then just go for the other developer who said “yes, I know how to enforce royalties on OpenSea”. Sad for me but at least I didn’t compromise with my principles.

Now we are August 18th 2023 and OpenSea just announced yet another update to the way they handle royalties. If you receive their newsletter, you probably saw it too:

Starting August 31, 2023, we’ll:

  • Sunset the OpenSea Operator Filter

  • Move to optional creator fees on all secondary sales for new collections

  • Improve visibility of creator fee settings and listings on buyer & seller side

The news saddens me a bit but I can’t help but feel a bit victorious too. To all the prospects who rejected my offer because I was honest:

post image

If you are just finding out in shock how NFT marketplaces work in the decentralized age, then you are probably thinking, just like me and like a few good people, that marketplaces have way…

Too much power

As previously mentioned. Blockchain technology exists mainly to enable a world where things work without trust and without middlemen. A world where NFTs can be traded without centralized marketplaces is possible. The technology allows it and there is at least one occurence of it happening (see Dawn Chorus mentioned at the start of this article). This is the promise made by Web3. This is the future Internet I signed up for when I first jumped into blockchain technology.

The “few good people” I mentioned earlier who (at least partially) share this opinion have actually been working on the “No Intermediary NFT Trading Protocol” (EIP-6105). If there ever was an answer to the question in the title: “Where are your Smart-Contract enforced royalties now?”, this would be the closest answer. NFT creators will be able to

To make a little analogy with the two previous iterations of the web, this is like allowing artists to switch from a managed Geocities web page to a self-hosted Wordpress installation with the ability to install their own plugins.