Back to Blog
Bitcoin and Ethereum coins dissolving into a stream of NFT tokens, titled "Understanding ERC-1155"
Engineering
Dec 20, 2022
9 Min Read

Understanding ERC-1155: Features and Use Cases of the Next-Gen Token Standard

Introduction to ERC-1155

ERC-1155 is a multi-token standard that started on Ethereum but is now used more widely. It allows developers to create and manage both fungible and non-fungible tokens (NFTs) with one smart contract. This makes it more flexible and cost-effective than single-purpose standards like ERC-721.

With ERC-1155, developers decide how each token type works in their decentralized apps, including how tokens are traded, stored, and used. For users, this means more convenience because one Ethereum wallet can hold and use many different token types at the same time.

The full specification is available in EIP-1155. For a production-ready implementation, most developers turn to OpenZeppelin’s contracts library, one of the most widely used implementations of ERC-1155 and other Ethereum Improvement Proposals (EIPs).

What Does ERC Stand For?

ERC stands for Ethereum Request for Comment. This is the process used to propose improvements and new features for the Ethereum network. To suggest a change, someone writes a document that explains the new feature and how it would work with the network’s current rules.

If the proposal is accepted, it gets a unique ERC number for easy reference. This process helps Ethereum grow and change over time while staying secure, scalable, and open to new uses.

ERC-1155 vs. ERC-20 and ERC-721

The main advantage of ERC-1155 is its flexibility. ERC-20 only supports fungible tokens, and ERC-721 only supports non-fungible tokens. ERC-1155 combines both in one smart contract, so developers do not have to create and manage separate contracts for each token type.

This approach has real benefits. There are fewer contracts to deploy and check, lower gas costs, and support for more complex transactions, such as sending several different token types at once. These features are not possible with ERC-20 or ERC-721 alone.

ERC-20

ERC-20 is the standard for managing fungible tokens on Ethereum, and remains one of the most widely used standards for creating and trading digital assets. Every ERC-20 token follows the same set of rules, which standardizes token behavior and makes tokens easier for developers to build and for users to manage and trade.

Here are the core state variables from OpenZeppelin’s ERC-20 contract:

mapping(address => uint256) private _balances;

mapping(address => mapping(address => uint256)) private _allowances;

uint256 private _totalSupply;
string private _name;
string private _symbol;
  • _name and _symbol identify the token. For example, Shiba Inu’s ERC-20 token uses the symbol SHIB.
  • _totalSupply sets the total number of tokens that can ever be issued; for SHIB, that’s one quadrillion tokens.
  • _allowances enables one of ERC-20’s more useful features: letting another address spend tokens for you. For example, if you have 1,000 tokens and approve someone to spend 100, you still own all 1,000. Each time they spend from the approved 100, your balance goes down by that amount.
  • _balances tracks how many tokens each address holds.

Every function defined in the ERC-20 standard - transferring tokens, checking balances, setting allowances - operates on these four variables. ERC-20 was purpose-built for issuing and managing fungible tokens, and isn’t intended for other uses.

ERC-721

ERC-721 is the standard for non-fungible tokens (NFTs) on Ethereum. Here are the core state variables from OpenZeppelin’s ERC-721 contract:

string private _name;
string private _symbol;

mapping(uint256 => address) private _owners;

mapping(address => uint256) private _balances;

mapping(uint256 => address) private _tokenApprovals;

mapping(address => mapping(address => bool)) private _operatorApprovals;

_name and _symbol serve the same purpose as in ERC-20. The remaining variables are specific to managing unique, non-fungible assets:

  • _owners maps each token ID to the address that owns it. This is the main way to track who holds each unique NFT.
  • _balances tracks how many NFTs each address owns in total.
  • _tokenApprovals records which address, if any, has been approved to transfer a specific token.
  • _operatorApprovals lets an owner approve a single operator to manage all of their NFTs at once.

Together, these variables power every function defined in the ERC-721 standard, from transfers to approvals.

Inside the ERC-1155 Standard

Having seen how ERC-20 and ERC-721 work individually, it’s easier to see what ERC-1155 brings together: fungible and non-fungible tokens, managed from the same contract. The full specification lives in EIP-1155; the code below is from OpenZeppelin’s ERC-1155 contract.

mapping(uint256 => mapping(address => uint256)) private _balances;

mapping(address => mapping(address => bool)) private _operatorApprovals;

string private _uri;
  • _uri holds a string that indicates a token’s location, usually a URL such as an IPFS link or a standard web address.
  • _operatorApprovals works the same way it does in ERC-721: an owner can approve an operator to manage tokens on their behalf.
  • _balances is what makes dual support possible. It maps each token ID to a mapping of address-to-quantity so that a single variable can track ownership counts for both fungible and non-fungible tokens.

This flexibility also means more responsibility. The standard does not enforce fungibility by itself, so the contract creator must make sure that any token meant to be non-fungible always has a balance of exactly 1 for each holder.

Key Features of ERC-1155

  • Dual token support: One smart contract can manage both fungible tokens and NFTs. This lets developers build hybrid token systems without needing separate contracts.
  • Efficiency and cost savings: Since multiple token types can be stored and transferred together, ERC-1155 needs fewer transactions than using separate ERC-20 and ERC-721 contracts. This lowers gas costs, even when minting new tokens.
  • Semi-fungible tokens (SFTs): ERC-1155 supports tokens that act as fungible until a certain event makes them non-fungible. (More details below.)
  • Multi-token management: Multiple token types can be managed from a single contract and a single wallet.
  • Batch transactions: Built-in functions support bundling several token transfers into one transaction.
  • Flexible configuration: Token issuers can define supply limits, minting rules, and destruction (burning) rules per token type.
  • Security features: ERC-1155 supports multi-signature transfer functionality and contract upgrades, letting the system evolve without disrupting existing token holders.
  • Wallet and exchange compatibility: ERC-1155 tokens work with wallets and exchanges built for ERC-20 and ERC-721, easing integration with existing infrastructure.
  • Broad flexibility for custom tokens: The standard’s design supports a wide range of use cases, from in-game assets to digital art, by allowing highly customizable token behavior.

What Are Semi-Fungible Tokens (SFTs)?

A semi-fungible token has features of both fungible and non-fungible tokens, depending on its state. Think of a store coupon: while it is unused, it has a set value and can be traded like any fungible token. Once it is redeemed, it becomes a unique, non-transferable record, which makes it non-fungible. ERC-1155 allows this by letting a token start as fungible and later become non-fungible, combining both behaviors in one token.

SFTs add a layer of flexibility that plain fungible or non-fungible tokens don’t offer, which makes them well-suited to use cases like loyalty and rewards programs. And because they’re built on Ethereum, they carry the same security, transparency, and wallet accessibility as any other token on the network.

In Solidity, this pattern is typically implemented by keeping an extra variable to store the coupon’s remaining value, then zeroing it out once the coupon is redeemed.

Use Cases of ERC-1155

  • Gaming: In-game assets like weapons, armor, and collectibles map naturally onto ERC-1155’s non-fungible side. In contrast, in-game currencies map onto its fungible side, letting developers build a flexible in-game economy from a single contract.
  • Art and collectibles: Like ERC-721, ERC-1155 can represent unique, verifiable assets, from digital art to sports memorabilia.
  • Supply chain management: Enterprises use ERC-1155 to represent goods and materials as they move through a supply chain, reducing fraud risk and improving transparency and accountability.
  • Decentralized finance (DeFi): ERC-1155 tokens can be used in liquidity pools and decentralized exchanges, adding flexibility to how tokens are managed and traded.
  • Fractionalizing illiquid assets: Traditional illiquid assets like real estate, antiques, or rare art can be represented on-chain via ERC-1155, allowing full or partial ownership to be tracked and traded more easily.

Limitations

  • Uneven support: Not all wallets and exchanges support ERC-1155 yet.
  • Limited granularity: Tokens can only be subdivided to a certain extent, which may not suit use cases that need very fine-grained divisibility.
  • Shared security surface: Because fungible and non-fungible tokens live in the same contract, a security breach can put both types at risk at once.
  • Ambiguity in usage patterns: Even though ERC-1155 provides a framework for both fungible and non-fungible tokens, there’s still ambiguity around exactly how these tokens should be used and managed in practice.
  • Cross-chain limitations: ERC-1155 tokens may not transfer to other blockchain networks, which limits their use in cross-chain scenarios.
  • Added complexity: ERC-1155 is more sophisticated than standards like ERC-20, which can raise the learning curve for developers.

Conclusion

ERC-1155 combines fungible and non-fungible tokens in one smart contract, making things more efficient, cost-effective, and flexible compared to using ERC-20 and ERC-721 alone. This versatility has made it popular in gaming, art, collectibles, supply chain management, DeFi, and asset fractionalization. However, there are trade-offs, such as uneven wallet support, shared security risks, cross-chain limits, and a steeper learning curve. Before adopting ERC-1155, it is important to consider these factors. As the standard evolves, developers and users should keep up with best practices for building and managing ERC-1155 tokens.

Filed Under

Join the Conversation

This dispatch is part of an ongoing series on the future of intelligence. Share your perspective or subscribe for more.

Weekly dispatches. No spam. Ever.