HackMD
    • Sharing Link copied
    • /edit
    • View mode
      • Edit mode
      • View mode
      • Book mode
      • Slide mode
      Edit mode View mode Book mode Slide mode
    • Note Permission
    • Read
      • Only me
      • Signed-in users
      • Everyone
      Only me Signed-in users Everyone
    • Write
      • Only me
      • Signed-in users
      • Everyone
      Only me Signed-in users Everyone
    • More (Comment, Invitee)
    • Publishing
    • Commenting Enable
      Disabled Forbidden Owners Signed-in users Everyone
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Invitee
    • No invitee
    • Options
    • Versions and GitHub Sync
    • Transfer ownership
    • Delete this note
    • Template
    • Save as template
    • Insert from template
    • Export
    • Google Drive Export to Google Drive
    • Gist
    • Import
    • Google Drive Import from Google Drive
    • Gist
    • Clipboard
    • Download
    • Markdown
    • HTML
    • Raw HTML
Menu Sharing Help
Menu
Options
Versions and GitHub Sync Transfer ownership Delete this note
Export
Google Drive Export to Google Drive Gist
Import
Google Drive Import from Google Drive Gist Clipboard
Download
Markdown HTML Raw HTML
Back
Sharing
Sharing Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
More (Comment, Invitee)
Publishing
More (Comment, Invitee)
Commenting Enable
Disabled Forbidden Owners Signed-in users Everyone
Permission
Owners
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Invitee
No invitee
   owned this note    owned this note      
Published Linked with GitHub
Like BookmarkBookmarked
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Typed Transactions ## Relevant EIPs * [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718): Typed Transactions * [EIP-2972](https://eips.ethereum.org/EIPS/eip-2972): Wrapped Legacy Transactions * [EIP-2976](https://eips.ethereum.org/EIPS/eip-2976): eth/##: Typed Transactions over Gossip * [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930): Optional access lists * [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559): Fee market change for ETH 1.0 chain * [EIP-2711](https://eips.ethereum.org/EIPS/eip-2711): Sponsored, expiring and batch transactions. ## What Has No Objections * Typed transactions are desirable. * 2718 is a good way to achieve typede transactions. * 2930 should be a typed transaction. * 1559 should be a typed transaction. * 2930 should go into Berlin. * 2718 should go into Berlrin. * It would be nice to have a single way of processing transactions across the codebase. ## Micah's Preference *As the author of this document, I am recording my preferred path to Berlin here* * All transactions are SSZ serialized both for hashing, transport, and merklization. * Legacy transactions are included in blocks and sent over the wire in SSZ format, but for the purpose of signing they are first re-encoded as `rlp(keccak256(tx))` to maintain signature compatability. * We solve the problem of transient dual-hashing in the clients * simplest solution is to just provide a bad UX around the fork block * better solution is to store both hashes (legacy and new) in memory for about a week around the fork block so users can lookup transactions that were submitted prior to the fork but mined after the fork **Caveat** All SSZ libraries need to implement Unions (not currently the case since it isn't used for beacon chain) for this to work well! ## Path of Least Resistance *The author of this document believes this solution is least likely to get negative pushback from core devs* * Legacy Transactions are Typed Transactions with type of `0xf8 || 0xf9 || 0xfa`. * Legacy Transaction IDs (hashes) continue to be generated as they are today (`keccak256(rlp(transaction))`). * We assert that Legacy Transaction support will be dropped in 2 years. * All new transaction types (e.g., 2930, 1559, etc.) are SSZ serialized. * All new transaction IDs (hashes) are SSZ merkle roots. * Merklization and transport continues to use RLP lists, since we cannot define an SSZ container that is backward compatible with legacy transactions of type `0xf8` to `0xfa` ## Problems ### Legacy Transactions **Legacy Transaction**: A transaction that uses the signing process and transaction structure from the yellow paper, with or without EIP-155. **Problem**: We cannot immediately drop support for legacy transactions because tooling across the ecosystem only knows how to sign legacy transactions. **Potential Solution**: Wrapped legacy transactions. This allows us to make everything a typed transaction, and get rid of some of the EIP-155 complexity currently present in wrapped transactions. **Problem**: Wrapped legacy transactions have a dual hash problem (see [Hashing](#TransactionReceipt-Hashing) below). **Potential Solution**: An RLP encoded legacy transaction can only (realistically) have 3 leading bytes (0xf8, 0xf9, 0xfa). We could assert that with the introduction of 2718 there are 3 new types of transaction -- 0xfa, 0xf9, 0xfa -- and the mechanism for decoding the payload would be something like `rlp_decode([0xfa, ...payload])` which is in contrast to `rlp_decode(payload)` or `ssz_decode(payload)`. This way, all of the code could more or less pretend that legacy transactionts are typed transactions. ### SSZ **SSZ Serialization**: A new serialization format that would replace RLP. **SSZ Merkleization**: A mechanism for turning an SSZ Serialized payload into a merkle tree that can be done recursively such that you can get merkle proofs from the tree root (e.g., head block hash) down to any child (e.g., the log of a particular transaction receipt from 3 million blocks ago) There seems to be weak consensus that SSZ is desired long term for Ethereum and it brings some great features around proofs if we can get to a place where the entire block uses SSZ all the way down. There already exist a bunch of SSZ libraries for many languages due to its usage in ETH2 and the beacon chain. **Problem**: If we plan to move to all SSZ blocks at some point, anything we add that isn't SSZ is tech debt. **Problem**: Integrating SSZ into clients will take time, and we would like to release Berlin sooner rather than later. ### Transaction/Receipt Hashing We need a unique identifier for transactions in `transactions_root` and we need a UID for receipts in `receipts_root`. We also use these same UIDs for gossip to identify what each peer needs before sending data. These UIDs should be generatable from the transaction/receipt (e.g., a hash). Currently we do `keccak256(rlp(transaction))` and `keccak256(rlp(receipt))` to achieve this, but SSZ merkleization would also achieve this. **Problem**: If we want the UID generation process for all transactions to be the same, and the UID generation process for all receipts to be the same after the fork block, then legacy transactions will have a different UID before and after the fork block. This means that if someone submits a transaction to a node before the fork block, it will have a different UID before and after the fork block. Also, gossip gets weird around the fork block as the fork block propogates and clients are in a mixed state of whether they are using new or old UIDs. **Potential Solution**: Clients internally index transactions within 7 days (arbitrary) of the fork block by both UIDs so users can lookup by either. This adds notable complexity to clients, but it is complexity that can be deleted later. **Problem**: Tooling that calculates transaction hashes itself must be updated. **Potential Solution**: Legacy transactions are hashed the old way, new transaction types use a new UID generation process. **Problem**: We have to deal with multiple mechanisms of UID generation until such time as we can deprecate legacy transactions. --- ## Proposed Long Term Target Sometimes it helps to imagine a future we desire, and then figure out the best path for getting there. There are significant benefits in terms of light clients and proofs if we can get to an all SSZ block. We also benefit from notable simplification of the various client codebases if we no longer have to support/propogate legacy transactions. Gossip over things like UDP (with limited packet size) also benefits if we can do SSZ merklization of transactions and receipts as a partial payload can be proven to be part of the larger whole payload. As a thought experiment, if we were to switch over to fully SSZ merklized blocks in the fork after Berlin, how much pain would we be taking on by choosing any of the paths outlined above? * Would we be causing ourselves significant difficulty by choosing to keep legacy transactions unwrapped in Berlrin? * Would we be causing ourselves significant difficulty by choosing to use `keccak256(rlp(transaction))` as the UID generation mechanism for transactions and similarly for receipts? * Would we be causing ourselves significant difficulty by introducing new transaction types that are RLP encoded internally, knowing that in the next fork we'll just have to drop support for that transaction and re-introduce it with a new format?

Import from clipboard

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lost their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.


Upgrade

All
  • All
  • Team
No template.

Create a template


Upgrade

Delete template

Do you really want to delete this template?

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Sign in via SAML

or

Sign in via GitHub

Help

  • English
  • 中文
  • 日本語

Documents

Tutorials

Book Mode Tutorial

Slide Example

YAML Metadata

Resources

Releases

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions

Versions and GitHub Sync

Sign in to link this note to GitHub Learn more
This note is not linked with GitHub Learn more
 
Add badge Pull Push GitHub Link Settings
Upgrade now

Version named by    

More Less
  • Edit
  • Delete

Note content is identical to the latest version.
Compare with
    Choose a version
    No search result
    Version not found

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub

      Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

       Sign in to GitHub

      HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Available push count

      Upgrade

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Upgrade

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully