PoW
The basic-pow
node demonstrates how to add a custom consensus engine to a Substrate-based blockchain. In this example, the node uses a minimal proof-of-work consensus engine to reach agreement over the blockchain. This guide introduces a few core principles for working with consensus engines.
Use cases
Launch a chain that uses a proof-of-work consensus engine.
Upgrade a chain from an authority-based consensus engine to a proof-of-work consensus engine.
Steps preview
Define a full node that uses proof-of-work consensus.
Create an import queue for data providers.
Define the
proposer
andworker
functions.Define a light client service.
Define a full node using sc_consensus_pow and sc_service
In src/service.rs
, make a function called new_full
that defines PartialComponents
and PowBlockImport
:
Create an import queue
Define your node's inherents by using InherentDataProviders
in a function that defines the providers of your POW system:
Define the proposer and worker
In the new_full
function, define proposer
:
Let the task manager spawn it:
Examples
Resources
Last updated