Protocol Architecture
End-to-end state transitions across Solana Privacy Rings, Authority Mandates, Confidential Compute, and HTTP 402, plus the three protocol invariants.
Layer composition on Solana L1
Kalo composes four primitives into one Anchor program (kalo_protocol, Program ID 7gvg3hFxPbtSkxjCoPHEXMPSen7X9H21y96JPVBbf47S):
- Solana Privacy Rings: Shielded UTXO commitments (~1,400 CU base transfer, ~192-byte Groth16 proof on Helius SPR) backed by a program-owned SPL
ring_vaultPDA. - Provable Authority Mandates: Versioned on-chain policy PDAs enforcing per-call caps, rolling epoch budgets, service category bitmasks, expiry timestamps, and single-slot revocation.
- Solana Confidential Compute: On-chain
EnclaveRegistryrecords binding Intel TDX and AMD SEV-SNP ephemeral Ed25519 signing keys to hardware measurement hashes and slot expiry windows. - Sealed HTTP 402 Settlement: Per-call
SealedEscrowPDAs that lock funds against a request hash and release atomically only when a matching Ed25519 TEE receipt verifies via Solana's Ed25519SigVerify precompile.
Account graph
| Account | PDA seeds | Purpose |
|---|---|---|
ProtocolConfig | ["protocol_config"] | Global admin, KALO launch_wallet, fee_bps (max 1000), cumulative counters |
PrivacyRing | ["privacy_ring", owner, ring_id_le] | Mint, compliance mode, auditor_key_hash, merkle_root, commitment_count, vault_balance |
ring_vault | ["ring_vault", privacy_ring] | SPL token account holding shielded Ring liquidity, authority = privacy_ring PDA |
AuthorityMandate | ["authority_mandate", privacy_ring, agent_pubkey, version_le] | Delegated agent bounds (per_call_cap, epoch_budget, epoch_spent, category_mask, expires_at, revoked) |
EnclaveRegistry | ["enclave_registry", enclave_pubkey] | Provider authority, hardware type, measurement_hash, attested_slot, expires_slot, service_category, active |
ReputationAccumulator | ["reputation", enclave_pubkey] | settled_count, disputed_count, flow_witness_root, last_updated_slot |
SealedEscrow | ["sealed_escrow", privacy_ring, nullifier] | Locked payment bound to (nullifier, request_hash, enclave_pubkey, commitment_in, amount, fee_amount, timeout_slot, state) |
NullifierSet | ["nullifier", privacy_ring, nullifier] | Single-use spend marker preventing UTXO replay across lock_sealed_402 and unshield_withdraw |
Four-stage settlement state machine
Stage 1: 402 Challenge (off-chain, <6ms p99 PII strip)
Agent -> Provider: POST /endpoint (PII headers removed)
Provider -> Agent: HTTP 402 { requestHash, priceCommitment, amountBaseUnits, providerAddress, enclavePubkey }
Stage 2: Shielded Lock (on-chain, ~45,000 CU est.)
Agent -> kalo_protocol::lock_sealed_402
Checks: !revoked, clock < expires_at, enclave active & unexpired,
(category_mask & service_category) != 0,
amount <= per_call_cap, epoch_spent + amount <= epoch_budget,
ring.vault_balance >= amount, NullifierSet PDA uninitialized
Result: SealedEscrow created in state = 0 (Locked), timeout_slot = clock.slot + timeout_slots
Stage 3: TEE Execution & Receipt (off-chain inside Intel TDX / AMD SEV-SNP)
Agent -> Provider: POST /endpoint with header X-Kalo-Escrow: <escrow_pda>
Provider verifies SealedEscrow, executes workload, computes:
output_hash = SHA256(serialized_response)
digest = SHA256(escrow_pda || request_hash || output_hash)
signature = Ed25519Sign(enclave_secret, digest)
Stage 4: Atomic Release (on-chain, ~55,000 CU est.)
Relayer -> [Ed25519SigVerify precompile, kalo_protocol::settle_with_receipt]
Checks: escrow.state == 0, enclave active & unexpired, Ed25519 precompile matches (enclave_pubkey, digest)
Result: ring_vault transfers (amount - fee_amount) -> provider_token_account,
fee_amount -> launch_wallet_token_account,
escrow.state = 1 (Settled), ReputationAccumulator incrementedIf Stage 4 does not land before clock.slot > escrow.timeout_slot, any caller invokes refund_expired_escrow. escrow.state becomes 2 (Refunded), escrow.amount returns to privacy_ring.vault_balance, and reputation_accumulator.disputed_count increments.
Three protocol invariants
- No unauthorized spend:
lock_sealed_402succeeds only whenmandate.revoked == false,clock.unix_timestamp < mandate.expires_at,(mandate.category_mask & enclave.service_category) != 0,amount <= mandate.per_call_cap,epoch_spent + amount <= mandate.epoch_budget, and theNullifierSetPDA for(privacy_ring, nullifier)does not yet exist. - No payout without attested execution:
settle_with_receiptreleases funds fromring_vaultonly when an Ed25519SigVerify precompile instruction in the same transaction verifiesenclave_registry.enclave_pubkeyoverSHA256(escrow_pda || request_hash || output_hash)andenclave_registryis active and unexpired. - Conservation of value: Protocol fee
fee_amount = floor(amount * fee_bps / 10_000)rounds down so the provider keeps any remainder.provider_payout = amount - fee_amount, soprovider_payout + fee_amount == escrow.amounton every settled escrow.
Event indexing
Every instruction emits structured events through Anchor #[event_cpi] (emit_cpi!), writing event payloads into self-CPI instruction data rather than transaction logs. Indexers decode inner instructions reliably even when outer transaction logs exceed Solana's 10,000-byte log cap.
Why Solana L1
- Sub-second finality: HTTP 402 calls run inside request/response timeouts. Solana slot times (~400ms baseline; ~200ms with Alpenglow) allow lock and release inside a single agent tool call.
- Parallel PDA execution: Each call allocates its own
SealedEscrowandNullifierSetPDAs, avoiding global lock contention across concurrent agents. - Native L1 primitives: Both Helius Privacy Rings and Solana Confidential Compute execute directly on Solana L1 without bridges or sidechains.