pub struct Header {Show 20 fields
pub parent_hash: B256,
pub ommers_hash: B256,
pub beneficiary: Address,
pub state_root: B256,
pub transactions_root: B256,
pub receipts_root: B256,
pub withdrawals_root: Option<B256>,
pub logs_bloom: Bloom,
pub difficulty: U256,
pub number: BlockNumber,
pub gas_limit: u64,
pub gas_used: u64,
pub timestamp: u64,
pub mix_hash: B256,
pub nonce: u64,
pub base_fee_per_gas: Option<u64>,
pub blob_gas_used: Option<u64>,
pub excess_blob_gas: Option<u64>,
pub parent_beacon_block_root: Option<B256>,
pub extra_data: Bytes,
}Fields§
§parent_hash: B256The Keccak 256-bit hash of the parent block’s header, in its entirety; formally Hp.
ommers_hash: B256The Keccak 256-bit hash of the ommers list portion of this block; formally Ho.
beneficiary: AddressThe 160-bit address to which all fees collected from the successful mining of this block be transferred; formally Hc.
state_root: B256The Keccak 256-bit hash of the root node of the state trie, after all transactions are executed and finalisations applied; formally Hr.
transactions_root: B256The Keccak 256-bit hash of the root node of the trie structure populated with each transaction in the transactions list portion of the block; formally Ht.
receipts_root: B256The Keccak 256-bit hash of the root node of the trie structure populated with the receipts of each transaction in the transactions list portion of the block; formally He.
withdrawals_root: Option<B256>The Keccak 256-bit hash of the withdrawals list portion of this block. https://eips.ethereum.org/EIPS/eip-4895
logs_bloom: BloomThe Bloom filter composed from indexable information (logger address and log topics) contained in each log entry from the receipt of each transaction in the transactions list; formally Hb.
difficulty: U256A scalar value corresponding to the difficulty level of this block. This can be calculated from the previous block’s difficulty level and the timestamp; formally Hd.
number: BlockNumberA scalar value equal to the number of ancestor blocks. The genesis block has a number of zero; formally Hi.
gas_limit: u64A scalar value equal to the current limit of gas expenditure per block; formally Hl.
gas_used: u64A scalar value equal to the total gas used in transactions in this block; formally Hg.
timestamp: u64A scalar value equal to the reasonable output of Unix’s time() at this block’s inception; formally Hs.
mix_hash: B256A 256-bit hash which, combined with the nonce, proves that a sufficient amount of computation has been carried out on this block; formally Hm.
nonce: u64A 64-bit value which, combined with the mixhash, proves that a sufficient amount of computation has been carried out on this block; formally Hn.
base_fee_per_gas: Option<u64>A scalar representing EIP1559 base fee which can move up or down each block according to a formula which is a function of gas used in parent block and gas target (block gas limit divided by elasticity multiplier) of parent block. The algorithm results in the base fee per gas increasing when blocks are above the gas target, and decreasing when blocks are below the gas target. The base fee per gas is burned.
blob_gas_used: Option<u64>The total amount of blob gas consumed by the transactions within the block, added in EIP-4844.
excess_blob_gas: Option<u64>A running total of blob gas consumed in excess of the target, prior to the block. Blocks with above-target blob gas consumption increase this value, blocks with below-target blob gas consumption decrease it (bounded at 0). This was added in EIP-4844.
parent_beacon_block_root: Option<B256>The hash of the parent beacon block’s root is included in execution blocks, as proposed by EIP-4788.
This enables trust-minimized access to consensus state, supporting staking pools, bridges, and more.
The beacon roots contract handles root storage, enhancing Ethereum’s functionalities.
extra_data: BytesAn arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer; formally Hx.
Implementations§
Source§impl Header
impl Header
pub fn new( parent_hash: B256, ommers_hash: B256, beneficiary: Address, state_root: B256, transactions_root: B256, receipts_root: B256, logs_bloom: Bloom, difficulty: U256, number: u64, gas_limit: u64, gas_used: u64, timestamp: u64, extra_data: Bytes, mix_hash: B256, nonce: u64, base_fee_per_gas: Option<u64>, withdrawals_root: Option<B256>, blob_gas_used: Option<u64>, excess_blob_gas: Option<u64>, parent_beacon_block_root: Option<B256>, ) -> Self
pub fn rlp_encode(&self) -> Vec<u8> ⓘ
pub fn rlp_decode(rlp: &[u8]) -> Self
pub fn get_block_hash(&self) -> String
Trait Implementations§
Source§impl From<&BlockHeaderFromRpc> for Header
impl From<&BlockHeaderFromRpc> for Header
Source§fn from(value: &BlockHeaderFromRpc) -> Self
fn from(value: &BlockHeaderFromRpc) -> Self
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl !Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more