Compatible with the most common token protocols: Who is the best choice for transaction costs and environment?

When it comes to Ethereum, the first keyword that appears in our minds may be “gas fee”. Nowadays, the mainnet of major blockchain projects is online, and the propaganda direction used is often inseparable from the word gas.

High gas fees have always been a pain point for blockchain transactions, especially for investors who wander in various fields of the currency circle.

With the increase of blockchain projects and the expansion of the market size, the number of transactions on the blockchain and the average gas consumption of transactions also increase.

Compatible with the most common token protocols: Who is the best choice for transaction costs and environment?

Gas price historical data in Gasnow

Recently, with the ups and downs of the market, mainnet upgrades, Layer 2 solutions and other factors, the gas fee of the blockchain network led by Ethereum has continued to decline.

In addition to the above factors, can it be possible to reduce the number of transactions necessary to complete a specific function from the perspective of code or smart contract design, so as to optimize the transaction cost and environment of the project and the entire blockchain ?

Today this article will introduce you to this topic: compare several protocols that are compatible with the most common token protocol ERC20, including ERC777, ERC1363 and ERC2612.

This article will help you find the best choice by analyzing the number of transactions required for token transfer operations in several protocols!

ERC20

Currently, two steps are required to complete the transfer operation of ERC20 protocol tokens: approve() and transfer()/tranferFrom().

Therefore, it must be divided into two transactions and paid for two Gas: that is, the first transaction completes the authorization and the second transaction completes the transfer. 

In order to solve the “two-step” problem, the current main proposals are ERC777, ERC1363 and ERC2612, of which the first two have been improved, and ERC2612 is still in the optimization stage.

The main participants in ERC20 are the sender of tokens and the receiver of tokens.

In the following, we will take Alice as the token sender and Bob as the token receiver as an example to visually show you a brief flow chart of the operation.

Compatible with the most common token protocols: Who is the best choice for transaction costs and environment?

Brief flow chart of ERC20 token transfer operation

ERC777

ERC777 tries to introduce the concept of operator to avoid the “two-step” problem.

After the operator is authorized by the sender, in the ERC777 token contract, the sender can send the tokens to the receiver through the operator.

In the transaction of sending tokens, the sender does not need to pay gas, and the gas for sending the token transaction will be paid by the operator.

Compatible with the most common token protocols: Who is the best choice for transaction costs and environment?

Brief flow chart of ERC777 token transfer operation

ERC1363

ERC1363 introduces advanced functions inspired by approve(), transfer() and tranferFrom() in ERC20: approveAndCall(), transferAndCall() and transferFromAndCall().

These functions can help the ERC1363 protocol contract continue to execute the onApprovalReceived() method of the smart contract at the sender address and the onTransferReceived() method of the smart contract at the receiver address after completing the approve(), transfer() or tranferFrom().

In this way, the approve and transfer or any other code that the sender or receiver wants to execute are linked into a transaction.

Compatible with the most common token protocols: Who is the best choice for transaction costs and environment?

Brief flow chart of ERC1363 token transfer operation

ERC2612

ERC2612 adopts the method of user signature for approve, and the signature contains the address and quota of the approve.

The user submits the signature to the ERC2162 standard contract, and then the ERC2162 standard contract verifies the signature, obtains the address and quota of the approve from the signature, and uses the information obtained by the verification to directly trigger the transferFrom operation after the verification is successful, and the final solution is The “two-step” problem .

Compatible with the most common token protocols: Who is the best choice for transaction costs and environment?

Brief flow chart of ERC2612 token transfer operation

Written at the end

After comparing these types of agreements, we found that:

From the perspective of the number of transactions required to complete the token sending, ERC1363 and ERC2612 are definitely more suitable choices, among which ERC2612 is more flexible than ERC1363. At the same time, ERC777, ERC1363 and ERC2612 are compatible with ERC20 type contracts, so there is no problem caused by compatibility.

With the increase of blockchain smart contract projects, the total number of waiting transactions generated within a single block time will increase accordingly.

If the total number of waiting transactions that need to be packaged into the block to complete the function can be reduced through the protocol code level , it will be of great help to the average transaction speed and average gas cost on the blockchain.

The optimization of transaction costs and the environment will not only promote the prosperity of the blockchain network, but also improve the blockchain ecology and infrastructure.

Posted by:CoinYuppie,Reprinted with attribution to:https://coinyuppie.com/compatible-with-the-most-common-token-protocols-who-is-the-best-choice-for-transaction-costs-and-environment/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.

Like (0)
Donate Buy me a coffee Buy me a coffee
Previous 2021-07-22 10:31
Next 2021-07-22 10:33

Related articles