Cryptography Guide

A zero-knowledge proof system for private transactions using SP1 zkVM, combining Ethereum compatibility with ZK-efficient cryptography.

Overview

This system provides cryptographic primitives for building privacy-preserving transactions with:

  • Hidden Amounts: Pedersen commitments on Ristretto curve

  • Hidden Senders: Ring signatures (LSAG variant)

  • Hidden Receivers: Stealth addresses for Ethereum (secp256k1)

  • Curve Bridge: Convert between secp256k1 and Ristretto curves

  • ZK Proofs: SP1-based SNARK proofs for Ethereum verification

Architecture

Features

Pedersen Commitments

Hide transaction amounts while maintaining verifiability.

Ring Signatures

Hide transaction sender within an anonymity set.

Ethereum Stealth Addresses

Hide transaction receiver using stealth address generation on secp256k1.

Curve Bridge Functions

Convert between Ethereum's secp256k1 and Ristretto curves for ZK proofs.

Getting Started

Prerequisites

Build & Run

API Reference

Pedersen Commitments

Ring Signatures

Ethereum Stealth Addresses

Curve Bridge

Utilities

Data Types for Solidity

Commitment (32 bytes)

Key Image (32 bytes)

Ring Signature (variable size)

SP1 Proof Generation

For detailed instructions on building and running the SP1 prover, see the SP1 Prover Guide.

Quick Reference

Security Considerations

Cryptographic Guarantees

  • Hiding: Commitments reveal nothing about amounts

  • Binding: Cannot change committed amount after creation

  • Anonymity: Ring signatures hide signer in anonymity set

  • Linkability: Same key creates same key image (prevent double-spend)

  • Unforgeability: Cannot forge signature without private key

For Solidity Developers

  1. Always check key images: Prevent double-spending by tracking used key images

  2. Validate commitment balance: Ensure input commitments = output commitments

  3. Store verification key: Use immutable PROGRAM_VKEY from prover

  4. Gas optimization: Batch verify multiple proofs when possible

  5. Upgrade path: Use proxy pattern for verifier contract

Testing

Performance

Pedersen Commitments

  • Create: ~50 μs

  • Verify: ~50 μs

  • Serialize: 32 bytes

Ring Signatures

  • Sign (ring size 8): ~2 ms

  • Verify (ring size 8): ~2 ms

  • Serialize: 32 + 64*n bytes (n = ring size)

ZK Proof Generation (Estimated)

  • Local proving: ~30-60 seconds

  • Network proving: ~10-20 seconds

  • Proof size: ~200 KB (Groth16)

Roadmap

References

Last updated