STARK proving system for VES (Verifiable Event Sync) compliance proofs.
stateset-stark provides cryptographic proofs that VES events satisfy compliance policies without revealing the underlying data. Built on Winterfell, it uses STARKs (Scalable Transparent ARguments of Knowledge) for transparent, post-quantum secure proofs.
Phase 1 implements per-event compliance proofs for the aml.threshold policy:
- Policy: Proves that an encrypted order amount is strictly less than a threshold
- Use Case: AML compliance (e.g., "order total < $10,000") without data exposure
- Integration: Works with
stateset-sequencerproof registry
stateset-stark/
├── crates/
│ ├── ves-stark-primitives/ # Field arithmetic, Rescue hash, public inputs
│ ├── ves-stark-air/ # AIR constraint definitions
│ ├── ves-stark-prover/ # Proof generation
│ └── ves-stark-verifier/ # Proof verification
└── tests/ # Integration tests
use ves_stark_prover::{ComplianceProver, ComplianceWitness};
use ves_stark_air::policies::aml_threshold::AmlThresholdPolicy;
// Create witness with private amount and public inputs
let witness = ComplianceWitness::new(amount, public_inputs);
// Create prover for the policy
let policy = AmlThresholdPolicy::new(10000); // threshold
let prover = ComplianceProver::new(policy);
// Generate proof
let proof = prover.prove(&witness)?;use ves_stark_verifier::verify_compliance_proof_auto;
let result = verify_compliance_proof_auto(&proof.proof_bytes, &public_inputs, &proof.witness_commitment)?;
assert!(result.valid);// POST /api/v1/ves/compliance/{event_id}/proofs
let request = SubmitComplianceProofRequest {
proof_type: "STARK",
proof_version: 2,
policy_id: "aml.threshold",
policy_params: json!({"threshold": 10000}),
proof_b64: base64::encode(&proof.proof_bytes),
witness_commitment: proof.witness_commitment,
public_inputs: Some(public_inputs),
};Canonical public inputs (RFC 8785 JCS canonicalized):
{
"eventId": "uuid",
"tenantId": "uuid",
"storeId": "uuid",
"sequenceNumber": 123,
"payloadKind": 1,
"payloadPlainHash": "hex32",
"payloadCipherHash": "hex32",
"eventSigningHash": "hex32",
"policyId": "aml.threshold",
"policyParams": {"threshold": 10000},
"policyHash": "hex32"
}- Field: Goldilocks (64-bit prime: p = 2^64 - 2^32 + 1)
- Hash: Rescue-Prime (STARK-friendly, algebraic S-box)
- Security: ~100 bits with default options
- Proof Size: ~100-200 KB typical
cargo build --releasecargo test
cargo test --release # For faster proof generationcargo benchMIT