How do NFT royalty fees work?

I have been trying to understand how royalty fees work on NFT’s. I understand that one has to use smart contracts to do that and I get the basics of smart-contracts, but couldn’t you send a NFT without the contract and thus avoid the fees ?

Here are two relevant discussions on this forum:

The short answer is that if the NFT is held in someone’s wallet, then they can transfer it without a royalty. If it is or is held in a smart contract, then the contract can enforce royalties. The third situation is that not passing the token through the smart contract as it is transferred would conceptually invalidate the token so that it would be rejected by the smart contract in the future.

1 Like

Awesome, thank you ! Ok so by enforcing royalties you mean the smart contract is the nft holder and the user is transferring the control of the smart contract, like you pointed out in your recent answer ?
I don’t really get the implementation of the rejection idea if I’m honest.

Yes, the smart contract could hold the NFT and keep a record of who owns the NFT. To transfer the NFT to someone else, the owner would submit a transaction to the smart contract to record the new owner, so later only the new owner could transfer ownership. It would work sort of like the title transfer for vehicle ownership: the title paperwork is the record of who owns the vehicle, and changing that record usually involves paying a fee to the licensing authority.

The “rejection” approach would only work for tokens that have utility. Let’s say that the NFT embodies voting rights. If someone transfers it without paying royalties (mediated or collected by a smart contract), then the NFT would be invalid for future voting. Here the vehicle-ownership analogy would be someone who sold a vehicle to someone else, but they didn’t pay the re-registration fee required by the licensing authority: they wouldn’t be legally entitled to drive the vehicle on public roads.

2 Likes

Got it ! Thanks

1 Like

Why do I actually need a native token inside the contract ? Isn’t the blockchain just like a database keeping the state of the contract. Like A sends money to B which is a transaction of ada + it saves a new state of the contract → The variable “balance” will declare a new “owner” (address A). The only thing I have read is, this would be non native and cardano only supports native, also to my understanding smart contracts on cardano don’t fetch the state from the blockchain but are rather “static”. Is this why you need the native token, to get/store state ?
(Sorry for being a noob and probably totally wrong, have started learning about smart contracts two days ago and the plutus docs aren’t the best to be honest. Tried to compensate basic understanding with eth concepts.)

Yes, the blockchain is like a database and would record the movement of the token from A to B, etc. A smart contract would only be needed to enforce the payment of royalties and the contract could only do that if it were in actual possession of the token (as part of a UTxO that it holds) or if the token’s usability in smart contracts required previous payment of the royalty. A smart contract only validates transactions that spend the UTxOs that it has received: it cannot affect transactions (such as wallet-to-wallet token transfers) to which it is not a direct party.

The on-chain portion of a smart contract only sees the data that was attached to the UTxOs, information about those UTxOs, and the information (including “redeemer” data) about the outputs of the transaction. This is actually sufficient for a smart contract to maintain state information or to act as a “state machine”. The off-chain portion of the smart contract might have to hold and manage quite a bit of state and perform complex logic in order to create valid transactions for the on-chain portion of the smart contract to validate.

Sometimes NFTs are used to identify which UTxO has the current state data for the smart contract. Anyone can send transactions with data to a smart contract, but the contract shouldn’t trust that data unless it has a way to determine that the data truly holds state. The unique NFT for the contract is basically a marker to identify which UTxO has the correct data.

Even though the Plutus Book is outdated in terms of the current Plutus API, I think that it still provides a good conceptual overview of how Plutus contracts work. The Plutus Pioneer lectures and github repository provide up-to-date information but don’t provide as much context as the book.

1 Like