Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (2024)

Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (1)

ERC721-C is a new token standard designed for enforceable on-chain royalties. Unlike ERC-721 and ERC1155, ERC721-C makes royalties programmable and allows creators to prevent zero-fee exchanges from listing their works.

Creators can use ERC721-C (and ERC1155-C) to set on-chain royalty rules. This standard enables them to create permissioned smart contracts that control royalty transfers.

With ERC721-C, creators can determine where their NFTs are sold and filter interactions to only approved contracts and applications. This prevents traders from avoiding royalties on zero-fee platforms, as collections created with ERC721-C can opt out of such marketplaces.

How ERC721-C Works

  1. Developers inherit the ERC721-C contract like they would with OpenZeppelin.
  2. They customize or add functionality as needed.
  3. After deploying their ERC721-C collection, developers use the setToDefaultSecurityPolicy() function to point to Limit Break’s Creator Token Transfer Validator contract, applying the default security policy.
  4. The collection then enforces this default transfer policy for all token transfers. Developers can change the policy and/or whitelist anytime for added flexibility.

Programmable Royalties

ERC721-C embeds royalty logic directly into the Ethereum smart contract code, giving creators control over royalties and potentially reducing marketplace dominance.

ERC721-C allows NFT creators to explore different royalty models:

  • Shared Royalties: Royalties can be split between creators and holders.
  • Minter-Only Royalties: Only the minter, not the creator, earns royalties.
  • Contingent Royalties: Royalties apply based on specific criteria, such as sales exceeding the mint price.
  • Transferable Royalties: Creators can grant holders a separate NFT entitling them to royalty income. For instance, minting “NFT X” might include receiving “NFT Y,”

ERC721 Example with Integrated Programmable Royalties

Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (4)

This example illustrates the integration of programmable royalties into an ERC721 collection, demonstrating the flexibility and ease of use offered by mix-ins. Specifically, we focus on an ERC721-C variant combined with mutable minter royalties, providing an innovative approach to NFT creation and royalty management.

Royalty Management Mix-in: A specialized mix-in enabling minters to retain perpetual royalty rights for the NFTs they create. Critically, this feature allows the original minter to modify the royalty fee for each token ID they have minted, offering unprecedented control and flexibility in the digital art marketplace.

Detailed Breakdown

Imported Contracts:

  • OwnableBasic.sol and OwnableInitializable.sol: Essential contracts that furnish rudimentary ownership control mechanisms, ensuring robust governance over the NFT collection.
  • ERC721C.sol: A refined version of the standard ERC721 contract, tailored for NFT creation with added functionalities, particularly in security and royalties.
  • MutableMinterRoyalties.sol: A sophisticated contract managing mutable minter royalties, empowering creators with the ability to adjust royalty configurations dynamically.

Contract Constructor:

  • Parameters: Receives three critical inputs: defaultRoyaltyFeeNumerator_ (determining initial royalty fee), name_ (the name of the NFT collection), and symbol_ (the collection's symbol).
  • Initialization: Sets up the ERC721 foundation with the specified name and symbol and configures mutable minter royalties using the defaultRoyaltyFeeNumerator.

Interface Support Function:

  • supportsInterface: An overhauled function to verify support for various interfaces within the contract. This method cross-references functionalities inherited from both ERC721C and MutableMinterRoyaltiesBase to ensure comprehensive compatibility.

Token Minting Functions:

  • mint: Facilitates the creation of a new token, assigning it a unique tokenId and allocating it to a specified address.
  • safeMint: Functions akin to mint but incorporates additional safeguards to verify the recipient's ability to receive NFTs, thereby mitigating potential transfer errors.

This comprehensive approach effectively combines the robustness of ERC721 standards with innovative royalty management, offering creators enhanced control and flexibility in the NFT domain.

To help you get started swiftly, we’ve prepared everything at BuildBear Labs ERC721-C.

  • Cloning or Forking ERC721C:
  • Use the following command to clone the ERC721C repository:
git clone <https://github.com/BuildBearLabs/ERC721-C.git>
  • Installing Dependencies:
  • Change to the ERC721-C directory and install the necessary dependencies:
cd ERC721-C 
npm install
  • Creating Your Private Testnet Fork:
  • You can create a private testnet fork from any Testnet or Mainnet, as there’s no need for Mainnet state in this instance:
npm run createTestnet
Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (5)
  • After the Testnet is operational, its RPC, Explorer, and Faucet details will be updated in the testnet.json file.
  • Deploying the Contract:
  • Once the above steps are completed, execute the following script to deploy your contract.
Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (6)
npx hardhat run .\\scripts\\deploy-ERC721C.js
  • Click on the contract link provided in the terminal you will be redirected to the Contract page on the buildbear explorer as shown below
Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (7)

Now, we can directly interact with the contract functions through the explorer. Here’s how to proceed:

Accessing the Faucet:

  • First, locate the faucet link within the testnet.json file.
  • Open the faucet link and utilize the “Add to MetaMask” button to connect your sandbox network to your wallet. This step is essential for minting native tokens, which are necessary to cover gas fees. The process is illustrated below:
Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (8)

Using Contract Write Functions:

  • Navigate to the ‘Contract Write Function’ section of the explorer.
  • Connect your wallet, then enter your wallet address and the tokenId.
  • Proceed to click on the ‘write’ button and confirm the transaction on the explorer. This step is depicted in the image below:
Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (9)

Reading Contract Information:

  • Move to the ‘Read Contract’ section to verify the owner of the NFT.
  • Additionally, you can check the royalty fee. For instance, if the NFT’s sale price is 100 ETH, you would receive 10 ETH, which represents 10% of the sale price, as shown in the following example:
Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (10)

Now, let’s proceed to run the test scripts. Conducting tests is essential to verify the functionality and reliability of your contract before deploying it to a live network.

Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (11)

To initiate the testing process, use the following command:

npx hardhat test

Executing this command will run the test scripts specified in the Erc721C-Testnet.js file. This step is key to ensuring that your contract operates as expected and is free from critical issues prior to its deployment on the blockchain.

Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (12)

Conclusion

ERC721-C offers an effective solution to Web3 royalty challenges. It enables artists to ensure they receive a fixed percentage of sales when their work is resold, by embedding revenue contracts within the NFT’s smart contract.

BuildBearLabs/ERC721-C (github.com)

BuildBear is a platform tailored for DApp development and testing. Developers gain the freedom to construct a personalized Private Testnet sandbox across a variety of blockchain networks. The liberty to mint unlimited Native and ERC20 tokens, coupled with rapid transaction times on BuildBear (under 3 seconds!), enhances the DApp development lifecycle manifold. The platform comes equipped with tools designed for real-time testing and debugging, ensuring developers can keep tabs on intricate blockchain transactions with unparalleled ease.

Connect with us on Twitter | LinkedIn | Telegram | GitHub

Author: chandan

Implementing NFT Royalties: A Practical Tutorial on ERC721-C for Artists and Developers (2024)
Top Articles
What is System Software? – Definition from WhatIs.Com
Fund Your Account | Interactive Brokers U.K. Limited
Top 11 Best Bloxburg House Ideas in Roblox - NeuralGamer
Ofw Pinoy Channel Su
How To Be A Reseller: Heather Hooks Is Hooked On Pickin’ - Seeking Connection: Life Is Like A Crossword Puzzle
Z-Track Injection | Definition and Patient Education
Obituary (Binghamton Press & Sun-Bulletin): Tully Area Historical Society
Crime Scene Photos West Memphis Three
Ncaaf Reference
Baseball-Reference Com
Alaska: Lockruf der Wildnis
Xxn Abbreviation List 2023
Gdlauncher Downloading Game Files Loop
Razor Edge Gotti Pitbull Price
Plan Z - Nazi Shipbuilding Plans
Buy Swap Sell Dirt Late Model
Beryl forecast to become an 'extremely dangerous' Category 4 hurricane
Dwc Qme Database
Rochester Ny Missed Connections
Craigslist Battle Ground Washington
Hdmovie2 Sbs
Aliciabibs
Mythical Escapee Of Crete
Albert Einstein Sdn 2023
Free T33N Leaks
1636 Pokemon Fire Red U Squirrels Download
Grave Digger Wynncraft
Cosas Aesthetic Para Decorar Tu Cuarto Para Imprimir
Duke University Transcript Request
Helpers Needed At Once Bug Fables
Tokioof
FREE Houses! All You Have to Do Is Move Them. - CIRCA Old Houses
County Cricket Championship, day one - scores, radio commentary & live text
Ridge Culver Wegmans Pharmacy
Autopsy, Grave Rating, and Corpse Guide in Graveyard Keeper
Craigslist Albany Ny Garage Sales
Pensacola 311 Citizen Support | City of Pensacola, Florida Official Website
Solemn Behavior Antonym
R&J Travel And Tours Calendar
Zero Sievert Coop
The Syracuse Journal-Democrat from Syracuse, Nebraska
Instafeet Login
Myfxbook Historical Data
Wal-Mart 2516 Directory
Oxford House Peoria Il
2700 Yen To Usd
The best bagels in NYC, according to a New Yorker
'The Night Agent' Star Luciane Buchanan's Dating Life Is a Mystery
Ucla Basketball Bruinzone
Frontier Internet Outage Davenport Fl
Hampton In And Suites Near Me
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 5881

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.