View Source Signet.Block (Signet v1.3.8)

Represents a block from the Ethereum JSON-RPC endpoint.

Defined here: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash

Summary

Functions

Deserializes a block object from JSON-RPC.

Types

@type t() :: %Signet.Block{
  difficulty: integer(),
  extra_data: binary(),
  gas_limit: integer(),
  gas_used: integer(),
  hash: <<_::256>> | nil,
  logs_bloom: <<_::1024>> | nil,
  miner: <<_::160>>,
  nonce: integer() | nil,
  number: integer() | nil,
  parent_hash: <<_::256>> | nil,
  receipts_root: <<_::256>>,
  sha3_uncles: <<_::256>>,
  size: integer(),
  state_root: <<_::256>>,
  timestamp: integer(),
  total_difficulty: integer(),
  transactions: [],
  transactions_root: <<_::256>>,
  uncles: [<<_::256>>]
}

Functions

Deserializes a block object from JSON-RPC.

Examples

iex> %{
...>   "difficulty" => "0x4ea3f27bc",
...>   "extraData" => "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
...>   "gasLimit" => "0x1388",
...>   "gasUsed" => "0x0",
...>   "hash" => "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
...>   "logsBloom" => "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
...>   "miner" => "0xbb7b8287f3f0a933474a79eae42cbca977791171",
...>   "mixHash" => "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
...>   "nonce" => "0x689056015818adbe",
...>   "number" => "0x1b4",
...>   "parentHash" => "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
...>   "receiptsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
...>   "sha3Uncles" => "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
...>   "size" => "0x220",
...>   "stateRoot" => "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
...>   "timestamp" => "0x55ba467c",
...>   "totalDifficulty" => "0x78ed983323d",
...>   "transactions" => [],
...>   "transactionsRoot" => "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
...>   "uncles" => []
...> }
...> |> Signet.Block.deserialize()
%Signet.Block{
  difficulty: 0x4ea3f27bc,
  extra_data: ~h[0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32],
  gas_limit: 0x1388,
  gas_used: 0x0,
  hash: ~h[0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae],
  logs_bloom: ~h[0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000],
  miner: ~h[0xbb7b8287f3f0a933474a79eae42cbca977791171],
  nonce: 0x689056015818adbe,
  number: 0x1b4,
  parent_hash: ~h[0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54],
  receipts_root: ~h[0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421],
  sha3_uncles: ~h[0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347],
  size: 0x220,
  state_root: ~h[0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d],
  timestamp: 0x55ba467c,
  total_difficulty: 0x78ed983323d,
  transactions: [],
  transactions_root: ~h[0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421],
  uncles: []
}