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

  1. Atomicity: Transaction either fully completes or fully reverts

  2. Consistency: State transitions maintain all invariants

  3. Isolation: Concurrent transactions don't interfere

  4. 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:

  1. Processed: Transaction included in a block

    • Latency: ~400ms

    • Risk: May be rolled back

  2. Confirmed: Block confirmed by supermajority

    • Latency: ~1-2s

    • Risk: Very low rollback probability

  3. Finalized: Block is ancient enough to be finalized

    • Latency: ~30s

    • Risk: Zero rollback probability

Handling Rollbacks


Performance Optimization

Parallel Transaction Processing

Compute Unit Optimization



Last Updated: January 2026 Version: 1.0.0 Authors: StyxPay Engineering Team

Last updated