p0w

Crates.iop0w
lib.rsp0w
version0.2.2
sourcesrc
created_at2020-06-19 16:43:35.454517
updated_at2020-08-13 20:34:48.241395
descriptionMerkle tree Proof-of-Work (PoW)
homepagehttps://github.com/r3v2d0g/p0w
repositoryhttps://github.com/r3v2d0g/p0w.git
max_upload_size
id255760
size62,953
Matthieu Le brazidec (r3v2d0g) (r3v2d0g)

documentation

https://docs.rs/p0w

README

Merkle tree Proof-of-Work (PoW)

img img img

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::proofs() then creates a Proofs for the tree with a specified number of evenly-distributed, randomly selected leaves, their sibling and the internal nodes required to prove the validity of the tree up to its root node.

Example

use p0w::Tree;

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

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

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Commit count: 11

cargo fmt