4

I hope you are all well. Do you know how NFT royalties work with solidity smart contracts?? Or do you know a tutorial about it?

Thank you

Take care

Pierre

4 Answers 4

3

The simplest way is to send extra fees to the artist when an NFT is traded. A quick search on GitHub would give you many examples. For example, here is a smart contract template to support NFTs whereby the artist gets a royalty from all future transactions of the NFT.

Disclaimer: I am not the author of the code mentioned above. I'm mentioning it here for educational purpose only.

0
2

Here's an ERC 1155 implementation of EIP 2981 royalties--implemented by some exchanges, but not yet universal.

Royalties aren't built into a contract's transfer functions, which would interfere with gifting and transfers between an owner's wallets (see explanation from the EIP 2981 abstract below).

...The royalty payment must be voluntary, as transfer mechanisms such as transferFrom() include NFT transfers between wallets, and executing them does not always imply a sale occurred. Marketplaces and individuals implement this standard by retrieving the royalty payment information with royaltyInfo(), which specifies how much to pay to which address for a given sale price...

Instead, exchanges call a royaltyInfo function with tokenID and sale price, which then returns recipient address and amount. Exchanges are then responsible for executing the royalty payment.

0
1

Just complementing navigaid's answer, some marketplaces are now supporting EIP-2981 (NFT Royalty Standard). The advantage of this approach is that you can implement optional royalty payments, that is, if the user is only transferring the NFT to another wallet (without selling it), he does not need to pay the royalty:

Optional royalty payments

It is impossible to know which NFT transfers are the result of sales, and which are merely wallets moving or consolidating their NFTs. Therefore, we cannot force every transfer function, such as transferFrom() in ERC-721, to involve a royalty payment as not every transfer is a sale that would require such payment. We believe the NFT marketplace ecosystem will voluntarily implement this royalty payment standard to provide ongoing funding for artists/creators. NFT buyers will assess the royalty payment as a factor when making NFT purchasing decisions.

(From EIP-2981 Rationale).

Moreover, EIP2981 will be supported in OpenZeppelin's ERC721 and ERC1155 implementation in their next release: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3012

2
  • Does opensea support this standard?
    – Shikyo
    Commented May 17, 2022 at 8:22
  • 1
    @Shikyo AFAIK not yet. Rarible did add support to it, though.
    – shamisen
    Commented May 17, 2022 at 18:37
1

There is a key point to avoid current confusion buzz in this topic: Royalties (or whatever fee) related to NFTs, is in the market side, not in the NFT side.

This means, that royalties fees must be implemented by the Marketplace's Smart Contract, not by the ERC-721, or ERC-1155, Smart Contract.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.