One way to represent exchange value on a blockchain network is through asset tokenization, whereby assets can be fungible or non-fungible. Fungibility means that they can be divided and exchanged for others. On the other hand, non-fungible tokens (NFTs) cannot be divided and have no existing duplicates. In a blockchain such as Ethereum, there are two popular standards for creating NFTs: ERC-721 and ERC-1155.
What is ERC 721?
ERC-721 is a non-fungible token (NFT) standard written in Solidity on the Ethereum blockchain. It allows developers to tokenize ownership of any arbitrary data. Specifically, the standard aims to create fungible tokens. The ERC-721 standard was created by William Entriken, Dieter Shirley, Jacob Evans, and Natassia Saks in 2018. An example of an ERC 721 contract is the contract from OpenZeppelin, which allows developers to track items in their game.
Essentially, each ERC-721 token is unique and represents a single asset. Moreover, it allows developers to create a completely new ecosystem of tokens on the Ethereum blockchain.
Characteristics of ERC 721 tokens
The ERC-721 standard is structurally similar to the famous ERC-20 token architecture. Although the smart contracts of both tokens have several similar functions, some features of ERC-721 differ.
Here are the most distinctive features of ERC-721:
- Token name: Each ERC-721 token has a name field that specifies the token’s name for external applications or contracts.
- Ownership: The ERC-721 standard has a specific function field that defines ownership of the underlying token and provides instructions on how to transfer that ownership.
- Token tracking: The ERC-721 standard has a field called “tokenOfOwnerByIndex” that allows developers to track tokens using a unique identifier.
What is ERC 1155?
ERC-1155, an improved standard after ERC-721, is another token standard on the Ethereum blockchain that makes it easier to create both types of tokens, fungible and non-fungible. The goal is to create a smart contract interface that can represent both types. Below is the ERC-1155 token code from OpenZipplin, which helps track multiple items in a game.
ERC-1155 token code
The ERC-1155 standard, in particular, has the same functionality as the ERC-721 and ERC-20 tokens. However, it improves on the functionality of both standards and is generally a more efficient standard. In terms of advantages, transactions using the ERC-1155 standard can be combined together to reduce the cost of trading tokens.
Advantages of ERC 1155 tokens
The ERC-1155 standard stands out for the following characteristics:
- Efficient transfer: The ERC-1155 standard allows users to make bulk token transfers within a smart contract. For example, in a smart contract with a number of fungible or non-fungible tokens, the developer can choose to transfer multiple tokens in a single operation. This not only reduces the cost of the transaction, but also minimizes the impact on the network.
- Multiple tokens in a single contract: Each ERC-1155 token describes the existence and operation of both fungible and non-fungible token types. For example, while ERC-1155 can create one or more NFTs, it can also describe fungible tokens — all within a single contract.
- Secure token transfer: The ERC-1155 token standard includes a feature that verifies whether a transaction is valid or not. If the transaction fails, this function returns the token to the issuer. This helps when users accidentally make a mistake in transcription or send tokens to the wrong address. The code can automatically cancel the transaction.