Module pow

Source
Expand description

The proof of work needs to strike a balance between fast header verification to avoid DoS attacks and difficulty for block verifiers to build new blocks. In addition, mining new blocks should also be as difficult on high end custom-made hardware (ASICs) as on commodity hardware or smartphones. For this reason we use Cuckoo Cycle (see the cuckoo module for more information).

Note that this miner implementation is here mostly for tests and reference. It’s not optimized for speed.

Re-exports§

pub use crate::pow::cuckaroo::new_cuckaroo_ctx;
pub use crate::pow::cuckaroo::no_cuckaroo_ctx;
pub use crate::pow::cuckaroo::CuckarooContext;
pub use crate::pow::cuckarood::new_cuckarood_ctx;
pub use crate::pow::cuckarood::CuckaroodContext;
pub use crate::pow::cuckaroom::new_cuckaroom_ctx;
pub use crate::pow::cuckaroom::CuckaroomContext;
pub use crate::pow::cuckarooz::new_cuckarooz_ctx;
pub use crate::pow::cuckarooz::CuckaroozContext;
pub use crate::pow::cuckatoo::new_cuckatoo_ctx;
pub use crate::pow::cuckatoo::CuckatooContext;

Modules§

cuckaroo
Implementation of Cuckaroo Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.
cuckarood
Implementation of Cuckarood Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.
cuckaroom
Implementation of Cuckaroom Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.
cuckarooz
Implementation of Cuckarooz Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.
cuckatoo
Implementation of Cuckatoo Cycle designed by John Tromp.
lean
Lean miner for Cuckatoo Cycle

Structs§

Difficulty
The difficulty is defined as the maximum target divided by the block hash.
Proof
A Cuck(at)oo Cycle proof of work, consisting of the edge_bits to get the graph size (i.e. the 2-log of the number of edges) and the nonces of the graph solution. While being expressed as u64 for simplicity, nonces a.k.a. edge indices range from 0 to (1 << edge_bits) - 1
ProofOfWork
Block header information pertaining to the proof of work

Enums§

Error
Cuckatoo solver or validation error Libwallet error types

Traits§

EdgeType
Operations needed for edge type (going to be u32 or u64)
PoWContext
Generic trait for a solver/verifier providing common interface into Cuckoo-family PoW Mostly used for verification, but also for test mining if necessary

Functions§

mine_genesis_block
Mines a genesis block using the internal miner
pow_size
Runs a proof of work computation over the provided block using the provided Mining Worker, until the required difficulty target is reached. May take a while for a low target…
verify_size
Validates the proof of work of a given header, and that the proof of work satisfies the requirements of the header.