pub struct Header {Show 23 fields
pub hash: BlockHash,
pub parent_hash: B256,
pub uncles_hash: B256,
pub miner: Address,
pub state_root: B256,
pub transactions_root: B256,
pub receipts_root: B256,
pub logs_bloom: Bloom,
pub difficulty: U256,
pub number: u64,
pub gas_limit: u64,
pub gas_used: u64,
pub timestamp: u64,
pub total_difficulty: Option<U256>,
pub extra_data: Bytes,
pub mix_hash: Option<B256>,
pub nonce: Option<B64>,
pub base_fee_per_gas: Option<u64>,
pub withdrawals_root: Option<B256>,
pub blob_gas_used: Option<u64>,
pub excess_blob_gas: Option<u64>,
pub parent_beacon_block_root: Option<B256>,
pub requests_hash: Option<B256>,
}
Expand description
Block header representation.
Fields§
§hash: BlockHash
Hash of the block
parent_hash: B256
Hash of the parent
uncles_hash: B256
Hash of the uncles
miner: Address
Alias of author
state_root: B256
State root hash
transactions_root: B256
Transactions root hash
receipts_root: B256
Transactions receipts root hash
logs_bloom: Bloom
Logs bloom
difficulty: U256
Difficulty
number: u64
Block number
gas_limit: u64
Gas Limit
gas_used: u64
Gas Used
timestamp: u64
Timestamp
total_difficulty: Option<U256>
Total difficulty
extra_data: Bytes
Extra data
mix_hash: Option<B256>
Mix Hash
Before the merge this proves, combined with the nonce, that a sufficient amount of computation has been carried out on this block: the Proof-of-Work (PoF).
After the merge this is prevRandao
: Randomness value for the generated payload.
This is an Option because it is not always set by non-ethereum networks.
See also https://eips.ethereum.org/EIPS/eip-4399 And https://github.com/ethereum/execution-apis/issues/328
nonce: Option<B64>
Nonce
base_fee_per_gas: Option<u64>
Base fee per unit of gas (if past London)
withdrawals_root: Option<B256>
Withdrawals root hash added by EIP-4895 and is ignored in legacy headers.
blob_gas_used: Option<u64>
Blob gas used
excess_blob_gas: Option<u64>
Excess blob gas
parent_beacon_block_root: Option<B256>
EIP-4788 parent beacon block root
requests_hash: Option<B256>
EIP-7685 requests hash.
Implementations§
source§impl Header
impl Header
sourcepub fn blob_fee(&self) -> Option<u128>
pub fn blob_fee(&self) -> Option<u128>
Returns the blob fee for this block according to the EIP-4844 spec.
Returns None
if excess_blob_gas
is None
sourcepub fn next_block_blob_fee(&self) -> Option<u128>
pub fn next_block_blob_fee(&self) -> Option<u128>
Returns the blob fee for the next block according to the EIP-4844 spec.
Returns None
if excess_blob_gas
is None.
See also Self::next_block_excess_blob_gas
sourcepub fn next_block_excess_blob_gas(&self) -> Option<u64>
pub fn next_block_excess_blob_gas(&self) -> Option<u64>
Calculate excess blob gas for the next block according to the EIP-4844 spec.
Returns a None
if no excess blob gas is set, no EIP-4844 support
Trait Implementations§
source§impl<'arbitrary> Arbitrary<'arbitrary> for Header
impl<'arbitrary> Arbitrary<'arbitrary> for Header
source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read moresource§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl HeaderResponse for Header
impl HeaderResponse for Header
source§fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
source§fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
source§fn next_block_blob_fee(&self) -> Option<u128>
fn next_block_blob_fee(&self) -> Option<u128>
source§fn difficulty(&self) -> U256
fn difficulty(&self) -> U256
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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