What token standard should I use for my NFT?
ERC-721 seems to be the most popular NFT standard, but is there another option?
If you browse the top NFT collections on OpenSea, you’ll notice they all have one thing in common—the token standard ERC-721.
What is a token standard and why do we need them? Well, an NFT can really be implemented in any way, as long as it is distinguishable from other tokens. But since we need an easy way for NFT marketplaces to recognize and understand what NFTs are, token standards come in handy. The finalized official Ethereum token standards are listed here, although a quick google search will unfold numerous unofficial ones that cater to various niche use cases.
Currently, the main Ethereum token standards are ERC-20, ERC-721, and ERC-1155. The differences between the standards can be found in many articles, but most focus on fungibility: ERC-20 represents fungible tokens, ERC-721 represents non-fungible tokens, and ERC-1155 represents both fungible and non-fungible tokens.
Below are the ERC-721 and ERC-1155 specifications for transfer:
// ERC-721 transfer specification
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
// ERC-1155 transfer specification
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
As shown above, ERC-721 and ERC-1155 achieve non-fungibility within a token collection simply through token identifiers (_tokenId
and _id
). ERC-1155s additionally support fungibility by letting more than one token to exist for a token ID (_value
represents the token count of a token ID). This means that we can restrict _value
to be at most 1 if we want to guarantee non-fungibility for ERC-1155 NFTs. With ERC-1155, we can create NFT collections that have both fungible and non-fungible objects.
Another way to achieve non-fungibility with ERC-1155s is with URI variables. ERC-1155 specifies that if the string {id}
exists within any URI, clients must replace it with the actual token ID in hexadecimal form. Using this variable, ERC-1155 suggests “[t]he top 128 bits of the uint256 _id
parameter in any ERC-1155 function MAY represent the base token ID, while the bottom 128 bits MAY represent the index of the non-fungible to make it unique.” In other words, a single contract can represent multiple collections by representing an NFT collection with the high bits of {id}
. While this is also possible for ERC-721s since it has a tokenId
, with an ERC-1155, a single team may only ever have to deploy a single contract for all its NFTs due to its support for both fungible and non-fungible collections.
One other notable ERC-1155 feature is batch transfers, as hinted by its transfer event name above (TransferSingle
). The ability to have batch transfer events means that a batch mint, a batch safe transfer, or a batch burn can be processed in a single transaction. The gas price for a batch action will be similar to that of a single action, which is particularly beneficial for projects where the mint price less than the gas price. Furthermore, batch mints come in handy for token airdrops, since many holders own more than one NFT under the same collection. Additionally, OpenZeppelin’s ERC-1155 implementation saves gas by having only the base URI parameter in its _setURI
function, so that the URI is set at the contract level and not per token.
ERC-1155s can save gas costs for both developers and buyers. So why are all the top NFT projects ERC-721 tokens?
While I haven’t found a clear answer, I did notice that there was a strong perception that all NFTs are ERC-721s (with the exception of CryptoPunk). I observed this in NFT community posts, and even the popular Azuki NFT team posted the following tweet:
Here, the Azuki team made changes to the OpenZeppelin ERC-721 implementation to do exactly what the ERC-1155 standard already does, despite the OpenZeppelin ERC-1155 implementation existing since 2020. The Azuki team also stated the ERC-721A “ for the first time ever in the NFT space, enables minting multiple NFTs for essentially the same cost of minting a single NFT.” While this may be true within ERC-721s, it is technically not true within the NFT space since ERC-1155 has already achieved this.
Another guess is that some NFT teams do not care about gas costs inflicted on buyers. At this point, a lot of us have become indifferent to high gas prices, and we are used to paying for ERC-721s. Not only that, but the support for a single contract to represent multiple collections does not yet exist in major marketplaces, such as OpenSea and LooksRare. This leads to developers ending up deploying one contract per collection even for ERC-1155 contracts.
If not the reasons above, perhaps teams are relying on gas solutions with Layer 2 (and potentially Layer 3) scaling instead. Please let me know in the comments below if you know any other reasons why the top NFT projects use ERC-721s over ERC-1155s. Regardless, we should strive to stay up to date on the latest standards and adopt the best choice.
A perfect way to start my Monday morning. Thanks for sharing your insight!