Ethereum wants to create an ecosystem where everything works together seamlessly as part of its vision for a 'world computer' – and that includes the tokens required to power it.
by a band of coders and an upstart teenager, ethereum was designed to make it possible for anyone to code nearly any type of app and deploy that on a blockchain. Many of these decentralized apps (or 'dapps' for short) needed their own token that could, among other things, be sold and traded easily.
To that end, nearly 18 months ago, the ERC-20 token standard was born.
It's hard to overstate how important that interface has been. By defining a common set of rules for ethereum-based tokens to adhere to, ERC-20 allows developers of wallets, exchanges and other smart contracts, to know in advance how any new token based on the standard will behave.
This way, they can design their apps to work with these tokens out of the box, without having to reinvent the wheel each time a new token system comes along.
As a result, almost all of the major tokens on the ethereum blockchain today, including those sold in the recent surge of ethereum-based initial coin offerings (ICOs), are ERC-20 compliant.
Before delving deeper, it's important to spell out what a token actually is and how it differs from ether, the native currency driving the ethereum blockchain.
As they relate to the ethereum network, tokens are digital assets that can represent anything from loyalty points to vouchers and IOUs to actual objects in the physical world. Tokens can also be tools, such as in-game items, for interacting with other smart contracts.
But put simply, a token is nothing more than a smart contract running on top of the ethereum blockchain. As such, it is a set of code (functions) with an associated database. The code describes the behavior of the token, and the database is basically a table with rows and columns tracking who owns how many tokens.
If a user or another smart contract within ethereum sends a message to that token's contract in the form of a 'transaction,' the code updates its database.
So, for instance, when a wallet app sends a message to a token's contract to transfer funds from Alice to Bob, this happens:
- First, the token's contract checks that the message was signed by Alice and that Alice has enough funds to cover the payment
- Then, it moves funds from Alice's to Bob's account in the database
- Finally, it sends a response, letting the wallet know the transaction was a success.
In contrast to tokens, ether is hard coded into the ethereum blockchain. It is sold and traded as a cryptocurrency, and it also powers the ethereum network by allowing users to pay for smart contract transaction fees. (All computations on the ethereum network have a 'gas' cost.)
When you send tokens to an exchange, for example, you pay for that transaction (in this case, a request to the token's contract to update its database) in ether. This payment is then collected by a miner who confirms the transaction in a block, which then gets added to the blockchain.
Early on in ethereum's history, standards were part of the overall plan to create a user friendly and broadly accessible system. But like all standards, ERC-20 took time to evolve over a series of long discussions and careful considerations.
So, sometime before DevCon1, the first big ethereum conference in 2015, Vitalik Buterin, the founder of ethereum, introduced the initial standards token.
Later that year, Fabian Vogelsteller, one of the developers working on ethereum's Mist wallet, took that standard, changed a few things, and proposed it to the community as ERC-20 to initiate a formal conversation around how the standard should be implemented.
Then in April, due to changes in how the Ethereum Foundation was organizing its GitHub, the ERC-20 standard was moved to a Github pull request.
ERC-20 defines a set of six functions that other smart contracts within the ethereum ecosystem will understand and recognize.
These include, for instance, how to transfer a token (by the owner or on behalf of the owner) and how to access data (name, symbol, supply, balance) about the token. The standard also describes two events – signals that a smart contract can fire – that other smart contracts 'listen' for.
Together, these functions and events make ethereum tokens work the same almost everywhere within the ethereum ecosystem. As a result, nearly all wallets that support ether, including Jaxx, MyEtherWallet.com and Ethereum Wallet (also called Mist Wallet), now also support ERC-20 compliant tokens.
According to Vogelsteller, who spoke to CoinDesk about the importance of ethereum's token standard, this interoperability lays the groundwork for big changes to come.
Bumps in the road
One thing to keep in mind, though, is that ERC-20 is formally a draft, meaning it is not being enforced and still needs to be fully blessed by the ethereum community. Regardless, Vogelsteller said, every new token will likely conform to its set of rules.
He cautioned, however, that the standard is still young, so there will be bumps in the road. One of those bumps is that sending tokens directly to a token's smart contract will result in a loss of money. That is because a token's contract only tracks and allocates money. When you send tokens to another user from a wallet, for example, that wallet calls on the token's contract to update the database.
As a result, if you attempt to transfer tokens directly to a token's contract, the money is 'lost' since the token's contract cannot respond.
So far, $70,000 worth of tokens have been lost in this manner. (The amount varies depending on the market price of ether.)
But solutions are in the works. As an extension to ERC-20, ERC-223 attempts to resolve the issue by suggesting a token's contract implement a tokenFallback function to prevent the contract from holding tokens sent directly to it accidentally.
Vogelsteller argued this is all just part of developing a solid system, though, saying:
The leader in news and information on cryptocurrency, digital assets and the future of money, CoinDesk is a media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. CoinDesk is an independent operating subsidiary of Digital Currency Group, which invests in cryptocurrencies and blockchain startups.