[][src]Crate p0w

Merkle tree Proof-of-Work (PoW)

This crate provides an implementation of the following paper:

Fabien Coelho. An (Almost) Constant-E ort Solution-Veri cation Proof-of-Work Protocol based on Merkle Trees. 1st international conference on Progress in cryptology, Jun 2008, Casablanca, Morocco. pp.Pages 80-93. ⟨hal-00752925⟩

How does it work?

Tree::new() creates a new Merkle tree with a specified service description and number of levels, in which leaves are equal to hmac(h(desc), leaf) (with desc the service description, and leaf the zero-based index of the leaf).

Tree::gen_proofs(_with)?() then creates a Proofs for the tree with an eventually specified number of evenly-distributed, randomly selected leaves, their sibling and the internal nodes required to prove the validity of the tree.

Example

use p0w::Tree;

let tree = Tree::new("foobar", 16);
let proofs = tree.gen_proofs();

assert!(proofs.verify().is_ok());

Structs

Proofs

The actual Proof-of-work

Tree

A Merkle tree used to generate a Proofs

Enums

Error

The error type returned by Proofs::verify()