Payments & ecash

A Pact only coordinates; the payment layer enforces value. Double-spend state lives in one small replaceable service — never in every node, never a global ledger.

The seam

Every adapter implements exactly this:

trait PaymentAdapter {
    fn reserve(&mut self, pact, payer, payee, amount) -> Result<()>;
    fn capture(&mut self, pact) -> Result<()>;   // release to payee
    fn refund(&mut self, pact) -> Result<()>;     // return to payer
    fn balance(&self, node) -> u64;
}

The flow during a job: reserve on Reservedcapture on Settledrefund on Refunded.

LocalCredit

The default in-memory prepaid-credits adapter — a test adapter that exercises the reserve/capture/refund boundary. Not a network currency.

Real Chaumian ecash

src/ecash.rs is genuine cryptography — the Blind Diffie–Hellman Key Exchange (BDHKE) scheme Cashu uses, on Ristretto255 (curve25519-dalek).

issue:   client picks secret x, r;  Y = H2C(x);  sends B_ = Y + r·G
         mint returns C_ = k·B_
         client unblinds C = C_ − r·K = k·Y      → token (x, C)
redeem:  present (x, C); mint checks k·H2C(x) == C and x unspent

Supply is bounded by a backing ceiling (set_backing); the mint refuses to issue past it.

Wallet (alternative adapter)

src/wallet.rs keeps a simpler Ed25519-signed-transfer ledger — useful where you want a plain balance model instead of bearer tokens.

Treasury & grants

A small protocol fee accrues to a treasury account. When resources suffice, a council posts a grant; a deterministic evaluator gates the payout; the treasury funds a new capability. No committee, no emissions — replay is the judge. Authorized by a GrantPayout(SignedSpend) signed by the treasury authority.

Continue to CLI reference.