Module Evm_node_lib_dev_encoding.Transaction

type transaction_type =
  1. | Legacy
  2. | Eip2930
  3. | Eip1559

Payload of an Ethereum transaction.

Note that nonces, signature and all are not wrapped in usual quantity, hash types etc. It is not relevant to wrap them as this type is not returned in any RPC and we do not need to make sure they are hexadecimal values. On the contrary, we prefer to keep binary bytes to facilitate signature verification.

type access_list_item = bytes * bytes list
type transaction = {
  1. transaction_type : transaction_type;
  2. chain_id : Z.t option;
  3. nonce : Z.t;
  4. max_priority_fee_per_gas : Z.t;
  5. max_fee_per_gas : Z.t;
  6. gas_limit : Z.t;
  7. to_ : bytes option;
  8. value : Z.t;
  9. data : bytes;
  10. access_list : access_list_item list;
    (*

    Access list are not yet supported. Even if the kernel does not support them, we need to decode them to verify the signature.

    *)
  11. v : Z.t;
  12. r : Z.t;
  13. s : Z.t;
}
val decode_legacy : bytes -> (transaction, string) Stdlib.result

decode_legacy bytes tries to decode bytes into a transaction.

val decode_eip1559 : bytes -> (transaction, string) Stdlib.result

decode_eip1559 bytes tries to decode bytes into a transaction.

val decode_eip2930 : bytes -> (transaction, string) Stdlib.result

decode_eip2930 bytes tries to decode bytes into a transaction.

val decode : string -> (transaction, string) Stdlib.result

decode bytes tries to decode bytes into a transaction, using decode_eip1559, decode_eip2930 or decode_legacy depending of the first byte of bytes.

val to_transaction_object : hash:Ethereum_types.hash -> transaction -> (Ethereum_types.legacy_transaction_object, string) Stdlib.result

to_transaction_object ~hash transaction transforms a transaction and its hash to a Ethereum_types.transaction_object.