zk402-core
Core types and traits for the zk402 zero-knowledge payment scheme.
Overview
This crate defines the foundational types, traits, and wire format for the zk402 payment protocol. It provides the abstraction boundaries that allow different proof systems, verifying key registries, and scheme implementations to be swapped without affecting other components.
Key Features
- Zero dependencies on cryptographic libraries - All proving backends are swappable
- Wire format types - Matching the x402 specification
ProofSystemtrait - Abstract interface for proof generation and verificationVerifyingKeyRegistrytrait - Pluggable trust model for circuit verification keysSchemetrait - Standard interface for facilitator implementations
Types
Wire Format Types
PaymentRequirements- Payment terms from the payeePaymentPayload- Complete payment data from the payerPublicInputs- Public inputs to the zero-knowledge proofZkExtra- ZK-specific metadata
Response Types
VerifyResponse- Result of proof verificationSettleResponse- Result of on-chain settlement
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Example of using the core types:
use ;
// Define your proof system implementation
;
Architecture
The zk402-core crate is intentionally minimal and has no cryptographic dependencies. This design allows:
- Proof system flexibility - Swap between Groth16, Halo2, or other systems
- Trust model flexibility - Use static configs, on-chain registries, or custom solutions
- Implementation flexibility - Build facilitators, provers, or custom clients
Related Crates
zk402-groth16- Groth16 proof system implementationzk402-prover- Client-side proof generationzk402-facilitator- Facilitator verify/settle implementationzk402-wasm- WebAssembly bindings for browser clients
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.