Crate tc_consensus_pow[][src]

Proof of work consensus for Tetcore.

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

MiningBuild

A build of mining, containing the metadata and the block proposal.

MiningMetadata

Mining metadata. This is the information needed to start an actual mining loop.

MiningWorker

Mining worker that exposes structs to query the current mining build and submit mined blocks.

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_mining_worker

Start the mining worker for PoW. This function provides the necessary helper functions that can be used to implement a miner. However, it does not do the CPU-intensive mining itself.

Type Definitions

PowImportQueue

The PoW import queue type.