Exploring STARK proofs for enhancing Nostr's privacy, scalability, and functionality.
STARKstr is a research project exploring the potential benefits of STARK proofs for the Nostr ecosystem. It serves as a collection of proof of concepts and explorations in this direction.
Our first exploration focuses on enabling relays to strip signatures from events and provide STARK proofs that those signatures were valid. This approach offers several benefits:
- Reduced Bandwidth: Events can be transmitted and archived without signatures
- Batch Verification: Authenticity of multiple events can be verified with a single proof
- Trust Minimization: Clients can verify one proof instead of trusting the relay or validating a lot of signatures
This work is related to NIP PR #1682, which proposes a standard for delegated signature verification.
STARKstr implements a complete proving pipeline for Nostr event signature verification. The system is designed to be modular and extensible, leveraging the power of STARKs to provide cryptographic guarantees.
graph TB
subgraph "Event Generation"
A[Nostr NDK] --> B[Event Signer]
B --> C[JSON Output]
end
subgraph "Cairo VM execution"
C --> D[CLI Parser]
D --> E[Cairo Program]
E --> F[Execution Trace]
end
subgraph "STARK Proof Generation"
F --> G[STWO Prover]
G --> H[STARK Proof]
end
subgraph "Proof Verification"
H --> I[STWO Verifier]
I --> J[Verification Result]
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style E fill:#bbf,stroke:#333,stroke-width:2px
style G fill:#bfb,stroke:#333,stroke-width:2px
style I fill:#fbb,stroke:#333,stroke-width:2px
sequenceDiagram
participant Client
participant NDK as Nostr NDK
participant Cairo as Cairo Program
participant STWO as STWO Prover
participant Verifier as STWO Verifier
Client->>NDK: Generate Events
NDK->>NDK: Sign Events
NDK->>Cairo: Batch Events
Cairo->>Cairo: Verify Signatures
Cairo->>STWO: Execution Trace
STWO->>STWO: Generate Proof
STWO->>Verifier: STARK Proof
Verifier->>Client: Verification Result
-
Nostr Event Generation
- Uses Nostr SDK for event creation
- Generates and signs events with Schnorr signatures
- Outputs events in JSON format
- Extends and encodes event data into Cairo program arguments
-
Batch Signature Verification
- Implements verification of multiple Schnorr signatures in Cairo
- Uses Cairo VM for execution
- Generates execution trace for proving
-
STARK Proof Generation
- Uses STWO Prover for proof generation
- Leverages STWO Cairo AIR for Cairo program proving
- Produces a STARK proof of the integrity of the computation (in this case, the verification of the signatures)
-
Proof Verification
- STWO verifier for proof validation
- Can be run in browsers, Nostr clients, or any environment
- Provides cryptographic guarantees of signature validity of a batch of Nostr events
Check out aggsig_checker docs for the step-by-step usage guide.
Coming soon: We will be adding comprehensive benchmarks to evaluate:
- Proof generation time
- Verification time
- Memory usage
- Network overhead
- Cloud costs
-
Phase 1: Proof of Concept
- ✅ Basic Schnorr signature verification in Cairo
- ✅ Test data generation
- ✅ Batch verification
- ✅ STARK proof generation
-
Phase 2: Benchmarking (Current)
- 🔄 Proof generation time depending on the number of events
- Proof verification time vs total time of signature verification
- Proof size vs total size of signatures
-
Phase 3: Integration
- Relay implementation
- Client libraries
- Documentation
We welcome contributions! Please check our Contributing Guidelines for details on how to submit pull requests, report issues, and contribute to the project.
This project is licensed under the MIT License - see the LICENSE file for details.
- Nostr Protocol
- StarkWare for Cairo and STARK technology
- Alexandria for Cairo utilities
Made with ❤️ by the Nostr community