Skip to content

Latest commit

 

History

History
189 lines (133 loc) · 6.71 KB

File metadata and controls

189 lines (133 loc) · 6.71 KB

CAP-0059 Analysis: Relevance to OpenZKTool

Executive Summary

CAP-0059 is highly relevant to this project. It introduces native BLS12-381 cryptographic operations to Soroban, specifically designed to enable zero-knowledge proof verification in smart contracts. This directly aligns with OpenZKTool's mission.

Key consideration: OpenZKTool currently uses BN254 (BN128) curve with Groth16 proofs, while CAP-0059 standardizes BLS12-381. This creates both an opportunity and a strategic decision point.


What is CAP-0059?

CAP-0059 ("BLS12-381 Host Functions") adds 11 new cryptographic host functions to Soroban smart contracts:

Capabilities Added

Curve Operations:

  • Point addition and scalar multiplication on G1 and G2 groups
  • Multi-scalar multiplication (MSM) for batch operations
  • Hash-to-curve operations (RFC 9380 compliant)

Field Arithmetic:

  • Modular operations on Fr scalar field
  • Scalar inversion for division

Why This Matters: These operations are the foundation for:

  • Zero-knowledge proof verification
  • BLS signatures
  • Polynomial commitments
  • Advanced cryptographic protocols

Relevance to OpenZKTool

✅ Direct Alignment

Problem Space: CAP-0059 exists because "Pairing friendly elliptic curve operations are the backbone of many advanced Zero Knowledge (ZK) constructions" - exactly what OpenZKTool provides.

Use Case Overlap:

  • Privacy-preserving verification
  • Identity management
  • Scaling solutions
  • Compliance + privacy

Strategic Positioning: OpenZKTool demonstrates these use cases working TODAY on Stellar, making it a compelling early example of what CAP-0059 will enable at scale.

⚠️ Curve Mismatch

Current Implementation:

  • OpenZKTool: BN254 (BN128) curve
  • Groth16 proving system
  • Verified with custom pairing operations

CAP-0059 Standard:

  • BLS12-381 curve
  • Native Soroban host functions
  • Optimized cost metering

Implication: OpenZKTool contracts currently implement pairing verification in Rust/WASM. CAP-0059 will enable much more efficient verification using native host functions - but requires migrating to BLS12-381.


Strategic Options

Option 1: Dual Support (Recommended)

Short term: Continue BN254 implementation

  • Proven, working today
  • Extensive tooling (snarkjs, circom, many audited implementations)
  • Demonstrates ZK capabilities immediately

Long term: Add BLS12-381 support when CAP-0059 is live

  • Native Soroban support = lower gas costs
  • Future-proof for Stellar ecosystem
  • Align with ecosystem standards

Migration Path:

  1. Keep BN254 circuits working (2024-2025)
  2. Add BLS12-381 circuit variants (when CAP-0059 launches)
  3. Update Soroban contract to use host functions
  4. Maintain both for compatibility period
  5. Eventually deprecate BN254 once ecosystem migrates

Option 2: Early Migration

Approach: Migrate to BLS12-381 now

  • Align with future Stellar standard
  • Prepare for native host function integration
  • Requires significant circuit rewrites

Trade-offs:

  • Less mature tooling ecosystem
  • More complex initial implementation
  • Positions as "CAP-0059 ready"

Technical Comparison

Aspect BN254 (Current) BLS12-381 (CAP-0059)
Curve Type Barreto-Naehrig Barreto-Lynn-Scott
Security Level ~100 bits (controversial) 128 bits (strong)
Pairing Efficiency Fast, but aging Industry standard
Tooling Excellent (snarkjs, etc.) Growing
Soroban Support Custom implementation Native host functions
Gas Cost Higher (WASM pairing) Lower (native operations)
Ecosystem EVM standard Stellar future standard

Recommendations

For SDF Presentation

Message: "OpenZKTool demonstrates the exact use cases that CAP-0059 is being built for - privacy-preserving verification on Stellar. We're showing what's possible today, and we're ready to adopt CAP-0059 when it launches for even better performance."

Positioning:

  1. Early adopter of ZK on Stellar
  2. Proof of concept for CAP-0059 use cases
  3. Migration path defined for BLS12-381 adoption

Technical Roadmap

Phase 1 (Current): BN254 + Custom Pairing

  • Demonstrate working ZK on Soroban
  • Prove feasibility of privacy-preserving contracts
  • Build developer tools and documentation

Phase 2 (CAP-0059 Launch): Add BLS12-381 Support

  • Rewrite circuits for BLS12-381
  • Update Soroban contract to use host functions
  • Benchmark gas cost improvements

Phase 3 (Future): Ecosystem Standard

  • Publish BLS12-381 circuit library
  • Integrate with CAP-0059 ecosystem tools
  • Maintain backward compatibility where needed

Non-Technical Explanation

What CAP-0059 Does: Imagine you want to verify a secret password, but checking if the password is correct takes a very long time and costs money. CAP-0059 adds special built-in tools to Stellar that make this verification much faster and cheaper.

How OpenZKTool Relates: OpenZKTool is like a working example of why those tools are needed. We show that you can verify private information (like KYC checks) without revealing the details. Right now, we use our own method that works but is slower. When CAP-0059 is ready, we can switch to the faster built-in tools.

Simple Analogy:

  • OpenZKTool: Solving math problems with a calculator you built yourself
  • CAP-0059: Stellar adding a built-in scientific calculator
  • Future: Using the built-in calculator because it's faster and cheaper

Why Both Matter:

  • We prove it works NOW
  • CAP-0059 makes it work BETTER later
  • Together they show Stellar is serious about privacy

Conclusion

Does CAP-0059 serve this project? Yes, absolutely. CAP-0059 provides the native infrastructure that will make OpenZKTool's verification dramatically more efficient on Stellar.

Why it doesn't serve us YET:

  • CAP-0059 is a future upgrade, not live today
  • Requires curve migration (BN254 → BLS12-381)
  • Native host functions need Soroban contract updates

Strategic Value: OpenZKTool demonstrates the demand for what CAP-0059 will enable. This positions the project as:

  1. Early validation of CAP-0059 use cases
  2. Reference implementation for ZK on Soroban
  3. Ready to migrate when ecosystem standards mature

Recommendation: Maintain BN254 implementation for immediate functionality, plan BLS12-381 migration for post-CAP-0059 efficiency gains.


References