Nullifier Algorithms

Nullifier Algorithms - Generation and Verification

This document describes the nullifier generation and verification algorithms used for double-spend prevention.

Nullifier Generation

Algorithm

Formula:

nullifier = Hash(commitment || nullifier_key || position)

Implementation:

fn generate_nullifier(
    commitment: &Commitment,
    nullifier_key: &Scalar,
    position: u32,
) -> Nullifier {
    let input = [
        commitment.as_bytes(),
        nullifier_key.as_bytes(),
        position.to_le_bytes(),
    ].concat();
    
    Nullifier {
        hash: hash(input),
    }
}

Properties

Uniqueness

Each nullifier is unique per note.

Unlinkability

Cannot link nullifier to original note.

Verification

Verification Process

  1. Generate nullifier from note

  2. Check if nullifier exists in set

  3. Reject if exists (double-spend)

Conclusion

Nullifiers provide secure double-spend prevention while maintaining privacy.

Last updated