Cuckoo

/// Cuckoo cycle context
pub struct Cuckoo {
    mask: u64,
    size: u64,
    v: [u64; 4],
}

Edge

/// An edge in the Cuckoo graph, simply references two u64 nodes.
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
struct Edge {
    u: u64,
    v: u64,
}

Miner

/// Miner for the Cuckoo Cycle algorithm. While the verifier will work for
/// graph sizes up to a u64, the miner is limited to u32 to be more memory
/// compact (so shift <= 32). Non-optimized for now and and so mostly used for
/// tests, being impractical with sizes greater than 2^22.
pub struct Miner {
    easiness: u64,
    proof_size: usize,
    cuckoo: Cuckoo,
    graph: Vec<u32>,
    sizeshift: u8,
}

Cuckoo Cycle 知识参考数学/密码学对应部分。

具体步骤:略.

Graph

struct Graph<T>
where
    T: EdgeType,
{
    /// Maximum number of edges
    max_edges: T,
    /// Maximum nodes
    max_nodes: u64,
    /// Adjacency links
    links: Vec<Link<T>>,
    /// Index into links array
    adj_list: Vec<T>,
    ///
    visited: Bitmap,
    /// Maximum solutions
    max_sols: u32,
    ///
    pub solutions: Vec<Proof>,
    /// proof size
    proof_size: usize,
    /// define NIL type
    nil: T,
}

CuckatooContext

/// Cuckatoo solver context
pub struct CuckatooContext<T>
where
    T: EdgeType,
{
    params: CuckooParams<T>,
    graph: Graph<T>,
}

results matching ""

    No results matching ""