@ethereumjs/block / Block
Defined in: block/block.ts:56
Class representing a block in the Ethereum network. The BlockHeader has its own class and can be used independently, for a block it is included in the form of the Block.header property.
A block object can be created with one of the following constructor methods (separate from the Block class to allow for tree shaking):
new Block(
header?
,transactions?
,uncleHeaders?
,withdrawals?
,opts?
,executionWitness?
):Block
Defined in: block/block.ts:83
This constructor takes the values, validates them, assigns them and freezes the object.
TypedTransaction
[] = []
BlockHeader
[] = []
Withdrawal
[]
BlockOptions
= {}
null |
VerkleExecutionWitness |
Block
Use the static factory methods (see Block for an overview) to assist in creating a Block object from varying data types and options.
readonly
common:Common
Defined in: block/block.ts:61
readonly
optional
executionWitness:null
|VerkleExecutionWitness
Defined in: block/block.ts:70
EIP-6800: Verkle Proof Data (experimental) null implies that the non default executionWitness might exist but not available and will not lead to execution of the block via vm with verkle stateless manager
readonly
header:BlockHeader
Defined in: block/block.ts:57
readonly
transactions:TypedTransaction
[] =[]
Defined in: block/block.ts:58
readonly
uncleHeaders:BlockHeader
[] =[]
Defined in: block/block.ts:59
readonly
optional
withdrawals:Withdrawal
[]
Defined in: block/block.ts:60
errorStr():
string
Defined in: block/block.ts:538
Return a compact error string representation of the object
string
genTxTrie():
Promise
<Uint8Array
<ArrayBufferLike
>>
Defined in: block/block.ts:204
Generates transaction trie for validation.
Promise
<Uint8Array
<ArrayBufferLike
>>
getTransactionsValidationErrors():
string
[]
Defined in: block/block.ts:234
Validates transaction signatures and minimum gas requirements.
string
[]
an array of error strings
hash():
Uint8Array
Defined in: block/block.ts:183
Returns the hash of the block.
Uint8Array
isGenesis():
boolean
Defined in: block/block.ts:190
Determines if this block is the genesis block.
boolean
raw():
BlockBytes
Defined in: block/block.ts:160
Returns a Array of the raw Bytes Arrays of this block, in order.
serialize():
Uint8Array
Defined in: block/block.ts:197
Returns the rlp encoding of the block.
Uint8Array
toExecutionPayload():
ExecutionPayload
Defined in: block/block.ts:503
Maps the block properties to the execution payload structure from the beacon chain, see https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#ExecutionPayload
dict with the execution payload parameters with camel case naming
toJSON():
JSONBlock
Defined in: block/block.ts:483
Returns the block in JSON format.
transactionsAreValid():
boolean
Defined in: block/block.ts:284
Validates transaction signatures and minimum gas requirements.
boolean
True if all transactions are valid, false otherwise
transactionsTrieIsValid():
Promise
<boolean
>
Defined in: block/block.ts:216
Validates the transaction trie by generating a trie and do a check on the root hash.
Promise
<boolean
>
True if the transaction trie is valid, false otherwise
uncleHashIsValid():
boolean
Defined in: block/block.ts:408
Validates the uncle’s hash.
boolean
true if the uncle’s hash is valid, false otherwise.
validateBlobTransactions(
parentHeader
):void
Defined in: block/block.ts:360
Validates that blob gas fee for each transaction is greater than or equal to the blobGasPrice for the block and that total blob gas in block is less than maximum blob gas per block
header of parent block
void
validateData(
onlyHeader
,verifyTxs
):Promise
<void
>
Defined in: block/block.ts:300
Validates the block data, throwing if invalid. This can be checked on the Block itself without needing access to any parent block It checks:
boolean
= false
if only passed the header, skip validating txTrie and unclesHash (default: false)
boolean
= true
if set to false
, will not check for transaction validation errors (default: true)
Promise
<void
>
validateGasLimit(
parentBlock
):void
Defined in: block/block.ts:476
Validates if the block gasLimit remains in the boundaries set by the protocol. Throws if invalid
Block
the parent of this Block
void
validateUncles():
void
Defined in: block/block.ts:451
Consistency checks for uncles included in the block, if any.
Throws if invalid.
The rules for uncles checked are the following: Header has at most 2 uncles. Header does not count an uncle twice.
void
withdrawalsTrieIsValid():
Promise
<boolean
>
Defined in: block/block.ts:421
Validates the withdrawal root
Promise
<boolean
>
true if the withdrawals trie root is valid, false otherwise