[][src]Crate sc_consensus_pow

Proof of work consensus for Substrate.

To use this engine, you can need to have a struct that implements PowAlgorithm. After that, pass an instance of the struct, along with other necessary client references to import_queue to setup the queue. Use the start_mine function for basic CPU mining.

The auxiliary storage for PoW engine only stores the total difficulty. For other storage requirements for particular PoW algorithm (such as the actual difficulty for each particular blocks), you can take a client reference in your PowAlgorithm implementation, and use a separate prefix for the auxiliary storage. It is also possible to just use the runtime as the storage, but it is not recommended as it won't work well with light clients.

Structs

PowAux

Auxiliary storage data for PoW.

PowBlockImport

A block importer for PoW.

PowIntermediate

Intermediate value passed to block importer.

PowVerifier

A verifier for PoW blocks.

Enums

Error

Constants

POW_AUX_PREFIX

Auxiliary storage prefix for PoW engine.

Statics

INTERMEDIATE_KEY

Intermediate key for PoW engine.

Traits

PowAlgorithm

Algorithm used for proof of work.

Functions

import_queue

Import queue for PoW engine.

register_pow_inherent_data_provider

Register the PoW inherent data provider, if not registered already.

start_mine

Start the background mining thread for PoW. Note that because PoW mining is CPU-intensive, it is not possible to use an async future to define this. However, it's not recommended to use background threads in the rest of the codebase.

Type Definitions

PowImportQueue

The PoW import queue type.