@ethereumjs/block / BlockHeader
An object that represents the block header.
• new BlockHeader(headerData, opts?)
This constructor takes the values, validates them, assigns them and freezes the object.
Deprecated
Use the public static factory methods to assist in creating a Header object from varying data types. For a default empty header, use fromHeaderData.
| Name | Type |
|---|---|
headerData |
HeaderData |
opts |
BlockOptions |
• Optional Readonly baseFeePerGas: bigint
• Optional Readonly blobGasUsed: bigint
• Readonly coinbase: Address
• Readonly common: Common
• Readonly difficulty: bigint
• Optional Readonly excessBlobGas: bigint
• Readonly extraData: Uint8Array
• Readonly gasLimit: bigint
• Readonly gasUsed: bigint
• Readonly logsBloom: Uint8Array
• Readonly mixHash: Uint8Array
• Readonly nonce: Uint8Array
• Readonly number: bigint
• Optional Readonly parentBeaconBlockRoot: Uint8Array
• Readonly parentHash: Uint8Array
• Readonly receiptTrie: Uint8Array
• Readonly stateRoot: Uint8Array
• Readonly timestamp: bigint
• Readonly transactionsTrie: Uint8Array
• Readonly uncleHash: Uint8Array
• Optional Readonly withdrawalsRoot: Uint8Array
• get prevRandao(): Uint8Array
EIP-4399: After merge to PoS, mixHash supplanted as prevRandao
Uint8Array
▸ calcDataFee(numBlobs): bigint
Returns the total fee for blob gas spent for including blobs in block.
| Name | Type | Description |
|---|---|---|
numBlobs |
number |
number of blobs in the transaction/block |
bigint
the total blob gas fee for numBlobs blobs
▸ calcNextBaseFee(): bigint
Calculates the base fee for a potential next block
bigint
▸ calcNextBlobGasPrice(): bigint
Calculate the blob gas price of the block built on top of this one
bigint
The blob gas price
▸ calcNextExcessBlobGas(): bigint
Calculates the excess blob gas for next (hopefully) post EIP 4844 block.
bigint
▸ cliqueEpochTransitionSigners(): Address[]
Returns a list of signers (only clique PoA, throws otherwise)
This function throws if not called on an epoch transition block and should therefore be used in conjunction with cliqueIsEpochTransition
Address[]
▸ cliqueExtraSeal(): Uint8Array
Returns extra seal data (only clique PoA, throws otherwise)
Uint8Array
▸ cliqueExtraVanity(): Uint8Array
Returns extra vanity data (only clique PoA, throws otherwise)
Uint8Array
▸ cliqueIsEpochTransition(): boolean
Checks if the block header is an epoch transition header (only clique PoA, throws otherwise)
boolean
▸ cliqueSigHash(): Uint8Array
PoA clique signature hash without the seal.
Uint8Array
▸ cliqueSigner(): Address
Returns the signer address
Address
▸ cliqueVerifySignature(signerList): boolean
Verifies the signature of the block (last 65 bytes of extraData field) (only clique PoA, throws otherwise)
Method throws if signature is invalid
| Name | Type |
|---|---|
signerList |
Address[] |
boolean
▸ errorStr(): string
Return a compact error string representation of the object
string
▸ ethashCanonicalDifficulty(parentBlockHeader): bigint
Returns the canonical difficulty for this block.
| Name | Type | Description |
|---|---|---|
parentBlockHeader |
BlockHeader |
the header from the parent Block of this header |
bigint
▸ getBlobGasPrice(): bigint
Returns the price per unit of blob gas for a blob transaction in the current/pending block
bigint
the price in gwei per unit of blob gas spent
▸ hash(): Uint8Array
Returns the hash of the block header.
Uint8Array
▸ isGenesis(): boolean
Checks if the block header is a genesis header.
boolean
▸ raw(): BlockHeaderBytes
Returns a Uint8Array Array of the raw Bytes in this header, in order.
▸ serialize(): Uint8Array
Returns the rlp encoding of the block header.
Uint8Array
▸ toJSON(): JsonHeader
Returns the block header in JSON format.
▸ validateGasLimit(parentBlockHeader): void
Validates if the block gasLimit remains in the boundaries set by the protocol. Throws if out of bounds.
| Name | Type | Description |
|---|---|---|
parentBlockHeader |
BlockHeader |
the header from the parent Block of this header |
void
▸ Static fromHeaderData(headerData?, opts?): BlockHeader
Static constructor to create a block header from a header data dictionary
| Name | Type |
|---|---|
headerData |
HeaderData |
opts |
BlockOptions |
▸ Static fromRLPSerializedHeader(serializedHeaderData, opts?): BlockHeader
Static constructor to create a block header from a RLP-serialized header
| Name | Type |
|---|---|
serializedHeaderData |
Uint8Array |
opts |
BlockOptions |
▸ Static fromValuesArray(values, opts?): BlockHeader
Static constructor to create a block header from an array of Bytes values
| Name | Type |
|---|---|
values |
BlockHeaderBytes |
opts |
BlockOptions |