alloy_consensus/block/meta.rs
1//! Commonly used types that contain metadata of a block.
2
3use alloy_primitives::{Address, B256, U256};
4
5/// Essential info extracted from a header.
6#[derive(Debug, Clone, Copy, Default, Eq, PartialEq)]
7pub struct HeaderInfo {
8 /// The number of ancestor blocks of this block (block height).
9 pub number: u64,
10 /// Beneficiary (Coinbase or miner) is a address that have signed the block.
11 ///
12 /// This is the receiver address of all the gas spent in the block.
13 pub beneficiary: Address,
14 /// The timestamp of the block in seconds since the UNIX epoch
15 pub timestamp: u64,
16 /// The gas limit of the block
17 pub gas_limit: u64,
18 /// The base fee per gas, added in the London upgrade with [EIP-1559]
19 ///
20 /// [EIP-1559]: https://eips.ethereum.org/EIPS/eip-1559
21 pub base_fee_per_gas: Option<u64>,
22 /// A running total of blob gas consumed in excess of the target, prior to the block. Blocks
23 /// with above-target blob gas consumption increase this value, blocks with below-target blob
24 /// gas consumption decrease it (bounded at 0). This was added in EIP-4844.
25 pub excess_blob_gas: Option<u64>,
26 /// The total amount of blob gas consumed by the transactions within the block, added in
27 /// EIP-4844.
28 pub blob_gas_used: Option<u64>,
29 /// The difficulty of the block
30 ///
31 /// Unused after the Paris (AKA the merge) upgrade and replaced by `prevrandao` and expected to
32 /// be 0.
33 pub difficulty: U256,
34 /// The output of the randomness beacon provided by the beacon chain
35 ///
36 /// Replaces `difficulty` after the Paris (AKA the merge) upgrade with [EIP-4399].
37 ///
38 /// Note: `prevrandao` can be found in a block in place of `mix_hash`.
39 ///
40 /// [EIP-4399]: https://eips.ethereum.org/EIPS/eip-4399
41 pub mix_hash: Option<B256>,
42}