pub struct BlockHeader {Show 24 fields
pub parent_hash: Vec<u8>,
pub uncle_hash: Vec<u8>,
pub coinbase: Vec<u8>,
pub state_root: Vec<u8>,
pub transactions_root: Vec<u8>,
pub receipt_root: Vec<u8>,
pub logs_bloom: Vec<u8>,
pub difficulty: Option<BigInt>,
pub total_difficulty: Option<BigInt>,
pub number: u64,
pub gas_limit: u64,
pub gas_used: u64,
pub timestamp: Option<Timestamp>,
pub extra_data: Vec<u8>,
pub mix_hash: Vec<u8>,
pub nonce: u64,
pub hash: Vec<u8>,
pub base_fee_per_gas: Option<BigInt>,
pub withdrawals_root: Vec<u8>,
pub tx_dependency: Option<Uint64NestedArray>,
pub blob_gas_used: Option<u64>,
pub excess_blob_gas: Option<u64>,
pub parent_beacon_root: Vec<u8>,
pub requests_hash: Vec<u8>,
}
Fields§
§parent_hash: Vec<u8>
§uncle_hash: Vec<u8>
Uncle hash of the block, some reference it as sha3Uncles
, but sha3`` is badly worded, so we prefer
uncle_hash, also referred as
ommers` in EIP specification.
If the Block containing this BlockHeader
has been produced using the Proof of Stake
consensus algorithm, this field will actually be constant and set to 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
.
coinbase: Vec<u8>
§state_root: Vec<u8>
§transactions_root: Vec<u8>
§receipt_root: Vec<u8>
§logs_bloom: Vec<u8>
§difficulty: Option<BigInt>
Difficulty is the difficulty of the Proof of Work algorithm that was required to compute a solution.
If the Block containing this BlockHeader
has been produced using the Proof of Stake
consensus algorithm, this field will actually be constant and set to 0x00
.
total_difficulty: Option<BigInt>
TotalDifficulty used to be the sum of all previous blocks difficulty including this block difficulty.
It has been deprecated in geth v1.15.0 but was already removed from the JSON-RPC interface for a while
number: u64
§gas_limit: u64
§gas_used: u64
§timestamp: Option<Timestamp>
§extra_data: Vec<u8>
ExtraData is free-form bytes included in the block by the “miner”. While on Yellow paper of Ethereum this value is maxed to 32 bytes, other consensus algorithm like Clique and some other forks are using bigger values to carry special consensus data.
If the Block containing this BlockHeader
has been produced using the Proof of Stake
consensus algorithm, this field is strictly enforced to be <= 32 bytes.
mix_hash: Vec<u8>
MixHash is used to prove, when combined with the nonce
that sufficient amount of computation has been
achieved and that the solution found is valid.
nonce: u64
Nonce is used to prove, when combined with the mix_hash
that sufficient amount of computation has been
achieved and that the solution found is valid.
If the Block containing this BlockHeader
has been produced using the Proof of Stake
consensus algorithm, this field will actually be constant and set to 0
.
hash: Vec<u8>
Hash is the hash of the block which is actually the computation:
Keccak256(rlp([ parent_hash, uncle_hash, coinbase, state_root, transactions_root, receipt_root, logs_bloom, difficulty, number, gas_limit, gas_used, timestamp, extra_data, mix_hash, nonce, base_fee_per_gas (to be included only if London fork is active) withdrawals_root (to be included only if Shangai fork is active) blob_gas_used (to be included only if Cancun fork is active) excess_blob_gas (to be included only if Cancun fork is active) parent_beacon_root (to be included only if Cancun fork is active) requests_hash (to be included only if Prague fork is active) ]))
base_fee_per_gas: Option<BigInt>
Base fee per gas according to EIP-1559 (e.g. London Fork) rules, only set if London is present/active on the chain.
withdrawals_root: Vec<u8>
Withdrawals root hash according to EIP-4895 (e.g. Shangai Fork) rules, only set if Shangai is present/active on the chain.
Only available in DetailLevel: EXTENDED
tx_dependency: Option<Uint64NestedArray>
TxDependency is list of transaction indexes that are dependent on each other in the block header. This is metadata only that was used by the internal Polygon parallel execution engine.
This field was available in a few versions on Polygon Mainnet and Polygon Mumbai chains. It was actually
removed and is not populated anymore. It’s now embedded in the extraData
field, refer to Polygon source
code to determine how to extract it if you need it.
Only available in DetailLevel: EXTENDED
blob_gas_used: Option<u64>
BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.
excess_blob_gas: Option<u64>
ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.
parent_beacon_root: Vec<u8>
ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.
requests_hash: Vec<u8>
RequestsHash was added by EIP-7685 and is ignored in legacy headers.
Implementations§
Source§impl BlockHeader
impl BlockHeader
Sourcepub fn blob_gas_used(&self) -> u64
pub fn blob_gas_used(&self) -> u64
Returns the value of blob_gas_used
, or the default value if blob_gas_used
is unset.
Sourcepub fn excess_blob_gas(&self) -> u64
pub fn excess_blob_gas(&self) -> u64
Returns the value of excess_blob_gas
, or the default value if excess_blob_gas
is unset.
Trait Implementations§
Source§impl Clone for BlockHeader
impl Clone for BlockHeader
Source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BlockHeader
impl Debug for BlockHeader
Source§impl Default for BlockHeader
impl Default for BlockHeader
Source§fn default() -> BlockHeader
fn default() -> BlockHeader
Source§impl Message for BlockHeader
impl Message for BlockHeader
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.