Module Evm_node_lib_dev_encoding.Ethereum_types

type hex =
  1. | Hex of string

Ethereum data, as Hex-encoded strings

version of hex_encoding that do not add `0x` on encoded values.

val hex_to_string : hex -> string

Produced string is prefixed with 0x.

val hex_of_string : string -> hex

Strips the 0x prefix of a string.

val hex_encode_string : string -> hex

Encodes a string into hexa. see Hex.of_string E.g. hex_encode_string "Mirage OS" is Hex "4d69726167654f53"

val hex_to_bytes : hex -> string

hex_to_bytes hex transforms the hex to binary format.

val hex_to_real_bytes : hex -> bytes

hex_to_real_bytes hex transforms the hex to bytes.

val hex_of_utf8 : string -> hex

hex_of_utf8 encodes a string to its utf8 representation in hexadecimal.

val hex_of_bytes : bytes -> hex

hex_of_bytes transforms the bytes to hexadecimal.

type block_hash =
  1. | Block_hash of hex

Ethereum block hash (32 bytes)

val pp_block_hash : Stdlib.Format.formatter -> block_hash -> unit
val decode_block_hash : bytes -> block_hash
val encode_block_hash : block_hash -> bytes
val genesis_parent_hash : block_hash
val block_hash_to_bytes : block_hash -> string
val block_hash_of_bytes : bytes -> block_hash
val block_hash_of_string : string -> block_hash
type quantity =
  1. | Qty of Z.t

Ethereum generic quantity, always encoded in hexadecimal.

module Qty : sig ... end
val pp_quantity : Stdlib.Format.formatter -> quantity -> unit
val quantity_of_z : Z.t -> quantity
val decode_number_le : bytes -> quantity
val decode_number_be : bytes -> quantity
val encode_u256_le : quantity -> bytes
val encode_u64_le : quantity -> bytes
val u16_to_bytes : int -> string

u16_to_bytes n Translate an int in a binary string of two bytes (little endian). Ints greater than 2 bytes are truncated.

type hash =
  1. | Hash of hex

Ethereum hash, that would encoded with a 0x prefix.

val pp_hash : Stdlib.Format.formatter -> hash -> unit
val transaction_hash_size : int

Transaction hash size is 32 bytes.

val decode_hash : bytes -> hash
val hash_of_string : string -> hash

hash_of_string s takes a string s representing a hash in hexadecimal format, e.g. 0xFFFFFFF. Strips the prefix and keeps the hash value, e.g. FFFFFFF.

val hash_to_string : hash -> string

hash_to_string h constructs a valid hash encoded in hexadecimal format, e.g. 0xFFFFFFF.

val hash_to_bytes : hash -> string

hash_to_bytes hash transforms the hash to binary format.

val equal_hash : hash -> hash -> bool
type address =
  1. | Address of hex

Ethereum address (20 bytes)

val decode_address : bytes -> address
type legacy_transaction_object = {
  1. blockHash : block_hash option;
  2. blockNumber : quantity option;
  3. from : address;
  4. gas : quantity;
  5. gasPrice : quantity;
  6. hash : hash;
  7. input : hex;
  8. nonce : quantity;
  9. to_ : address option;
  10. transactionIndex : quantity option;
  11. value : quantity;
  12. v : quantity;
  13. r : quantity;
  14. s : quantity;
}
val legacy_transaction_object_from_rlp_item : block_hash option -> Rlp.item -> legacy_transaction_object
val legacy_transaction_object_from_rlp : block_hash option -> bytes -> legacy_transaction_object
type 'transaction_object block_transactions =
  1. | TxHash of hash list
  2. | TxFull of 'transaction_object list
type 'transaction_object block = {
  1. number : quantity;
  2. hash : block_hash;
  3. parent : block_hash;
  4. nonce : hex;
  5. sha3Uncles : hash;
  6. logsBloom : hex;
  7. transactionRoot : hash;
  8. stateRoot : hash;
  9. receiptRoot : hash;
  10. miner : hex;
  11. difficulty : quantity;
  12. totalDifficulty : quantity;
  13. extraData : hex;
  14. size : quantity;
  15. gasLimit : quantity;
  16. gasUsed : quantity;
  17. timestamp : quantity;
  18. transactions : 'transaction_object block_transactions;
  19. uncles : hash list;
  20. baseFeePerGas : quantity option;
  21. prevRandao : block_hash option;
  22. withdrawals : hash list option;
  23. withdrawalsRoot : hash option;
  24. blobGasUsed : hex option;
  25. excessBlobGas : hex option;
  26. parentBeaconBlockRoot : hash option;
}

Ethereum block hash representation from RPCs.

val block_encoding : 'transaction_object Tezos_base.TzPervasives.Data_encoding.t -> 'transaction_object block Tezos_base.TzPervasives.Data_encoding.t
type transaction_log = {
  1. address : address;
  2. topics : hash list;
  3. data : hex;
  4. blockNumber : quantity option;
  5. transactionHash : hash option;
  6. transactionIndex : quantity option;
  7. blockHash : block_hash option;
  8. logIndex : quantity option;
  9. removed : bool option;
}
type call = {
  1. from : address option;
  2. to_ : address option;
  3. gas : quantity option;
  4. gasPrice : quantity option;
  5. value : quantity option;
  6. data : hash option;
}
module NonceMap : sig ... end
module AddressMap : sig ... end
module StorageMap : sig ... end
type state_account_override = {
  1. balance : quantity option;
  2. nonce : quantity option;
  3. code : hex option;
  4. state_diff : hex StorageMap.t;
  5. state : hex StorageMap.t option;
}
type state_override = state_account_override AddressMap.t
val state_override_empty : state_override
val block_from_rlp : bytes -> legacy_transaction_object block
module Block_parameter : sig ... end
module Address : sig ... end
val timestamp_to_bytes : Tezos_base.TzPervasives.Time.Protocol.t -> bytes

timestamp_to_bytes timestamp transforms the timestamp to bytes compatible with the kernel.

val bool_to_rlp_bytes : bool -> Rlp.item

See bool encoding for RLP: https://docs.rs/ethereum-rlp/latest/src/rlp/impls.rs.html#36-44

val hash_raw_tx : string -> hash
val timestamp_of_bytes : bytes -> Tezos_base.TzPervasives.Time.Protocol.t
val encode_address : address -> bytes
val transaction_log_body_from_rlp : Rlp.item -> address * hash list * hex * quantity
val decode_hex : bytes -> hex
module From_rlp : sig ... end
module Filter : sig ... end
module Subscription : sig ... end