Technical Docs

Deep technical documentation for StyxPay's architecture, cryptography, and blockchain implementation.

πŸ“‹ In This Section

Detailed technical dive into the Next.js frontend implementation.

Topics covered:

  • Next.js 15 App Router architecture

  • TypeScript configuration and patterns

  • Tailwind CSS implementation

  • Component architecture (Server vs Client)

  • Styling system and animations

  • State management approach

  • Data fetching patterns

  • Performance optimizations

  • Security considerations

Level: Intermediate to Advanced Time to complete: ~45 minutes


Comprehensive guide to ZK-SNARK implementation for private transactions.

Topics covered:

  • ZK-SNARK Stack: Groth16 proving system on BN254 curve

  • Transaction Settlement Flow: 5-phase settlement process

  • Cryptographic Primitives:

    • Pedersen commitments (amount hiding)

    • Poseidon hash function (ZK-friendly)

    • Nullifiers (double-spend prevention)

    • Sparse Merkle trees (state commitment)

  • Circuit Design: R1CS constraint system (1,266 constraints)

  • Proof Generation: 52.3ms proving time

  • Verification: 2.1ms on-chain verification

  • Privacy Guarantees: Security assumptions and attack resistance

  • Performance Benchmarks: Detailed metrics

Level: Advanced Prerequisites: Understanding of elliptic curve cryptography Time to complete: ~90 minutes


How transactions are settled on Solana with zero-knowledge proofs.

Topics covered:

  • Settlement Overview: End-to-end transaction flow

  • Solana Program Architecture: Account structures and PDAs

  • Account State Management: State transitions and updates

  • Settlement Flow: 11-step settlement process

  • Merkle Tree Updates: Efficient state commitment

  • Cross-Program Invocations: SPL token integration

  • State Synchronization: Off-chain indexers and WebSocket streaming

  • Finality & Rollbacks: Commitment levels and retry logic

  • Performance Optimization: Parallel processing

Level: Advanced Prerequisites: Familiarity with Solana programming model Time to complete: ~60 minutes


Smart contract implementation details for the Solana blockchain.

Topics covered:

  • Program Structure: Module organization and entry points

  • Account Model: Detailed account layouts with byte-level specs

    • Settlement State Account (640 bytes)

    • User Account (416 bytes)

    • Nullifier Set Account (8,337 bytes with bloom filter)

  • Program Derived Addresses: PDA derivation patterns

  • Instruction Processing: Complete instruction handlers

  • Cross-Program Invocations: Token transfers and account creation

  • Compute Budget Management: Gas optimization

  • Security Model: Access control and emergency mechanisms

Level: Advanced Prerequisites: Anchor framework knowledge Time to complete: ~75 minutes


🎯 Learning Path

Path 1: Frontend Developer

  1. Skim ZK Proof System (overview sections)

Path 2: Blockchain Developer

Path 3: Cryptography Researcher

Path 4: Full-Stack Understanding

Complete all documents in order listed above.


πŸ”‘ Key Concepts

Zero-Knowledge Proofs

Transactions are proven valid without revealing amounts or parties involved.

Key metrics:

  • Circuit size: 1,266 constraints

  • Proving time: 52.3 ms

  • Verification time: 2.1 ms

  • Proof size: 128 bytes

Solana Settlement

Fast, low-cost settlement on Solana blockchain.

Key metrics:

  • Throughput: 476 tx/sec

  • Latency: < 240ms

  • Gas cost: ~50,000 CU

  • Finality: ~30 seconds

Cryptographic Stack

  • Curve: BN254 (128-bit security)

  • Hash: Poseidon (50 constraints)

  • Commitments: Pedersen

  • Trees: Sparse Merkle (depth 20)


πŸ“Š Performance Reference

Metric
Value
Notes

Proof Generation

52.3ms

Single-threaded

Proof Verification

2.1ms

On-chain

Proof Size

128 bytes

Groth16

Public Inputs

128 bytes

4 field elements

Throughput

476 tx/sec

Single validator

Latency

< 240ms

End-to-end

Gas Cost

~50,000 CU

Per transaction

Account Size

512 bytes

User account

Tree Capacity

1,048,576

2^20 accounts


πŸ”¬ Code Examples

Each technical document includes production-ready code examples in:

  • Rust (Solana programs, cryptography)

  • TypeScript (Frontend, client SDK)

  • JSON (Configuration, API)

All code is commented and follows best practices.


πŸ†˜ Need Help?


← Getting Started | Main Documentation | Reference Guides β†’

Last updated