ERC721 - OpenZeppelin Docs (2024)

We’ll use ERC721 to track items in our game, which will each have their own unique attributes. Whenever one is to be awarded to a player, it will be minted and sent to them. Players are free to keep their token or trade it with other people as they see fit, as they would any other asset on the blockchain! Please note any account can call awardItem to mint items. To restrict what accounts can mint items we can add Access Control.

Here’s what a contract for tokenized items might look like:

// contracts/GameItem.sol// SPDX-License-Identifier: MITpragma solidity ^0.6.0;import "@openzeppelin/contracts/token/ERC721/ERC721.sol";import "@openzeppelin/contracts/utils/Counters.sol";contract GameItem is ERC721 { using Counters for Counters.Counter; Counters.Counter private _tokenIds; constructor() public ERC721("GameItem", "ITM") {} function awardItem(address player, string memory tokenURI) public returns (uint256) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(player, newItemId); _setTokenURI(newItemId, tokenURI); return newItemId; }}

The ERC721 contract includes all standard extensions (IERC721Metadata and IERC721Enumerable). That’s where the _setTokenURI method comes from: we use it to store an item’s metadata.

Also note that, unlike ERC20, ERC721 lacks a decimals field, since each token is distinct and cannot be partitioned.

New items can be created:

> gameItem.awardItem(playerAddress, "https://game.example/item-id-8u5h2m.json")Transaction successful. Transaction hash: 0x...Events emitted: - Transfer(0x0000000000000000000000000000000000000000, playerAddress, 7)

And the owner and metadata of each item queried:

> gameItem.ownerOf(7)playerAddress> gameItem.tokenURI(7)"https://game.example/item-id-8u5h2m.json"

This tokenURI should resolve to a JSON document that might look something like:

{ "name": "Thor's hammer", "description": "Mjölnir, the legendary hammer of the Norse god of thunder.", "image": "https://game.example/item-id-8u5h2m.png", "strength": 20}

For more information about the tokenURI metadata JSON Schema, check out the ERC721 specification.

you’ll notice that the item’s information is included in the metadata, but that information isn’t on-chain! So a game developer could change the underlying metadata, changing the rules of the game! If you’d like to put all item information on-chain, you can extend ERC721 to do so (though it will be rather costly). You could also leverage IPFS to store the tokenURI information, but these techniques are out of the scope of this overview guide.
ERC721 - OpenZeppelin Docs (2024)

FAQs

What is the disadvantage of ERC721? ›

Inefficient transfer capability

This is very bad as in most cases, the majority of the gas cost comes from the transaction itself, meaning transferring tokens one by one will exponentially increase the cost and burden on the network.

What is ERC721 used for in OpenZeppelin? ›

We'll use ERC721 to track items in our game, which will each have their own unique attributes. Whenever one is to be awarded to a player, it will be minted and sent to them. Players are free to keep their token or trade it with other people as they see fit, as they would any other asset on the blockchain!

Is ERC721 or erc1155 better? ›

In comparison to the ERC-721 standard, which only allows for the creation of nonfungible tokens, the ERC-1155 standard offers a solution that is more flexible and less expensive for the production of both semi-fungible tokens and non-fungible tokens.

What is the difference between ERC721 and erc720? ›

The main distinction between ERC20 and ERC721 tokens is that the former is a fungible token, but the latter is a non -fungible token. ERC20 tokens are interchangeable and represent a single entity, whereas ERC721 tokens represent a collection of assets.

Is NFT trading risky? ›

Secure Ownership

First, NFT ownership is extremely secure. Because NFTs are created on the blockchain, each NFT has an individual, unchangeable ID and each purchase is permanently recorded.

What is the negative side of NFT? ›

NFTs aren't environmentally friendly. Most NFTs trade on the Ethereum network. This means that each transaction uses a mining process to confirm the trade and transaction. The energy used in mining concerns many who feel that it can add to carbon emissions if non-clean energy sources are used.

Does OpenSea use ERC721? ›

OpenSea supports metadata that is structured according to the official ERC721 metadata standard or the Enjin Metadata suggestions.

Can you burn ERC721? ›

Who Can Burn an ERC-721 Token? There are three actors who can burn tokens in our contract: **Owner **— Of course the owner of the token can burn his/her tokens. Approved account — An approved account by owner can burn the token.

How much does minting ERC721 cost? ›

For example, minting an ERC-721 NFT costs between 100,000 to 200,000 gas per asset.

What makes ERC721 unique? ›

ERC721 tokens are unique in that the tokens are non-fungible .

Is ERC721 a smart contract? ›

ERC-721 was created to propose the functionality to track and transfer NFTs within smart contracts.

Which is the most efficient NFT? ›

ERC1155D is completely non-fungible in the way ERC721 is, so each token has a unique identifier and a unique owner. With a mint cost of under 51,000 gas, it greatly outperforms every other existing NFT implementation in terms of gas efficiency by a very large margin with savings of 23–66%.

Is MetaMask an ERC721? ›

With the new update, all ERC-721 and 1155 tokens will appear in the MetaMask Browser extension as long as automatic NFT detection is enabled. This new feature will allow users to send ERC-721 tokens with ease.

Why is ERC721 non-fungible? ›

ERC-721 is a token standard on Ethereum for non-fungible tokens (NFTs). Fungible means interchangeable and replaceable; Bitcoin is fungible because any Bitcoin can replace any other Bitcoin. Each NFT, on the other hand, is completely unique. One NFT cannot replace another.

What is OpenZeppelin? ›

OpenZeppelin is an open-source framework to build secure smart contracts. OpenZeppelin provides a complete suite of security products and audit services to build, manage, and inspect all aspects of software development and operations for decentralized applications.

What percent of NFT traders make money? ›

Just 5% of NFT traders make the vast majority of profits on marketplace OpenSea. A recent Chainalysis report reveals just 5% of NFT traders have received 80% of the profits generated so far this year on marketplace OpenSea. It found just 20% of active wallets have initiated 80% of secondary NFT sales.

What is the failure rate of NFT? ›

This is where things start to create problems for NFTs, especially while selling them (as explained in the above section). Gary Vaynerchuk, a significant player in the NFT field, predicts that 99% of NFTs ventures would fail and be worthless shortly.

Can you get in trouble for selling an NFT? ›

Using IP without the owner's permission is called IP infringement, and an NFT creator can be sued for that. Selling art using copyrighted characters is also an infringement unless you have the permission of the copyright owner.

What is the biggest problem of NFT? ›

The main challenge faced in the NFT market is the uncertainty in determining the price of the NFT. Now, the price of any NFT will depend on the creativity, uniqueness, scarcity of the buyers and owners, and a lot more.

Why are people against NFT? ›

They're Not Environmentally-Friendly. One of the main sources of criticism towards NFTs is their carbon footprint. It might look a little silly if you don't know the context, though. NFTs, at their core, are tokens stored on a blockchain.

Why is NFT controversial? ›

This is why the rise of NFTs directly contributes to climate change. Unless blockchain as a system becomes more energy-efficient and reliant on renewable energy sources, it may not be acceptable by those who are fighting on the ground against climate change. Also noteworthy is the cost of power.

What wallets support ERC721? ›

Trust Wallet offers you an easy way to keep all your unique ERC721 and ERC1155 crypto NFTs and game assets in one place.

Is Cryptopunks an ERC721? ›

Cryptopunks pre-date the ERC-721 standard and are a custom contract, that means it doesn't comply with any standards. They are almost an ERC20 token! However you can 'wrap' the punk into an ERC721 standard by using the wrapped cryptopunks Safe app.

Where can I sell my ERC721? ›

You can sell your token individually or on other marketplaces such as, Open Sea, Rarible, and Foundation. You have full ownership of your token.

Does burning an NFT cost gas? ›

Burning an NFT is considered a transaction so you will be charged a transaction or gas fee which covers the cost of sending an NFT to a null address. The fee itself can vary in price depending on the current supply and demand.

Does it cost money to burn an NFT? ›

Does it Cost Anything to Burn an NFT? There is no cost to burn an NFT on the Ethereum blockchain. However, you will need to pay a gas fee to send your NFT to the burn address.

How much gas does a mint ERC721 take? ›

This table shows how the gas used for ERC721A for an increasing number of mints scales at a much smaller constant factor. The gas cost to mint NFTs increases by: ~2k gas per extra mint using the Azuki ERC721A contract. ~115k gas per extra mint using the OpenZeppelin ERC721Enumerable contract.

How much is 10000 NFT minting? ›

Cost to mint NFTs using Different Blockchain

At this rate, the cost of minting 10,000 NFT will be over $21,000. However, the platform is not as popular or secure as other platforms such as Ethereum and OpenSea.

Can you make money by minting an NFT? ›

Minting and selling NFT game characters

This works just like blockchains and NFTs, meaning you can make a profit by minting your own character or a series of characters as NFTs. If the characters grow in popularity, their value will increase as well, even more so if the NFT collection is rare.

Why are gas fees so high to mint an NFT? ›

During peak transaction times, many users set their NFT gas fee limits high to ensure their transactions are validated. Those who set their limit too low run the risk of their transaction failing, in which case they'd lose the gwei used for the fee without their transaction completing.

What is the most important part of erc721s standard? ›

The main motivational factor behind the development and implementation of ERC-721 was the desire for a system to track digital ownership of non-fungible tokens on the blockchain. While ERC-20 was sufficient for tracking identical tokens, it failed to offer a solution for tracking items that are individually unique.

What makes an NFT more rare? ›

Another key factor that contributes to the value of an NFT is authenticity. NFTs are designed to be unique and verifiable, which means that collectors can be sure that they are buying an original, one-of-a-kind asset. This is particularly important in the art world, where forgeries can be a significant problem.

What is the difference between ERC721 and ERC721 A? ›

To put it simply, ERC721A is an extension and optimization of the previous version, the ERC721. The ERC721A contract is a very good idea which allows for saving money on gas in a given community, while at the same time protecting the Ethereum network from unnecessary workload.

Can you have an NFT without a smart contract? ›

NFTs wouldn't exist without smart contracts, and you can often look at an NFT smart contract as being one unit working for the same purposes. These smart contracts can be used in many ways to manage and enhance digital assets.

What can you do with ERC721? ›

It provides functionalities like to transfer tokens from one account to another, to get the current token balance of an account, to get the owner of a specific token and also the total supply of the token available on the network.

How do I add ERC721 to Metamask? ›

Add ERC-721 NFTs
  1. Step 1: Import tokens into your metamask wallet. Import Tokens.
  2. Step 2: Add custom token. Add Custom token. You have to specify the Token Decimal as 0. The token symbol is the same as the collection name specified in the ERC-721 contract. This token symbol can edit as well.

What type of NFT sells the most? ›

Sale details: The most famous NFT sale (and the most expensive NFT sale to date) was Beeple's Everydays: The First 5000 Days for $69.3 million.

What type of NFT sells well? ›

Because of that, art is also the kind of NFT that sells the best. The conception of NFTs was a prime opportunity for artists to sell their best works online as though they are physical.

What style of NFT are most popular? ›

After digital artwork, one of the most popular types of NFT is undoubtedly collectibles. Given the digital scarcity and rarity enabled by blockchain technology, collectible NTFs have naturally become some of the most sought-after.

Can I send ERC721 to ledger? ›

You can receive Ethereum NFTs (ERC721) in Ledger Live. To do that, you can simply send the NFT to your receiving Ethereum address.

How to mint ERC721? ›

4 Steps to Create an ERC721 Token on Kaleido
  1. Step 1: Create a Kaleido account. If you haven't already, sign up for a Kaleido account here. ...
  2. Step 2: Create a blockchain network. To get started, create a blockchain network. ...
  3. Step 3: Create a Token pool. ...
  4. Step 4: Mint your NFT. ...
  5. Step 5: Transferring Your ERC721 Token to Metamask.
Jan 9, 2023

Can ERC721 hold ERC-20? ›

This element holds ERC20 token inside ERC721 token. To work with ERC721 token as normal ERC20 token we need to create a ERC20Adapter that implements standard ERC20 methods, as for example balanceOf method.

What is the disadvantage of erc721? ›

Inefficient transfer capability

This is very bad as in most cases, the majority of the gas cost comes from the transaction itself, meaning transferring tokens one by one will exponentially increase the cost and burden on the network.

What size image for erc721? ›

Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive." } } }

How do I deploy an erc721 contract? ›

What are the steps to create and deploy ERC-721 tokens?
  1. Step1: Getting test ETH. We will use the Ropsten testnet to deploy our contract. ...
  2. Step2: Adding Files to IPFS. The next step is to add the files to the IPFS. ...
  3. Step3: Creating Token. We will be using the ERC-721 contract for a smooth NFT creation process.

What is the alternative to OpenZeppelin? ›

Top 10 Alternatives to OpenZeppelin
  • AWS Cloud Development Kit (AWS CDK)
  • pgAdmin.
  • AWS Schema Conversion Tool.
  • Nvidia Virtual GPU.
  • IBM Cloud Bare Metal Servers.
  • Faronics Deep Freeze.
  • AWS Deep Learning Containers.
  • Control-M for Mainframe.

Why use OpenZeppelin? ›

OpenZeppelin Contracts helps you minimize risk by using battle-tested libraries of smart contracts for Ethereum and other blockchains. It includes the most used implementations of ERC standards.

Is OpenZeppelin safe? ›

The standard for secure blockchain applications. OpenZeppelin provides security products to build, automate, and operate decentralized applications. We also protect leading organizations by performing security audits on their systems and products.

What is the advantage of erc721? ›

ERC-721 allows NFTs to be transferred between accounts, also making them tradeable for other currencies. One of ERC-721's practical functions is that it allows users to identify the total supply of a set of NFTs available on the network.

What are the pros and cons of NFT digital art? ›

Advantages of NFTs include fractional ownership of assets, royalty payments to the NFT creator, safe technology, and efficient sales. Disadvantages of NFTs include high minting costs, volatile pricing, and a high prevalence of imitation projects and fraud.

What are the advantages and disadvantages of NFT? ›

Pros of Non-Fungible Tokens
  • NFTs Foster Marketplace Efficiency. ...
  • They Can Be Used to Fractionalize Ownership of Physical Assets. ...
  • The Blockchain Technology Behind NFTs Is Very Safe. ...
  • NFTs Can Provide Diversification Benefit to an Investment Portfolio. ...
  • NFTs Are Illiquid and Volatile. ...
  • NFTs Do Not Generate Income.
Jan 14, 2022

Why is erc721 non-fungible? ›

ERC-721 is a token standard on Ethereum for non-fungible tokens (NFTs). Fungible means interchangeable and replaceable; Bitcoin is fungible because any Bitcoin can replace any other Bitcoin. Each NFT, on the other hand, is completely unique. One NFT cannot replace another.

Can a smart contract receive ERC721? ›

If a Smart Contract implements the following methods and events it can be called an ERC-721 Non-Fungible Token Contract and, once deployed, it will be responsible to keep track of the created tokens on Ethereum.

Why are so many artists against NFT? ›

Artists also have to look out for phishing attacks from people who want to hijack their accounts to push NFTs. Another artist told us that these schemes are “generally why most artists block NFT accounts on sight.”

What is the biggest problem with NFT? ›

The main challenge faced in the NFT market is the uncertainty in determining the price of the NFT. Now, the price of any NFT will depend on the creativity, uniqueness, scarcity of the buyers and owners, and a lot more.

What is the point of owning a NFT? ›

NFTs can represent digital or real-world items like artwork and real estate. "Tokenizing" these real-world tangible assets makes buying, selling, and trading them more efficient while reducing the probability of fraud. NFTs can represent individuals' identities, property rights, and more.

Why is crypto better than NFT? ›

While comparing cryptocurrencies vs NFTs, the former is often lauded for its volatility. Although some see this volatility as a positive point, others see it as a major negative point. NFTs, on the other hand, tend to be much more stable because they are not subject to the same market forces that cryptocurrencies are.

What makes an NFT worth more? ›

The primary value driver for most NFTs is uniqueness. Just like with physical art, the value of an NFT comes from its rarity and its ability to be one-of-a-kind. This is why many NFTs are created using blockchain technology, which allows for the creation of digital assets that cannot be duplicated.

What makes an NFT better than others? ›

People agreeing it is valuable

This is because each NFT is rare, unique, and indivisible. So, when a digital asset is tokenized, it creates value since it is possible to prove its authenticity and ownership and can be bought and sold many times over.

How much does it cost to deploy an ERC721 contract? ›

Depending on the current gas cost on Ethereum, deploying an ERC-721 smart contract can cost anywhere from $400 to $2,000. Imagine spending that kind of cash only to find out you made a mistake in the smart contract and will have to redeploy.

Top Articles
What is Ethereum? Explained With Features and Applications | Simplilearn
What's the Best Way to Hedge Against Inflation? The Answer Lies in Commodities - SmartAsset
Frases para un bendecido domingo: llena tu día con palabras de gratitud y esperanza - Blogfrases
Will Byers X Male Reader
Lowe's Garden Fence Roll
Moon Stone Pokemon Heart Gold
Brady Hughes Justified
Tesla Supercharger La Crosse Photos
Unitedhealthcare Hwp
Flixtor The Meg
Craigslist Parsippany Nj Rooms For Rent
Practical Magic 123Movies
Klustron 9
Elden Ring Dex/Int Build
Tlc Africa Deaths 2021
Learn How to Use X (formerly Twitter) in 15 Minutes or Less
World Cup Soccer Wiki
Bjork & Zhulkie Funeral Home Obituaries
Hartland Liquidation Oconomowoc
Craigslist Sparta Nj
Dallas Craigslist Org Dallas
Grimes County Busted Newspaper
Happy Life 365, Kelly Weekers | 9789021569444 | Boeken | bol
Doublelist Paducah Ky
fft - Fast Fourier transform
Cowboy Pozisyon
Pacman Video Guatemala
Maisons près d'une ville - Štanga - Location de vacances à proximité d'une ville - Štanga | Résultats 201
Login.castlebranch.com
Craftsman Yt3000 Oil Capacity
Nurofen 400mg Tabletten (24 stuks) | De Online Drogist
Ilabs Ucsf
"Pure Onyx" by xxoom from Patreon | Kemono
Average weekly earnings in Great Britain
2015 Chevrolet Silverado 1500 for sale - Houston, TX - craigslist
Joplin Pets Craigslist
Exploring TrippleThePotatoes: A Popular Game - Unblocked Hub
Watchdocumentaries Gun Mayhem 2
Keeper Of The Lost Cities Series - Shannon Messenger
Enjoy4Fun Uno
Gun Mayhem Watchdocumentaries
Gravel Racing
Sun Tracker Pontoon Wiring Diagram
Mychart University Of Iowa Hospital
Unit 11 Homework 3 Area Of Composite Figures
Air Sculpt Houston
The Complete Uber Eats Delivery Driver Guide:
Dicks Mear Me
Makes A Successful Catch Maybe Crossword Clue
Treatise On Jewelcrafting
Where Is Darla-Jean Stanton Now
Selly Medaline
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 6054

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.