Home >web3.0 >What is the ERC standard for Ethereum smart contracts?

What is the ERC standard for Ethereum smart contracts?

DDD
DDDforward
2024-03-06 14:28:531292browse

In the encryption industry, we often see ERC in reports, so what is ERC? Let’s talk to you today.

01
Smart Contract

Before talking about ERC, let me first introduce you to smart contracts. The concept of smart contracts was first introduced in Proposed by Nick Szabo in 1994. He defined: A smart contract is a computerized transaction agreement that executes the terms of a contract.

What is the ERC standard for Ethereum smart contracts?

The smart contract comes from the vending machine in life, when the customer goes to the vending machine After you put money into the vending machine, the vending machine starts working. What does a smart contract look like? Take smart contracts in Ethereum as an example. Each smart contract in Ethereum has its own account, just like a vending machine has its own ID. When an external account uses a certain tip to call the smart contract it selected, After that, it is equivalent to turning on the automatic control switch, and the smart contract will automatically execute according to its own code definition.

But unlike a vending machine, Once a smart contract is created, its code cannot be changed, and the door cannot be opened by staff like a vending machine. Then put the goods in.

The immutable advantage of smart contracts makes it naturally suitable for contract clause scenarios. It can effectively reduce malicious tampering and reduce manual intervention. For example, a bank-like smart contract can be written on Ethereum, and then people can deposit and withdraw money through this contract. In this way, there will be no balance imbalances caused by errors or malicious changes by bank staff.

In fact, the money stored in this "bank" smart contract is not necessarily ETH, because the Ethereum smart contract also allows contract developers to define their own currencies, which are all the currencies we know. A kind of Token based on Ethereum, such as USDT, NBN, etc.

In this way, it seems that smart contracts have provided a new idea to people from all walks of life. Everyone is thinking about whether they can develop some new projects based on smart contracts and issue their own Tokens? Smart contracts are certainly possible, but they must be carried out in accordance with prescribed procedures. So in order to effectively prevent all kinds of miscellaneous Tokens, data, etc. from appearing on the platform, it has its own set of standards.

02
ERC Standard

What is the ERC standard for Ethereum smart contracts?

##The full name of ERC is "Ethereum Request for Comment", which means the Ethereum version of the solicitation draft. ERC contains technical and organizational precautions and standards. This set of standards is actually proposed not only by Ethereum officials, but also by some Ethereum enthusiasts.


Taking the bank smart contract mentioned earlier as an example, it is not difficult to imagine that it will have the following functions and instructions:

1. Every customer needs to be recorded balance;

2. It needs to have the function of transferring money, including depositing and withdrawing money;

3. It is necessary to ensure that each customer can check his or her balance.

If you think about the above functions and instructions carefully, it seems that every "bank" contract needs to have it, and it is also what the Token contract needs to have.

Therefore, in order to be better compatible with wallets and trading platforms , Ethereum has issued Token protocol standards such as ERC20 and ERC721.

For example, Amao Coin and Agocoin are both issued based on the ERC20 standard, so they will provide users with some selection buttons (that is, the interface functions are consistent). These selection buttons are for users to check balances, transfer Tokens, etc., but Amao Coin The bottom layer of Dogecoin and Dogecoin can implement functions such as balance inquiry and token transfer in different ways.

In addition to the Token contract that needs to be standardized, others including but not limited to the design of data packages, the definition rules of some interfaces, etc. also have some ERC standards. Some of these standard protocols come from the Ethereum founding team, and some come from proposals by Ethereum enthusiasts and contributors. Overall, it’s all about working together to create a better Ethereum environment.

Therefore, interested partners can also put forward some suggestions and make their own contributions based on some shortcomings or areas worthy of innovation in the Ethereum smart contract.

The above is the detailed content of What is the ERC standard for Ethereum smart contracts?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zhihu.com. If there is any infringement, please contact admin@php.cn delete