@ethereumjs/blockchain / BlockchainInterface
Defined in: types.ts:13
consensus:
undefined
|Consensus
Defined in: types.ts:14
optional
events:EventEmitter
<BlockchainEvent
,any
>
Defined in: types.ts:91
Optional events emitter
delBlock(
blockHash
):Promise
<void
>
Defined in: types.ts:28
Deletes a block from the blockchain. All child blocks in the chain are deleted and any encountered heads are set to the parent block.
Uint8Array
The hash of the block to be deleted
Promise
<void
>
getBlock(
blockId
):Promise
<Block
>
Defined in: types.ts:33
Returns a block by its hash or number.
number |
bigint |
Uint8Array <ArrayBufferLike > |
Promise
<Block
>
getCanonicalHeadBlock():
Promise
<Block
>
Defined in: types.ts:86
Returns the latest full block in the canonical chain.
Promise
<Block
>
getIteratorHead(
name?
):Promise
<Block
>
Defined in: types.ts:68
Returns the specified iterator head.
string
Optional name of the iterator head (default: ‘vm’)
Promise
<Block
>
optional
getTotalDifficulty(hash
,number?
):Promise
<bigint
>
Defined in: types.ts:81
Gets total difficulty for a block specified by hash and number
Uint8Array
bigint
Promise
<bigint
>
iterator(
name
,onBlock
,maxBlocks?
,releaseLockOnCallback?
):Promise
<number
>
Defined in: types.ts:44
Iterates through blocks starting at the specified iterator head and calls the onBlock function on each block.
string
Name of the state root head
Function called on each block with params (block: Block,
number
optional maximum number of blocks to iterate through reorg: boolean)
boolean
Promise
<number
>
putBlock(
block
):Promise
<void
>
Defined in: types.ts:20
Adds a block to the blockchain.
Block
The block to be added to the blockchain.
Promise
<void
>
setIteratorHead(
tag
,headHash
):Promise
<void
>
Defined in: types.ts:76
Set header hash of a certain tag
.
When calling the iterator, the iterator will start running the first child block after the header hash currently stored.
string
The tag to save the headHash to
Uint8Array
The head hash to save
Promise
<void
>
shallowCopy():
BlockchainInterface
Defined in: types.ts:54
Returns a shallow copy of the blockchain that may share state with the original
BlockchainInterface
validateHeader(
header
,height?
):Promise
<void
>
Defined in: types.ts:61
Validates a block header, throwing if invalid. It is being validated against the reported parentHash
.
BlockHeader
header to be validated
bigint
If this is an uncle header, this is the height of the block that is including it
Promise
<void
>