@ethereumjs/blockchain / Consensus
Interface that a consensus class needs to implement.
• algorithm: string
▸ genesisInit(genesisBlock
): Promise
<void
>
Initialize genesis for consensus mechanism
Name | Type | Description |
---|---|---|
genesisBlock |
Block |
genesis block |
Promise
<void
>
▸ newBlock(block
, commonAncestor?
, ancientHeaders?
): Promise
<void
>
Update consensus on new block
Name | Type | Description |
---|---|---|
block |
Block |
new block |
commonAncestor? |
BlockHeader |
common ancestor block header (optional) |
ancientHeaders? |
BlockHeader [] |
array of ancestor block headers (optional) |
Promise
<void
>
▸ setup(__namedParameters
): Promise
<void
>
Set up consensus mechanism
Name | Type |
---|---|
__namedParameters |
ConsensusOptions |
Promise
<void
>
▸ validateConsensus(block
): Promise
<void
>
Validate block consensus parameters
Name | Type | Description |
---|---|---|
block |
Block |
block to be validated |
Promise
<void
>
▸ validateDifficulty(header
): Promise
<void
>
Name | Type |
---|---|
header |
BlockHeader |
Promise
<void
>