Module Evm_node_lib_dev.Transaction_object

type t

A transaction object value to be returned to users through the RPC server.

The EVM kernel always stores legacy transaction objects, even for transactions using a more recent format (like EIP-1559).

A single access list entry as introduced by EIP-2930. Each entry specifies an address and a list of storage_keys that the transaction plans to access.

A single authorization item as introduced by EIP-7702. Each item authorizes an address to act on behalf of a signer and includes the signature components y_parity, r, and s.

Transaction metadata

hash t returns the hash of the transaction t.

block_number t returns the number of the block containing the transaction t, if known.

block_hash t returns the hash of the block containing the transaction t, if known.

val transaction_index : t -> Evm_node_lib_dev_encoding.Ethereum_types.quantity option

transaction_index t returns the index of the transaction t within its block, if known.

chain_id t returns the chain ID associated with the transaction t, if present. This function may fail when applied to legacy transactions whose format does not include or allow reconstruction of the chain ID. In such cases, the information cannot be retrieved from t.

Participants and addresses

sender t returns the sender address of the transaction t.

to_ t returns the recipient address of the transaction t, if present. It is None for contract creation transactions.

Execution and gas

nonce t returns the nonce of the transaction t, i.e. the number of transactions previously sent from the sender.

gas t returns the gas limit specified by the transaction t.

gas_price t returns the max fee per gas or its equivalent. For legacy and EIP-2930 transactions this is the actual gas price. For EIP-1559 and EIP-7702 transactions this is max_fee_per_gas, which is an upper bound rather than the effective gas price.

value t returns the amount of Ether transferred in the transaction t.

Payload and advanced features

input t returns the calldata (data payload) of the transaction t.

val access_list : t -> access list

access_list t returns the access list attached to the transaction t, if present. It is available for EIP-2930, EIP-1559, and EIP-7702 transactions.

val authorization_list : t -> authorization_item list

authorization_list t returns the authorization list attached to the transaction t, if present. It is available for EIP-7702 transactions.

Decoding and helpers

val decode : string -> t Tezos_base.TzPervasives.tzresult

decode raw_txn decodes a raw RLP-encoded transaction string raw_txn into a transaction object t. The transaction type (Legacy, EIP-2930, EIP-1559, or EIP-7702) is inferred from the first byte of raw_txn.

val is_eip7702 : t -> bool

is_eip7702 t returns true if the transaction t is an EIP-7702 transaction, and false otherwise.

val authorization_signer : authorization_item -> (Evm_node_lib_dev_encoding.Ethereum_types.address, string) Stdlib.result

authorization_signer item recovers the signer address from an EIP-7702 authorization_item. This is done by hashing the authorization message according to the EIP-7702 specification and recovering the public key from the signature components contained in item.

Internal representation used to satisfy txpool_content requests. A txqueue_content groups transactions known into two categories, organized by sender address and nonce:

  • pending: transactions ready for execution
  • queued: transactions valid but not yet executable

This type is not used internally by the tx queue logic itself. It only exists to provide response data to txpool_content queries.

Encoding for txqueue_content. Used by txpool_content RPC responses.

Reconstruction

from_store_transaction_object obj does not attempt to reconstruct obj to be compliant with its original format, but instead returned the stored data as if it was legacy.

block_from_legacy block folds over the transactions of block, assuming they are indeed legacy (see from_store_transaction_object).

reconstruct blueprint_payload obj reconstructs the full transaction object from the raw transaction of obj stored in blueprint_payload.

Fails if blueprint_payload is inconsistent (does not contain the raw transaction, is corrupted, etc.).

reconstruct_block blueprint_payload block folds over the transactions of block to reconstruct them (see reconstruct).

rereconstruct blueprint_payload obj can be used to retry to reconstruct obj using blueprint_payload, exactly as reconstruct would, in case obj was created with from_store_transaction_object.

  • rereconstruct blueprint_payload (reconstruct blueprint_payload obj) is a no-op.
  • rereconstruct blueprint_payload (from_store_transaction_object obj) is equivalent to reconstruct blueprint_payload obj

rereconstruct_block can be used to retry to reconstruct a block, exactly as reconstruct_block would, in case block was created with block_from_legacy.

See rereconstruct.