Sirwin
Sirwin
ERC-20 may be the future of cryptocurrency

ERC-20 Fully Explained(Giveaway at the end of the post)


Hello guys! Today I will be fully explaining ERC-20. There is also a giveaway at the end of this post, so read until the end. 

Overview of ERC-20

ERC-20 tokens are designed and used solely on the Ethereum platform. They can be shared or exchanged, and they can also be transferred to a wallet, just like normal cryptocurrencies. The Ethereum community decided that these tokens should follow a set of 6 mandatory rules and 3 optional rules. 

ERC-20 tokens have a lot of impact in the crypto world. Most ICOs today are based on ERC-20, and the ICO industry is worth billions of dollars every year. They have also helped make cryptocurrencies more widely used. Nowadays, it is rare for a multi-crypto wallet to not support at east 1 ERC-20 token. ERC-20 technology is widely used because it is so easy and innovative. But before that, we need to go back in time and explore the history of ERC-20, and explain what ICOs are.

What are ICOs?

An ICO is an initial coin offering. They usually happen when someone/a group of people want to launch a cryptocurrency and popularise it. Firstly, they need to write a whitepaper that outlines exactly what this ICO is and how it will improve on existing technologies. Then they ask that you make an investment by buying some coins. Payment can be fiat, but payment is usually in cryptocurrencies because they want to promote cryptocurrency to new users. The investor basically hopes that the currently worthless coin's value will go up.

It's important to note that, unlike an initial public offering (IPO), investing in an ICO won't result in you having an ownership stake of the company you're giving money to.

Literally anyone can launch an ICO. Right now, cryptocurrency has little laws, meaning that you can do almost anything with it. This is also its flaw, since anyone can set up a pretend ICO and then perform an exit scam and walk away with your money. This is why before you buy your coins, you should do your own research and see whether the people making the ICO are real and accountable. 

The path to smart contracts

The start of cryptocurrency was when a pseudononymous inventor called Satoshi Nakamoto created Bitcoin. It was the first truly decentralised and trustless cryptocurrency that solved the problem of double spending. However, there is a huge problem with Bitcoins. If you want to send someone Bitcoins only after they do a certain task, how can you be sure that they aren't walking away with your money? And how do you do this automatically without any intervention? The answer to that is smart contracts.

Vitalik Buterin provided a solution to this when he created Ethereum in 2015. He realised that the blockchain was so much more than a simple payment system. Here is a quote from his website:

“Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference. These apps run on a custom built blockchain, an enormously powerful shared global infrastructure that can move value around and represent the ownership of property.”

So Ehtereum is planning to be a decentralised program where anyone can create decentralised apps or DApps. How do you make these DApps? By utilising smart contracts.

Smart contracts explained

Smart contracts are how things get done in the Ethereum ecosystem. Two parties can initiate a smart contract when they want to get a particular task done. Smart contacts were conceptualised by Nick Szabo. According to him, the best real-life working example of the smart contract is a vending machine. 

When you want something from a vending machine, you just deposit a certain amount of cash into it, and the vending machine gives you the product that you want. You make a secure transaction without any involvement from a third party. As long as you deposit your money and choose your product, the vending machine will give you your product. This reduces the chance of malicious third parties interfering with your transaction. 

Suppose you want to give Ethereum to Bob once he finishes some tasks.The smart contract "locks up" the Ethereum so that they are inaccessible until Bob finishes his task, at which point the Ethereum is given to Bob.

How do developers fund this project?

With ICOs of course. The money raised in the ICO will be used to fund the development of ERC-20 tokens. The developer also often keeps some coins to distribute later or to hope that the price of the coin will rise, netting them a profit. ICOs are much better than IPOs because:

-It is far simpler to make an ICO. All you need to do is provide a paper that outlines your project

-Anyone can become invested in a project they are interested in by purchasing the tokens of that particular DAPP and become a part of the project themselves.

The developers then give the investors tokens.

What are the uses of tokens?

Tokens don't just have to be a unit of value. It can be a stake, voting rights, or just about anything. A token isn't limited to one role, it can be used to stake and be used as a payment for example. There are a few roles that tokens can have.

Toll-A token can act like a gateway to the DApp. In order to acess the DApp, you have to hold tokens in your wallet

Voting rights-The more tokens you have, the more voting power you have. Simple. EOS is a well-known example of a former ERC-20 token that featured this(however it has since moved on its own blockchain).

Value exchange-This is one of the more common roles of tokens within the ecosystem. Tokens can help create an internal economic system within the DApp.

User experience enhancement-Tokens can give benefits to the owners of them. For example, Brave gives the holder of BAT tokens the ability to sponsor content creators.

Currency-This one is obvious

The problem with ERC-20 tokens

In the early days of ERC-20, it seemed like every ICO was just repeating a basic idea or "reinventing the wheel", if you want. Each of these tokens has its own features and functions. To create a healthy ecosystem, it is absolutely essential that the DApps interact seamlessly with one another. However, what will happen if we have two tokens, say Token Alpha and Token Beta, and both of them have different smart contract structures? For this, the developers of each token will have to interact with each other during development and explain how these tokens are going to work together. However, this had a problem.

If there are 100 different tokens with 100 different contracts, then to narrow down on all the qualifications and conditions required to make sure that transfers can go through between all these tokens will need a humongous amount of complex calculations. Which is not an ideal scenario at all.

Something needed to be done and on November 19, 2015, Fabian Vogelsteller came up with an ingenious solution.

Rules of ICOs

To allow the tokens to interact with one another, there are a set of 3 optional rules and 6 mandatory rules that every ERC-20 token had to follow. 

The optional rules:

Token name: Every token has to have a name 

Token symbol: Each token has to have an identifier. For example, it is much easier to remember OMG than OmiseGo if you're brand new to it. 

Decimal places: Each token needs to state how many decimal places it uses. For example, if the token was limited to 3 decimal places, then the minimum transaction amount would be 0.001 tokens.

The mandatory rules:

The total supply: Each token has to state the total supply of the tokens. 

The balanceOf function:The balanceOf function returns the number of tokens that a particular address, in this case, the contract owner, has in their account.

The approve() function: Once the balance has been checked, the contract owner can give their approval to the user to collect the required number of tokens from the contract’s address. The approve function also checks the transaction against the total supply of tokens to make sure that there are none missing or extra. In other words, it makes sure that counterfeiting is impossible.

The transfer() function:

So, now that all the checking has been done and the contract knows that the user has the required amount of tokens needed to fulfill the transaction, the contract owner can send them tokens using the transfer() function.

This function lets the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction., allows a certain number of tokens to be transferred from the total supply to a user account. Before the game can start, the players must receive their token from the dealer.

The transferFrom() function: This allows users to set up automatic payments like bills and rent.

The allowance() function: This function checks if the sender has enough tokens to send the transaction

Benefits of ERC-20

Convenience: Since the tokens all have the same basic structure, interaction between different tokens is easier. 

Easy development: Since the ERC20 regulations present a proper blueprint for developers to follow, it is easy for them to come up with tokens instead of working from scratch.

Liquidity: If these tokens are active and interacting with one another, this is going to bring more tokens and more users to Ethereum. 

Flaws of ERC-20

The transfer() bug:

Even though ERC20 tokens have a lot of good qualities, they have garnered plenty of criticisms as well. In Ethereum, there are two kinds of accounts, externally owned accounts (EOA), controlled by private keys, and contract accounts, controlled by their contract code.

If you want to interact with another EOA account then you can use the transfer() function to send the required tokens. However, if you want to send the tokens to a contract account using the transfer() function, then you will be facing a bug which has led to the loss of nearly millions of dollars.

The big problem with the transfer() function is that once it is executed the recipient will not be notified of the transfer even if the transaction goes through successfully

A developer who goes by the name of “Dexaran” was the one who brought this to everyone’s attention.

The easy development: The easy development of these tokens is also their flaw. Scammy businesses will be able to create these tokens more easily.

 

However, let's not criticize the ERC-20 idea. It is a step in the right direction, and will revolutionize cryptocurrency.

###############THE GIVEAWAY#################

For those of you who came directly to this section for the giveaway, this article is not recommended for you.

The giveaway is all about appreciating the hard work of underrated users. As the internet grows, there have been an increasing number of spammy posts that are short and contribute little. This is not good. We must do everything in our power to ensure that all content is relevant and insightful.

That is why I have decided to give away $0.25 (or more, it depends)in BCH to every user that posts an interesting and relevant blog post. Rules:

-You MUST be a new user(you joined March 2020 or later)

-You have to be a "small" blogger(the rules of this are pretty lax, I know)

-You have to post a blog post that is interesting and teaches people something.

-Comment down below with your post and your BCH address and I will manually review every submission and give you BCH if I like it. 

 

Thanks for reading! If you liked this post, then please hit that Like button and tip so that this giveaway doesn't get buried. 

How do you rate this article?

12


thecryptoguy123
thecryptoguy123

Hi, I am a new blogger. I am keen to share knowledge for all of us to know.


Ultimate guide to earn money
Ultimate guide to earn money

This blog teaches you how to earn money. It also recommends to you what you shouldn't do to earn money. Don't expect to make a living, but these tips will help you earn a little more(and even side income, it depends how successful you are)

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.