alloy_rpc_types

Struct Header

source
pub struct Header {
Show 23 fields pub hash: FixedBytes<32>, pub parent_hash: FixedBytes<32>, pub uncles_hash: FixedBytes<32>, pub miner: Address, pub state_root: FixedBytes<32>, pub transactions_root: FixedBytes<32>, pub receipts_root: FixedBytes<32>, pub logs_bloom: Bloom, pub difficulty: Uint<256, 4>, pub number: u64, pub gas_limit: u64, pub gas_used: u64, pub timestamp: u64, pub total_difficulty: Option<Uint<256, 4>>, pub extra_data: Bytes, pub mix_hash: Option<FixedBytes<32>>, pub nonce: Option<FixedBytes<8>>, pub base_fee_per_gas: Option<u64>, pub withdrawals_root: Option<FixedBytes<32>>, pub blob_gas_used: Option<u64>, pub excess_blob_gas: Option<u64>, pub parent_beacon_block_root: Option<FixedBytes<32>>, pub requests_hash: Option<FixedBytes<32>>,
}
Available on crate feature eth only.
Expand description

Block header representation.

Fields§

§hash: FixedBytes<32>

Hash of the block

§parent_hash: FixedBytes<32>

Hash of the parent

§uncles_hash: FixedBytes<32>

Hash of the uncles

§miner: Address

Alias of author

§state_root: FixedBytes<32>

State root hash

§transactions_root: FixedBytes<32>

Transactions root hash

§receipts_root: FixedBytes<32>

Transactions receipts root hash

§logs_bloom: Bloom

Logs bloom

§difficulty: Uint<256, 4>

Difficulty

§number: u64

Block number

§gas_limit: u64

Gas Limit

§gas_used: u64

Gas Used

§timestamp: u64

Timestamp

§total_difficulty: Option<Uint<256, 4>>

Total difficulty

§extra_data: Bytes

Extra data

§mix_hash: Option<FixedBytes<32>>

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<FixedBytes<8>>

Nonce

§base_fee_per_gas: Option<u64>

Base fee per unit of gas (if past London)

§withdrawals_root: Option<FixedBytes<32>>

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<FixedBytes<32>>

EIP-4788 parent beacon block root

§requests_hash: Option<FixedBytes<32>>

EIP-7685 requests hash.

Implementations§

source§

impl Header

source

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

source

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

source

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

source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Header, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Header, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl Clone for Header

source§

fn clone(&self) -> Header

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Header

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Header

source§

fn default() -> Header

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Header

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Header, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Header> for WithOtherFields<Header>

Available on crate feature serde only.
source§

fn from(inner: Header) -> WithOtherFields<Header>

Converts to this type from the input type.
source§

impl Hash for Header

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl HeaderResponse for Header

source§

fn hash(&self) -> FixedBytes<32>

Block hash
source§

fn number(&self) -> u64

Block number
source§

fn timestamp(&self) -> u64

Block timestamp
source§

fn extra_data(&self) -> &Bytes

Extra data
source§

fn base_fee_per_gas(&self) -> Option<u64>

Base fee per unit of gas (If EIP-1559 is supported)
source§

fn next_block_blob_fee(&self) -> Option<u128>

Blob fee for the next block (if EIP-4844 is supported)
source§

fn coinbase(&self) -> Address

Coinbase/Miner of the block
source§

fn gas_limit(&self) -> u64

Gas limit of the block
source§

fn mix_hash(&self) -> Option<FixedBytes<32>>

Mix hash of the block Read more
source§

fn difficulty(&self) -> Uint<256, 4>

Difficulty of the block Read more
source§

impl PartialEq for Header

source§

fn eq(&self, other: &Header) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Header

source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Header

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,