Skip to content

Instantly share code, notes, and snippets.

@ryanschneider
Last active February 5, 2021 19:54
Show Gist options
  • Save ryanschneider/723d8e2bce0829de9d6beb43639b6d3e to your computer and use it in GitHub Desktop.
Save ryanschneider/723d8e2bce0829de9d6beb43639b6d3e to your computer and use it in GitHub Desktop.
EIP-2718/EIP-2930 JSONRPC Changes "Proto-EIP"

EIP-2718/EIP-2930 JSONRPC Changes "Proto-EIP"

These are my notes with my view on what changes are needed to properly expose EIP-2718 types and EIP-2930 access lists for consumption via Ethereum JSONRPC.

Affected JSONRPC Methods and Rationale

RPCs returning a transaction receipt

  • eth_getTransactionReceipt

At a minimum I believe this RPC needs to return the type of the transaction. I'm unaware of a need for the EIP-2930 access list to be included.

RPCs returning a single transaction object

  • eth_getTransactionByBlockNumberAndIndex
  • eth_getTransactionByBlockHashAndIndex
  • eth_getTransactionByHash

I believe these RPCs should return the type for all transactions (after the EIP-2718 block), and the access list for all EIP-2930 transactions.

IMO the type is necessary to assist downstream parsers in decoding the other JSON fields. Without a type field, decoders need to resort to tricks like detecting the presence of certain keys to ascertain the type, which also precludes future types from reusing the same field names.

RPCs returning all transactions in a block

  • eth_getBlockByHash
  • eth_getBlockByNumber

For consistency, it is my opinion that the JSON format for the transactions list matches the JSON schema for single transaction RPCs above (when the "return full transactions" boolean parameter is true)

RPCs unchanged by these EIPs

All other RPCS, most notably:

  • eth_getUncleByBlockNumberAndIndex
  • eth_getUncleByBlockHashAndIndex
  • eth_getUncleByBlockNumberAndIndex

These RPCs are not affected because these RPCs only return the block headers, not the included transactions.

Format of new fields

  • type: QUANTITY - The type of the transaction, only included on chains adopting EIP-2718. Type 0x0 refers to "legacy" transactions, all other types are defined in later EIPs.
  • accessList: Array of access list items. Only included on EIP-2930 transactions of type 0x1.
  • Access list items are a JSON object with these fields:
    • address: DATA, 20 bytes. The address being accessed.
    • storageKeys: Array of DATA, 32 bytes each. The storage location being accessed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment