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
Three AI Stocks Beyond Nvidia
Why Can You Make So Much Money In Private Equity?
Bank Of America Financial Center Irvington Photos
Netr Aerial Viewer
Christian McCaffrey loses fumble to open Super Bowl LVIII
Farepay Login
Tyson Employee Paperless
Celebrity Extra
27 Places With The Absolute Best Pizza In NYC
Texas (TX) Powerball - Winning Numbers & Results
Helloid Worthington Login
Https://Gw.mybeacon.its.state.nc.us/App
Pwc Transparency Report
Valentina Gonzalez Leak
Local Dog Boarding Kennels Near Me
Flower Mound Clavicle Trauma
A rough Sunday for some of the NFL's best teams in 2023 led to the three biggest upsets: Analysis - NFL
Craigslist Farm And Garden Tallahassee Florida
Inter-Tech IM-2 Expander/SAMA IM01 Pro
Airrack hiring Associate Producer in Los Angeles, CA | LinkedIn
Lakewood Campground Golf Cart Rental
Parc Soleil Drowning
Marion City Wide Garage Sale 2023
Getmnapp
Jcp Meevo Com
Local Collector Buying Old Motorcycles Z1 KZ900 KZ 900 KZ1000 Kawasaki - wanted - by dealer - sale - craigslist
Publix Near 12401 International Drive
Smayperu
Manuel Pihakis Obituary
Flixtor Nu Not Working
Naya Padkar Newspaper Today
Facebook Marketplace Marrero La
Keeper Of The Lost Cities Series - Shannon Messenger
Ktbs Payroll Login
Nearest Ups Office To Me
What Does Code 898 Mean On Irs Transcript
Felix Mallard Lpsg
Sofia With An F Mugshot
VPN Free - Betternet Unlimited VPN Proxy - Chrome Web Store
Thotsbook Com
Woody Folsom Overflow Inventory
Hanco*ck County Ms Busted Newspaper
Craigslist Woodward
My Eschedule Greatpeople Me
FedEx Authorized ShipCenter - Edouard Pack And Ship at Cape Coral, FL - 2301 Del Prado Blvd Ste 690 33990
Stosh's Kolaches Photos
Freightliner Cascadia Clutch Replacement Cost
The Goshen News Obituary
Houston Primary Care Byron Ga
Noelleleyva Leaks
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.