header-langage
简体中文
繁體中文
English
Tiếng Việt
Scan to Download the APP
Partnered With:

A Brief Analysis of Ethereum EIP-2718

Read this article in 7 Minutes
This article gives you a brief overview of Ethereum EIP-2718
原文标题:《 New Transaction Types on Ethereum 》
Original source: Maartenzuidhoorn, Mycrypto
原文编译:闵敏 & 阿剑 ,以太坊爱好者





Ethereum uses different transaction types to define different operations, such as sending Ethereum to an address, deploying contracts, and so on.


Prior to the recent Berlin upgrade, there were mainly four different transaction "types" in Ethereum:


· General transactions with recipient's address and data fields

· The data field of a contract deployment transaction without the recipient's address is filled in with the contract code

, signature & have spent v  Transaction with value that does not contain chain ID (before EIP155)

, signature & have spent v  Transaction whose value contains chain ID    


The above transaction types all take the same format. Different Ethereum clients, libraries, and other tools must analyze each transaction to determine which type it belongs to. These four different transaction types introduce a lot of complications. We need to look at all the fields of a transaction to determine the type it belongs to. This was a major challenge that people had to face when proposing new transaction types such as meta-transactions, multi-sign transactions, and so on, until EIP 2718 came along.


Ethereum now has a new Transaction standard Typed Transaction Envelope, constructed by   EIP 2718  The proposer of NBSP; Micah Zoltu  Definition. The standard lays the foundation for a number of new and upcoming features on Ethereum. In this article, we will review some of the standards introduced in the Berlin upgrade and others that may be introduced in the future.


Standardized transaction envelopes & NBSP;  


In the past, transactions on Ethereum were all in the same format. Each Ethereum transaction has six fields: nonce, gasprice, gaslimit, to address, value, data, v, r, and s. These fields need to go through   RLP code, as shown below:


RLP([nonce, gasPrice, gasLimit, to, value, data, v, r, s])


EIP 2718  A new generic envelope has been defined for typed transactions. Under the new standard, the transaction looks like this:


TransactionType || TransactionPayload


The above fields are defined as follows:


· TransactionType: A value in the range 0 to 0x7f that can represent up to 128 transaction types.

· TransactionPayload: Any byte array defined by the transaction type.    


  Join (merge) the above fields to get a typed transaction. EIP 2718  No format is defined for the transaction payload. Therefore, the payload of a transaction can be any sequence of encoded bytes, as long as the transaction is used in accordance with the new transaction type (such as RLP, SSZ  Etc.) can be defined by the encoder. The simple byte concatenation approach was chosen because reading the first byte of a byte array is simple, without the use of any libraries or tools. That is, you do not need to use an RLP or SSZ parser to determine the transaction type.


This approach avoids adding complexity to existing transaction formats when new EIPs introduce new transaction types, and makes it easier for different Ethereum tools (clients, libraries) to distinguish between different transactions.


On the point of increasing complexity, Is a good example of this. It protects against replay attacks by introducing chain IDs into transactions. Since adding a new field to the transaction parameter would break backward compatibility, the chain ID is encoded into the recovery parameter (V) of the transaction signature, as I explained in my last article on digital signatures. After implementing EIP 2718, we can define new transaction types without affecting backward compatibility.    


Backward compatibility and traditional transactions


A major feature of the EIP 2718 is backward compatibility. The EIP 2718 is fully backward compatible. That is, existing tools, libraries, (hardware) wallets, and transactions are available right out of the box, but they cannot take advantage of the new "functionality" provided by EIP 2718 (and by adopting the EIP 2718 standard). New transactions on the Ethereum network can still use the old transaction format (i.e., traditional transactions).


The number of new transaction types is up to 0x7f. This upper limit was chosen to ensure backward compatibility with traditional transactions. The first byte of an RLP-encoded transaction is always greater than or equal to 0xC0, so typed transactions never conflict with traditional transactions, and typed and traditional transactions can be distinguished by the first byte.    


EIP 2718 itself does not define any transaction types, but a number of EIPs have emerged that adopt this new standard:


· EIP 1559: Reform of the transaction fee market for the ETH 1.0 chain. I'm sure you've heard of this EIP.

· EIP 2711: Payment transactions, deadline transactions and bulk transactions. This EIP was also proposed by Micah Zoltu, and the standard defined in EIP-2718 was created for this purpose.

· EIP 2930: Optional access list.    


We will explain some of these standards in detail below.    


Why introduce a new transaction type?


The new transaction type enables the integration of functionality that would otherwise have required Solidity contracts or third-party solutions. Take a deadline transaction as an example. In an existing solution, you can send funds to a Solidity contract, sign a transaction and send it to a dedicated node, allowing the transaction to take additional parameters (for example, expiration date). The node then processes the transaction, ensuring that it is executed before the expiration date, otherwise the transaction will not be broadcast. Some dApps and contracts (such as Uniswap) have this feature built in, but it is difficult to implement for most transactions.


EIP 2711 can add this functionality to the Ethereum network while ensuring backward compatibility with traditional transactions (as described above), without the need for smart contracts or dedicated nodes. However, EIP 2711 is still a draft, and we are not sure if it will be implemented on the Ethereum network in the near future. It is also possible that EIP 2711 will be split into several smaller EIPs (e.g. The EIP 3074).    



  - Source: F2Pool -& NBSP;  


A new transaction format proposed by EIP 1559


In EIP 1559, there was a big change in the way gas worked: it was partially destroyed and no longer paid to the miners in full. This article won't go into the details of all the changes to EIP 1559, but EIP 1559 does introduce a new transaction format:    


0x02 || RLP([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, signatureYParity, signatureR, signatureS])   


The most notable changes include:


· Replace the gas price with "Max & NBSP; Priority  Fee per Gas" and "Max Fee per Gas".

· The chain ID is individually encoded and is no longer included in the signature V value. This is actually a simpler implementation instead of EIP 155.

· The signature V value becomes a simple check bit (the "signature Y check bit"), either 0 or 1, depending on which point on the elliptic curve is used.    


EIP 1559 also provides a way to specify access lists based on EIP 2930. This reduces the gas cost of the transaction.


Because EIP 1559 dramatically changes the way gas charges operate, it is not directly compatible with traditional transactions. To ensure backward compatibility, EIP 1559 proposes a way to upgrade traditional transactions to EIP 1559 compatible transactions by using "Maximum Priority Cost per Unit of Gas" and "Maximum Cost per Unit of Gas" instead & NBSP; "Gas prices."    


Native-element transactions and bulk transactions


Meta-transactions have been around for a few years, but until now they relied on smart contracts. Like a time-limited transaction, a metatransaction requires the user to send ethereum to a smart contract created specifically for the metatransaction.


EIP 2711 enables primitive transactions (also known as paid transactions) and bulk transactions without relying on smart contracts. A new transaction format is defined, and the transaction type is   0x02 (but the transaction type may change, since EIP-1559 is also identified with the same transaction type). The transaction is as follows:    


0x02  ||  RLP([...SenderPayload, ...SenderSignature, ...GasPayerPayload, ...GasPayerSignature])   


EIP 2711 mainly includes the payload (optional) and signature of the GAS payer (the account used to pay the transaction gas fee). In this way, ERC 20 tokens can be sent even from an address that does not hold any Ethereum.


The payload and signature of the sender are defined based on the transaction subtypes (1 through 4). For example, if the transaction type is   1, The sender's payload is defined as:    


[1, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit, gasPrice]   


ChildTransaction  Is defined as   [to, value, data], you can specify the receiver address, value, and data within a single transaction. For example, ChildTransaction  Can be used to call the   of ERC 20 in a single transaction; approve  And & have spent TransferFrom.


If you want to learn more about the transaction subtypes of EIP 2711, I recommend you read it. The specification for EIP 2711.    


conclusion


Typed transactions bring more possibilities to the Ethereum network. We create typed transactions without adding complexity to Ethereum clients, libraries, and other tools.


Currently, since EIP 2718 has only recently been added to the network, the new transaction types are not widely used, but there are some great EIPs under development, such as EIP 2711, which offers time-limited transactions, batch transactions, and payment transactions (that is, meta-transactions). Since new transaction types can be defined on Ethereum, it will also be easier to propose new EIPs.


MyCrypto original link
Original translation link


Welcome to join the official BlockBeats community:

Telegram Subscription Group: https://t.me/theblockbeats

Telegram Discussion Group: https://t.me/BlockBeats_App

Official Twitter Account: https://twitter.com/BlockBeatsAsia

举报 Correction/Report
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit