CHAPTER 11 of 11 · PLANNED

Trustless Payment Channels

Chapter 10 proved the economics on trust. This chapter removes the trust — an on-chain escrow that lets the publisher get paid even if the reader disappears, and lets the reader reclaim every unspent cent.
DESIGN SPEC
This is a design, not a build. It defines exactly how a trustless micropayment channel would work on Solana so it can be built later — once stakeholders understand the why. It requires a custom on-chain program and a mandatory third-party security audit before any real funds. Effort: weeks, not days.

Why: The Trust Gap in Chapter 10

Chapter 10's "open tab" model is honest but trusting. It carries two asymmetric risks:

Risk 1 — the reader can walk. Paragraphs are served before settlement. A reader can consume the whole session off-chain and simply never settle. The publisher already gave up the content.

Risk 2 — the publisher could over-charge. In Chapter 10 the server holds the voucher-signing key and is authoritative on price. That HMAC key is the publisher's own secret — it proves nothing to the reader. A hostile publisher could, in principle, claim more reads than happened.

A trustless channel makes neither party trust the other. The reader locks a deposit in an on-chain program up front. The publisher can only ever withdraw what the reader cryptographically signed for with their own wallet key. The reader can always reclaim the unspent remainder after a timeout. The Solana program is the referee — not the server, not the publisher.

reader locks deposit on-chain → reads · reads · reads (off-chain, reader-signed vouchers) → publisher redeems latest voucher on-chain · reader reclaims remainder

The On-Chain Program (Anchor / Rust)

A unidirectional payment channel (payer → payee) — simpler than a bidirectional channel and sufficient for reader→publisher. Funds are escrowed in a vault token account owned by a Channel PDA; only the program can move them.

Channel state account (PDA: ["channel", payer, payee, channel_id])

FieldTypeMeaning
payerPubkeyReader's wallet — the only valid voucher signer
payeePubkeyPublisher's wallet (PayTo)
mintPubkeyUSDC mint
depositu64Total USDC base units escrowed at open
claimedu64Amount already withdrawn by payee (starts 0)
sequ64Highest voucher sequence redeemed (monotonic anti-replay)
expiry_unixi64After this, payer may reclaim the remainder

Instructions

The invariant: the program never lets the payee take more than the payer signed for, and never strands the payer's unspent funds past expiry. Correctness is enforced at redemption time by the program — no challenge period needed.

The Voucher: Real ed25519 (not HMAC)

This is the core upgrade over Chapter 10. There, the voucher is HMAC-signed by the server (a shared secret meaningful only to the publisher). Here, the voucher is ed25519-signed by the reader's own wallet key — the same key that owns the deposit. The signature is now meaningful to a neutral third party: the on-chain program.

Canonical voucher message (the bytes the wallet signs)

domain_tag || channel_pda || cumulative_u64_le || seq_u64_le

Per read: the reader signs a new voucher with cumulative += price, seq += 1. The publisher serves instantly by verifying the signature off-chain (cheap, no RPC) and checking cumulative <= deposit and monotonic seq. No on-chain transaction during reading — same instant UX and one-fee economics as Chapter 10. The publisher redeems by submitting the latest voucher to close_with_voucher; because the program re-verifies the signature and enforces the bounds, the publisher can never over-claim or replay an old voucher.

On-chain ed25519 on Solana: a program can't verify ed25519 via a syscall directly. The established pattern is to include a native Ed25519Program verify instruction in the same transaction and have close_with_voucher introspect the instructions sysvar to confirm a matching verification for (payer pubkey, message, signature). This is fiddly and audit-sensitive — it's where most channel-program bugs live.

Dispute, Timeout & Griefing

What Changes vs. Chapter 10

DimensionChapter 10 (built)Chapter 11 (this spec)
Voucher signerHMAC — publisher's secreted25519 — reader's wallet
DepositLogical cap in server memoryReal USDC escrowed on-chain
SettlementOpen tab — trust reader to payTrustless on-chain redemption
Reader abandonsPublisher loses contentPublisher redeems signed vouchers
Publisher over-chargesPossible (holds the key)Impossible (bounded by reader's signature)
AuthorityThe serverThe on-chain program
Effort / riskDays, no on-chain codeWeeks + mandatory audit; real funds in a program

Prior Art

This is a focused implementation of a well-known pattern, not new cryptography. Payment / state channels generally follow "deposit → off-chain signed balance updates → settle." Bitcoin's Lightning Network is the famous bidirectional analogy; ours is the simpler unidirectional case (payer→payee), which avoids Lightning's routing and HTLC complexity. Solana has community payment-channel and streaming programs and the standard PDA-escrow + ed25519-sysvar-introspection patterns, but no single canonical channel standard the way Lightning is for Bitcoin — so we would build and audit a focused implementation rather than integrate a named third-party protocol.

Open Design Questions (resolve before build)

1. Per-read signing UX. Per-paragraph wallet prompts are a non-starter. We need a delegated session key (an ephemeral keypair authorized at open_channel) so the reader isn't prompted on every read. This changes the program: the voucher signer becomes the session key, not the wallet directly. Biggest unknown — warrants a dedicated design spike.
2. Post-expiry redemption policy. Hard cutoff at expiry vs. payee-priority race. Affects program logic; hard cutoff + generous expiry is the cleaner default.
3. Incremental vs. single redemption. Let the payee close_with_voucher multiple times (better liveness, more fees) or only once at the end (one fee, more abandon exposure before redemption).
4. Devnet-only until audited. Strongly recommended — real funds only after a third-party smart-contract audit. Real funds locked in a program means a bug equals lost user money.
The arc. Chapter 10 proves the economics — many sub-cent reads, one settlement, ~87% less in fees. Chapter 11 closes the trust gap — same one-fee economics, zero trust required. Build 10 to show the why; build 11 when the why has landed.

Design spec authored by the architecture team, 2026-06-02. Not yet implemented. Requires a custom Anchor program, a delegated-session-key signing scheme, devnet hardening, and a mandatory third-party security audit before it holds real funds.