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

Implementation of Cuckaroo Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.

Implementation of Cuckarood Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.

Implementation of Cuckaroom Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.

Implementation of Cuckarooz Cycle, based on Cuckoo Cycle designed by John Tromp. Ported to Rust from https://github.com/tromp/cuckoo.

Implementation of Cuckatoo Cycle designed by John Tromp.

Lean miner for Cuckatoo Cycle

Structs

The difficulty is defined as the maximum target divided by the block hash.

Cuckatoo solver or validation error

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

Block header information pertaining to the proof of work

Traits

Operations needed for edge type (going to be u32 or u64)

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

Mines a genesis block using the internal miner

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…

Validates the proof of work of a given header, and that the proof of work satisfies the requirements of the header.