Skip to main content

Architecture Overview

zkCoins is a web wallet built on the Shielded CSV protocol. The architecture separates cryptographic operations (browser-side WASM), account management (Rust backend), and commitment anchoring (Bitcoin blockchain).

System diagram

┌──────────────────────────────────────────────────────────┐
│ Browser │
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Wallet UI │──▶│ WASM Crypto │ │ Zustand │ │
│ │ (Next.js) │ │ (Rust→WASM) │ │ (State) │ │
│ │ │ │ │ │ │ │
│ │ - Balance │ │ - BIP32 HD │ │ - Account │ │
│ │ - Send │ │ - Schnorr │ │ - TX Log │ │
│ │ - Receive │ │ - secp256k1 │ │ - Storage │ │
│ └──────┬──────┘ └──────────────┘ └──────────────┘ │
│ │ │
└─────────┼────────────────────────────────────────────────┘
│ REST API

┌──────────────────────┐ ┌──────────────────────┐
│ Rust/Axum Backend │────▶│ Bitcoin Blockchain │
│ (api.zkcoins.app) │ │ │
│ │ │ Taproot Inscriptions │
│ - Account Server │ │ (64-byte nullifiers) │
│ - SP1 Prover │ └──────────────────────┘
│ - Chain Scanner │
│ - Publisher │ ┌──────────────────────┐
│ │────▶│ SP1 zkVM │
│ State: │ │ (Succinct) │
│ - Sparse Merkle Tree│ │ │
│ - Merkle Mt. Range │ │ Recursive ZK Proofs │
└──────────────────────┘ └──────────────────────┘

Design principles

  1. Privacy first — every architectural decision prioritizes hiding transaction details from observers
  2. No consensus changes — the protocol works on Bitcoin today, no soft fork needed
  3. Client-side validation — receivers validate transactions, not the network
  4. Minimal on-chain footprint — 64 bytes per transaction, nothing more
  5. Self-custodial — keys are generated and controlled by the user, never sent to a server

Component overview

ComponentTechnologyPurpose
WalletNext.js 14, Tailwind, ZustandUser interface for sending and receiving
WASM CryptoRust → WebAssemblyBIP32 key derivation, Schnorr signatures
BackendRust, AxumAccount management, proof generation, chain scanning
SP1 CircuitSP1 zkVM (Succinct)Recursive Zero-Knowledge proof circuit
PublisherRustBitcoin Taproot Inscription broadcasting

What's different from traditional CSV

Shielded CSV improves on existing Client-Side Validation protocols (RGB, Taproot Assets):

FeatureRGB / Taproot AssetsShielded CSV
PrivacyTransaction history visible to sender & receiverFull privacy via ZK proofs
Proof sizeGrows with transaction historyConstant (independent of history)
On-chain dataFull Bitcoin transaction (~560 WU)64-byte nullifier
VerificationReceiver validates full historyReceiver verifies one ZK proof
Double-spendFull Bitcoin transactionSingle Schnorr signature