Tokens, Standards, and Smart Contracts: The differences between ERC-20 and ERC-721
Smart contracts control the world - or at least the blockchain.
If the blockchain is the engine of the crypto world, then smart contracts are the pistons. To modernize the analogy, smart contracts are the lithium-ion cells in an electric vehicle. They're crucial to actually making the engine work and the car operate as planned.
So far, so good. But smart contracts don’t operate alone. In turn, they’re powered by tokens, the assets of any blockchain. When it comes to tokens, however, there’s more than one use case. That’s why most tokenomics today refer to one of two primary standards - ERC-20 and ERC-721.
Smart contracts under the hood
Smart contracts are an open framework that can involve the transfer or production of assets as well as simple transfers. More complicated smart contracts initiate actions only under certain conditions.
Included in each smart contract is a sequence of identifying information known as functions. This information serves as the metadata of the smart contract. Categories include:
- Token name
- Total Supply
In other words, these functions dictate what the smart contract is doing and how it does it.
Determining which information to include in the smart contract poses a challenge. As the Ethereum network gained steam in 2015, the founders sought to impose some order on an increasingly diverse system. Vitalik Buterin and Fabian Vogelsteller drew up two token standards. Those standards - ERC-20 and ERC-721 - have become industry leaders in the ensuing years.
The need for multiple standards
Why use multiple standards? Because when it comes to the token category, there's a bit of a problem. Not all smart contracts handle tokens the same way. Not all smart contracts even need payments or transfers. Sometimes a contract might simply be issued to verify something. Those contracts act differently than a traditional smart contract that moves a set amount of Ethereum from point A to point B.
Together, the two standards act as categories for new and existing tokens. They clarify what a given token does and how it acts within a smart contract.
Buterin originally described the ERC-20 standard as a "standard interface for tokens." No extra details were given, at least at that point, but the ERC-20 standard applied to fungible tokens. "Fungible" means that these tokens can be created, destroyed, and exchanged on a like-for-like basis.
The idea of "fungibility" is nothing new. Fiat currency operates the same way. No individual dollar bill is worth more than any other dollar bill; no one ETH token is worth more than any other ETH token.
Ethereum intentionally lacked protocol-wide standards at the beginning. But over time, the growing number of tokens and applications made it desirable to have a common framework. As Buterin stated, ERC-20 provided that framework by highlighting key functions to identify in any smart contract.
The ERC-20 standard caught on and has remained the go-to ever since. Like all standards, it isn't perfect. Variations of the ERC-20 standard have emerged since 2015 in an attempt to compensate for various bugs and weaknesses. Even so, a quick scan of industry tokenomics reveals that ERC-20 remains the dominant standard.
What about non-fungible projects?
In 2015, Buterin also penned a standard for non-fungible tokens, also descriptively referred to as "deeds." These tokens aren't meant to be exchanged one for another like a dollar bill. Instead, like a physical deed, each one is unique, tied to a specific virtual object. In Buterin's original framework, non-fungible tokens (NFTs) could be used for:
- Physical property — houses, unique artwork
- Digital collectables — unique pictures of kittens, collectable cards
- "Negative value" assets — loans, burdens and other responsibilities
Houses are distinct. Loans have unique conditions. Collectable cards are limited in nature, and often individualised. In the same way, tokens created to the NFT standard - ERC-721 - are "distinguishable."
The NFT standard is receiving increased attention as the industry matures. ERC-721 tokens hold the promise for true ownership recorded on the blockchain. One vital aspect of the ERC-721 standard is the Transfer function, which records current and past ownership. All addresses ever associated with that token are preserved on the blockchain, accessible to all.
The differences summarised
If you're building a crypto project with a native fungible token on the Ethereum blockchain, the odds are good you'll be using the ERC-20 standard. Use ERC-20 tokens as the basis for smart contracts with like-to-like exchanges. Any one token is of equal value to any other token, so there's no need to track the ownership of every individual ERC-20 token in your possession.
If you need to establish ownership of unique digital or real-world assets, use tokens based on the NFT standard, ERC-721. Each ERC-721 token is unique. NFT tokens can be traded, bought, and sold just like ERC-20 tokens, but aren't interchangeable. ERC-721 tokens are distinguishable; you'll need to track the ownership of each token individually.
Phuture’s own PHTR token is an ERC-20 token, used primarily for governance purposes within the Phuture ecosystem.