ββββββββ βββ βββββββ βββββββββββββββββ ββββββββββ βββββββββββββββββββββββ ββββββββ βββ ββββββββ ββββββββββββββββββββββββββββββ βββββββββββββββββββββββ ββββββββ βββ ββββββββ βββ ββββββββββββββ βββ ββββββ βββ ββββββββ ββββββββ βββ βββββββ βββ ββββββββββββββ βββ ββββββ βββ ββββββββ ββββββββ βββ βββ ββββββββββββββ βββββββββββββββββββββββ βββ ββββββββ ββββββββ βββ βββ βββββββββββββ βββ βββββββ βββββββ βββ βββ ββββββββ
Privacy is not a feature. It's a right.
Zero-knowledge proof circuits for SIP Protocol β prove without revealing
Funding proofs β’ Validity proofs β’ Fulfillment proofs β’ Browser-compatible
π Winner β Zypherpunk Hackathon ($6,500: NEAR $4,000 + Tachyon $500 + pumpfun $2,000) | #9 of 93 | 3 Tracks
- What are SIP Circuits?
- Circuits Overview
- Quick Start
- Circuit Details
- Architecture
- Cryptographic Primitives
- Integration
- Development
- Specifications
- Related Projects
- License
SIP Circuits are zero-knowledge proof circuits written in Noir that enable privacy-preserving operations without revealing sensitive data. They're the cryptographic backbone of SIP Protocol.
Traditional Transaction β Everyone sees balance, amount, recipient
SIP with ZK Proofs β Prove validity without revealing anything
Prove you have enough. Prove you're authorized. Prove it's correct. Reveal nothing.
| Circuit | Purpose | ACIR Opcodes | Tests |
|---|---|---|---|
| funding_proof | Prove balance β₯ minimum without revealing balance | 972 | 5 |
| validity_proof | Prove intent authorization without revealing sender | 1,113 | 6 |
| fulfillment_proof | Prove swap execution correctness | 1,691 | 8 |
Total: 3 circuits, 3,776 ACIR opcodes, 19 tests passing
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FUNDING PROOF β
β "I have enough balance" β
β βββββββββββββββββββββ β
β Public: commitment_hash, minimum_required, asset_id β
β Private: actual_balance, blinding_factor β
β Proves: balance >= minimum (without revealing balance) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β VALIDITY PROOF β
β "I authorized this intent" β
β βββββββββββββββββββββββββ β
β Public: intent_hash, sender_commitment, nullifier, timestamps β
β Private: sender_address, signature, secrets β
β Proves: valid signature from committed sender β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β FULFILLMENT PROOF β
β "The swap was executed correctly" β
β βββββββββββββββββββββββββββββββββ β
β Public: intent_hash, output_commitment, recipient, min_output β
β Private: actual_output, oracle_attestation β
β Proves: output >= min_output with oracle verification β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Install Nargo (Noir's package manager)
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noirup
# Clone the repository
git clone https://github.com/sip-protocol/circuits.git
cd circuits# Compile a circuit
cd funding_proof
nargo compile
# Run tests
nargo test
# Get circuit info (constraint count)
nargo info
# Generate a proof (requires Prover.toml)
nargo prove
# Verify a proof
nargo verify# From circuits root
cd funding_proof && nargo test && cd ..
cd validity_proof && nargo test && cd ..
cd fulfillment_proof && nargo test && cd ..Proves that a user has sufficient balance without revealing the actual amount.
Use case: Pre-validate that user can afford a swap before execution.
// Public Inputs
commitment_hash: [u8; 32] // Hash of Pedersen commitment to balance
minimum_required: u64 // Minimum balance required
asset_id: Field // Asset identifier
// Private Inputs (never revealed)
balance: u64 // Actual user balance
blinding: Field // Commitment blinding factorVerification:
- Recompute commitment from
balanceandblinding - Verify commitment hash matches public input
- Assert
balance >= minimum_required
Proves intent authorization without revealing sender identity.
Use case: Authorize a swap intent while hiding who's swapping.
// Public Inputs
intent_hash: Field // Hash of the intent
sender_commitment_x: Field // Commitment X coordinate
sender_commitment_y: Field // Commitment Y coordinate
nullifier: Field // Prevents double-spending
timestamp: u64 // Current timestamp
expiry: u64 // Intent expiry time
// Private Inputs (never revealed)
sender_address: Field // Actual sender address
sender_blinding: Field // Commitment blinding
sender_secret: Field // For nullifier derivation
pub_key_x: [u8; 32] // ECDSA public key X
pub_key_y: [u8; 32] // ECDSA public key Y
signature: [u8; 64] // ECDSA signature
message_hash: [u8; 32] // Signed message hash
nonce: Field // Unique nonceVerification:
- Verify ECDSA signature on message
- Verify sender commitment matches address
- Verify nullifier derivation
- Check timestamp within expiry
Proves correct swap execution with oracle attestation.
Use case: Verify solver delivered correct output amount.
// Public Inputs
intent_hash: Field // Intent being fulfilled
output_commitment_x: Field // Output commitment X
output_commitment_y: Field // Output commitment Y
recipient_stealth: Field // Stealth delivery address
min_output_amount: u64 // Required minimum output
solver_id: Field // Solver identifier
fulfillment_time: u64 // When fulfilled
expiry: u64 // Must fulfill before
// Private Inputs (never revealed)
output_amount: u64 // Actual delivered amount
output_blinding: Field // Commitment blinding
solver_secret: Field // Derives solver_id
oracle_recipient: Field // Oracle-attested recipient
oracle_amount: u64 // Oracle-attested amount
oracle_tx_hash: [u8; 32] // Transaction hash
oracle_block: u64 // Block number
oracle_signature: [u8; 64] // Oracle signature
oracle_message_hash: [u8; 32] // Signed message
oracle_pub_key_x: [u8; 32] // Oracle public key
oracle_pub_key_y: [u8; 32]Verification:
- Verify oracle signature on attestation
- Verify output commitment matches amount
- Assert
output_amount >= min_output_amount - Verify solver_id derivation
- Check fulfillment within expiry
circuits/
βββ funding_proof/
β βββ Nargo.toml # Circuit manifest
β βββ src/
β β βββ main.nr # Circuit implementation
β βββ target/
β βββ funding_proof.json # Compiled artifact
β
βββ validity_proof/
β βββ Nargo.toml
β βββ src/
β β βββ main.nr
β βββ target/
β βββ validity_proof.json # β
Compiled
β
βββ fulfillment_proof/
β βββ Nargo.toml
β βββ src/
β β βββ main.nr
β βββ target/
β βββ fulfillment_proof.json # β
Compiled
β
βββ README.md
βββ CLAUDE.md
Private Inputs + Public Inputs β Noir Circuit β ACIR β Barretenberg β Proof
β
βΌ
SDK Verifies Proof
(Browser or Server)
| Primitive | Usage | Noir Standard Library |
|---|---|---|
| Pedersen Hash | Commitments, nullifiers | std::hash::pedersen_hash |
| BLAKE3 | Commitment binding, message hashing | std::hash::blake3 |
| ECDSA secp256k1 | Signature verification | std::ecdsa_secp256k1::verify_signature |
- Pedersen: Additively homomorphic, efficient in ZK circuits
- BLAKE3: Fast, secure, small circuit size
- ECDSA secp256k1: Compatible with Ethereum/Bitcoin signatures
Compiled JSON artifacts are used by the SDK's NoirProofProvider:
import { NoirProofProvider } from '@sip-protocol/sdk'
// Initialize provider (loads WASM)
const provider = new NoirProofProvider()
await provider.initialize()
// Generate a funding proof
const result = await provider.generateFundingProof({
balance: 100n,
minimumRequired: 50n,
blindingFactor: new Uint8Array(32),
assetId: '0xABCD',
})
console.log(result.proof) // Proof bytes
console.log(result.publicInputs) // Public inputsCircuits are optimized for browser execution via WASM:
import { BrowserNoirProvider } from '@sip-protocol/sdk'
// Browser-compatible proving
const provider = new BrowserNoirProvider()
await provider.initialize()
// Proof generation happens client-side
const proof = await provider.generateFundingProof({ ... })nargo compile # Compile circuit to ACIR
nargo test # Run circuit tests
nargo info # Show constraint count
nargo prove # Generate proof (needs Prover.toml)
nargo verify # Verify proof
nargo check # Type check without compiling// In src/main.nr
#[test]
fn test_valid_funding() {
let balance = 100;
let minimum = 50;
let blinding = 12345;
// This should pass
main(
pedersen_hash(balance, blinding),
minimum,
1, // asset_id
balance,
blinding
);
}
#[test(should_fail)]
fn test_insufficient_balance() {
let balance = 30;
let minimum = 50;
// This should fail: 30 < 50
main(...);
}- Create directory:
mkdir new_circuit && cd new_circuit - Initialize:
nargo init - Implement circuit in
src/main.nr - Add tests
- Compile:
nargo compile - Integrate with SDK
Detailed specifications in documentation:
| Spec | Link |
|---|---|
| Funding Proof | docs.sip-protocol.org/specs/funding-proof |
| Validity Proof | docs.sip-protocol.org/specs/validity-proof |
| Fulfillment Proof | docs.sip-protocol.org/specs/fulfillment-proof |
| Project | Description | Link |
|---|---|---|
| sip-protocol | Core SDK (uses compiled circuits) | GitHub |
| docs-sip | Circuit specifications | docs.sip-protocol.org |
| Noir | ZK DSL documentation | noir-lang.org |
| Barretenberg | Proving backend | GitHub |
MIT License β see LICENSE file for details.
π Zypherpunk Hackathon Winner ($6,500) | #9 of 93 | 3 Tracks
Privacy is not a feature. It's a right.
Documentation Β· Noir Docs Β· Report Bug
Part of the SIP Protocol ecosystem