logo
logo
Sign in

Understanding Token ERC-20

avatar
BlockchainX
Understanding Token ERC-20

What is Token ERC-20?

Token ERC-20 is a token that is created and used only on the Ethereum platform. Token ERC-20 follows a number of standards so that it can be shared, exchanged with other tokens, or transferred into a crypto wallet.

The Ethereum community makes these standards with three optional rules and six BASIC rules

CHOICE REGULATIONS

  • Token Name
  • Symbol
  • Decimal (up to 18)

BASIC REGULATIONS

  • total Supply
  • balanceOf
  • transfer
  • transferFrom
  • approve
  • allowance

What is Ethereum?

To understand ERC-20, you first need to know what Ethereum is.

Ethereum is a decentralized computer network that has two basic functions. Blockchain that can record transaction traces and a virtual machine that can make smart contracts.

With these two functions, Ethereum can support decentralized applications (DApps). DApps is built on the existing Ethereum blockchain, on the basis of the technology. Instead, Ethereum charges developers with computing power on their networks, which can only be paid using Ether.

Depending on its purpose, DApps can make an ERC-20 token as a currency, as a stake in a company, as a point in a loyalty program, or even as proof of home ownership or a certain amount of gold.

Also read: What is Ether?

What is the role of Smart Contracts in this case?

Smart Contracts are used to make ERC-20 Tokens. In addition, it is also used to facilitate token transactions and record token balances in an account.

Smart contracts are written in a programming language "Solidity" on the basis of If-This-Then-That (IFTTT) logic.

What happens after the smart contract creates a token?

Once created, a token can be exchanged, finished, or given to someone else. ERC-20 is a universal language used by all tokens in the Ethereum network. ERC-20 allows a token to be exchanged for another token.

It is like we want to make a crypto-casino . Just like a casino in general, we want all the players who come to use the chips provided by the casino, to be simple. So that players exchange their fiat money for tokens that we have and then play at the poker table.

Also read: What are Smart Contracts?

How does it work?

For example, let's look at each of the rules for ERC-20 in our crypto-casino .

Starting with the optional rules ( optional ):

  • Token Name: Blu Chip
  • Symbol: BLU
  • Decimal: 2 *

* means the smallest token value that can be used in a bet is 0.01 BLU. We can just use the decimal to 18 so that the smallest bet value is 0.000000000000000001 BLU, but for this example we make it simple.

For the basic rules:

  • [ Total Supply ] means indicates the total amount of inventory ERC-20 Tokens made.

Example: The first thing our Casino needs is how many BLU tokens are played. Let's just say at our poker table there are 10 BLU and filled by 10 players.

  • [ Transfer ] means allowing the token to be transferred in a certain amount from [ TotalSupply ] to someone's account.

Before the game starts, players must get the BLU token from the dealer; each player gets 1 BLU.

  • [ BalanceOf ] is a function to return a number of tokens from an existing address to his account.

In the first round of poker, five players look at the cards in their hands and decide not to play. The other five players decide to bet 0.5 BLU. With the [ BalanceOf ] function , we can see that there are 5 players who have 1 BLU and 5 players who have 0.5 BLU.

  • [ TransferFrom ] is a function that allows a user to transfer his token to another user.

When one player wins the first round, he gets 2.5 BLU from the other players. But so he can get tokens from other players, he needs [ TransferFrom ]. Because without the [ Transferfrom ] function , it means that nothing prevents one player from stealing BLU from other players.

  • [ Approve ] checks transactions of total token inventory. No more or less certain.

Another way to maintain the integrity of our crypto-casino is to make sure no one brings extra BLU to the poker table. Thus, Approve allows for exchanges to occur by checking that the number of BLUs on the table remains 10.

  • [ Allowance ] is a function that checks the balance in a user's account and will cancel the transaction if there are not enough tokens.

In our crypto-casino , no credit is allowed. So, we need to make sure that each player has enough BLU to bet. If the player only has 1 BLU, then he cannot bet at 2 BLU.

What are the advantages of ERC-20?

ERC-20 makes things simpler.

Before there was an ERC-20 token, the developer might use other terminology in coding. Example; There is a token that uses [totalAmount] there are also other tokens that use [totalNumber]. Exchange and wallet are needed to build their own platform to accommodate the code of each token.

With a universal standard, new tokens can be placed on an exchange or transferred to a wallet automatically, after the wallet is created.

ERC-20 also made the creation of new tokens very easy and therefore Ethereum became the most popular platform for ICO in 2017.

What are the Drawbacks of ERC-20?

ERC-20 is not perfect. There are still a number of issues not addressed in the ERC-20 token standard.

There are some situations where tokens can be accidentally destroyed when used as payments for smart contracts because they don't use Ether. About $ 3 million lost because of this.

To remedy this, the Ethereum community is now setting a new standard under the name ERC-223. However, these standards are not compatible with ERC-20 so developers are encouraged to continue to use ERC-20 until compatibility is realized.

In April 2018, a number of exchanges held deposits and withdrawals of Ethereum-based tokens due to batchOverflow interruptions . The disturbance is said to be a "classic integer overflow problem" and could potentially allow an attacker to "have a large number of tokens". It is noted, currently there is no traditional security approach to remedy these deficiencies.

Examples in the Real World

All tokens in the Ethereum platform are ERC-20 tokens. When this article was written, there were 245,148 tokens, among them

  • EOS (EOS) is currently the 5th largest cryptocurrency with a market cap value of $ 4.64 Billion, is trying to build a network that can take advantage of inter-blockchain communication .
  • TRON (TRX) was ranked 13th when this article was written and referred to as an " open-source protocol for the digital entertainment industry". Aim to launch a content platform with an ecosystem that connects everyone who creates different types of content.
  • VeChain (VEN), an " enterprise level public blockchain platform ", is the 19th cryptocurrency in terms of market cap, planning to implement Internet of Things (IoT) technology to provide private keys for each product to enable tracking.

 

collect
0
avatar
BlockchainX
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more