ERC20 vs ERC777 | Quick Understanding and why ERC777 is not being used
Tags: ethereum, blockchain, smartcontracts
Published: 2020-02-15 07:00:55

#Why not ERC777?

_*Assumption*_: This is one of my short and quick articles.  There is a assumption over here that you (the reader) is aware of Blockchain, Ethereum, Solidity and Tokens.  If you do not understand these terms this article will not be of much help to you.  You should dig-up these terms and possibly come back over here.

##Background

The Ethereum blockchain is filled with tons and tons of _*tokens*_.  Pretty much every _*fungible*_ token is as per the ERC20 Standard (some of them may be ERC223, which is an extension of the ERC20 token standard).  

I have been working with loads of such tokens at [DeFiZap.com](defizap.com).  One of the biggest issue that an ERC20 Token has is that it lacks (of what I would call) hooks / event triggers.  Let me explain through an example below:

If Alice were to send Ether to a Smart Contract, the Smart Contract will be made aware of this incoming Ether (through various functions).  This _*made aware*_ nature of the Ether within the Ethereum blockchain is what I call, hooks / event triggers.

However, if Alice were to send [Dai](https://coinmarketcap.com/currencies/multi-collateral-dai/) to a Smart Contract; the Smart Contract will NOT be made aware of this transfer.

### Why not made aware?

To understand why the Smart Contract will NOT be made aware, we will have to understand ONE of the CORE ideas of an ERC20 Token. The long story short version is that the word 'transfer' is actually the root cause (that is how I see it).  

Essentially, an ERC20 Tokens does not literally move from one wallet address to another (or smart contract to smart contract); only the _*so-called*_ owner of the ERC20 is changed inside the Smart Contract that is the issuer of the ERC20.  In simple sense, if someone in Monaco has allocated a Ferrari in my name, a transfer would just be like the Ferrari stays there, only the name of the owner of that Ferrari is changed from my name to (lets say) Spider-Man.  Now, sadly our dear Friendly Neighbourhood Spider-Man was not informed of this and thus, was NOT made aware.

###So what is the issue with that?

As is the case above, since Spider-Man did not know, he did not come to collect the car and drive it off to his own world.  Same way, if the Smart Contract or a Wallet is not aware that is owns the ERC20 Token it cannot do anything.

###What would the Smart Contract do with it anyway?

While there are tons of uses, one of the most common is to swap it for something else.  For eg, converting [Dai](https://coinmarketcap.com/currencies/multi-collateral-dai/) to [cDAI](https://medium.com/compound-finance/compound-multi-collateral-dai-57b803f86cc9).  

###HackyWay used currently?

The way the above _*made aware*_ is currently resolved is (a) allowing the cDAI Smart Contract to use the DAI that I own (through a function known as _*approve*_) and (b) informing cDAI (through a function call) that you are now approved to use my DAI, please take it, swap it and issue cDAI to me (and literally, to my name in your ownership register).  That means two (2) transactions.

###What is the issue?

Bluntly, I do not like 2 transactions.

###Why ERC777?

Easy to guess, similar to ERC20, ERC777 is also a standard for developing tokens on the Ethereum Blockchain.  The standard has built in provisions for the _*made aware hooks*_.

###Adoptability

Now, since the first time I read about ERC777 I fell in love with it.  I design Smart Contracts that deal with ERC20 and as of now, I have to keep asking my users to approve my smart contract address first and then call a function my smart contract that will do what they need to do.

Hence, I was so much pushing for all token designers to look into ERC777 and use that standard.  The odd part is that the standard has been in out since 2017 and yet not 1 token in the market uses ERC777.  This made me wonder _*why*_, till obviously, I went ahead to work on my own ERC777.

###Answer

ERC777 is a larger and comprehensive scheme. One of the drawback of gaining the functionality of the hooks / event triggers is the manner in which the recipient smart contract is designed.  Essentially, the recipient smart contract (note!!!, it this drawback is only applicable to smart contracts and NOT to EOA wallets)need to have a function which will listen to such transfer.

Sadly, the world has moved on and no-one in the legacy smart contract world ever designed their contracts with this functionality.  Now, since those contracts are not upgradable, they will never be in compliant with ERC777 standard.  Thus, with that said, we now know why no one is using the powerful, yet powerless ERC777 coin standard.