Transaction Settlement
Comprehensive technical documentation on how StyxPay settles transactions on Solana with zero-knowledge proofs.
Table of Contents
Settlement Overview
High-Level Architecture
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Frontend │ │ Backend │ │ Solana │
│ (User Sign) │────────▶│ (Generate │────────▶│ (Verify & │
│ │ │ ZK Proof) │ │ Settle) │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
│ │ ▼
│ │ ┌──────────────┐
│ │ │ SPL Token │
│ │ │ Transfer │
│ │ └──────────────┘
│ ▼ │
│ ┌──────────────┐ │
│ │ Store Proof │ │
│ │ & Nullifier │ │
│ └──────────────┘ │
│ │
└─────────────────────Event Emission─────────────┘Settlement Guarantees
Atomicity: Transaction either fully completes or fully reverts
Consistency: State transitions maintain all invariants
Isolation: Concurrent transactions don't interfere
Durability: Committed transactions are permanent (after finality)
Solana Program Architecture
Program Structure
Account Structures
Settlement State Account
User Account
Nullifier Set Account
Account State Management
State Transitions
Merkle Tree Updates
Settlement Flow
1. Instruction: settle_transaction
2. Proof Verification
3. Amount Decryption
Cross-Program Invocations
SPL Token Integration
Associated Token Account Creation
State Synchronization
Off-Chain Indexer
WebSocket Event Stream
Finality & Rollbacks
Commitment Levels
Solana provides three commitment levels:
Processed: Transaction included in a block
Latency: ~400ms
Risk: May be rolled back
Confirmed: Block confirmed by supermajority
Latency: ~1-2s
Risk: Very low rollback probability
Finalized: Block is ancient enough to be finalized
Latency: ~30s
Risk: Zero rollback probability
Handling Rollbacks
Performance Optimization
Parallel Transaction Processing
Compute Unit Optimization
Related Documentation
Last Updated: January 2026 Version: 1.0.0 Authors: StyxPay Engineering Team
Last updated