Skip to content

Wallet Exchange Custody Model

Status: controlled-testnet model v0 Date: 2026-05-21 Updated: 2026-10-22 (payment memos, account history and code references)

This document specifies the minimum exchange/custody model for transparent ML-DSA accounts in controlled testnet. It is a product and operations boundary, not a claim that custodian-grade key management, hardware signing, or account history indexing is complete.

Account Semantics

PostFiat transparent accounts are address-key accounts:

  • an address is derived from an ML-DSA public key and is canonically pf + 40 lowercase hex characters;
  • every destination address in a signed transaction must be canonical: nodes reject other values at RPC submission and mempool admission (invalid_recipient_address, invalid_recipient_checksum, noncanonical_recipient_address), and at execution from the governed recipient_format_activation_height;
  • wallets may display and parse an optional mixed-case checksum, specified in docs/wallets/address-format.md with vectors in docs/fixtures/addresses/pftl-address-vectors-v1.json;
  • a funded recipient account may exist before its public key is bound on-chain;
  • the first spend from that account must carry the ML-DSA public key and a valid signature from that key;
  • once the sender account has a public_key_hex, later spends must use the same public key;
  • a different key for an already-bound account is rejected.

Code references:

What Does Not Carry Over From BIP32

ML-DSA does not give PostFiat a BIP32-style public child derivation model. For controlled testnet, custodians must not assume:

  • one public root can derive unlimited deposit addresses;
  • watch-only deposit address generation can happen without custody-side secret material;
  • hardware-wallet or exchange infrastructure can reuse existing secp256k1/xpub workflows unchanged.

The safe v0 posture is: every deposit address is generated by the custodian inside its custody boundary, backed up, mapped to a customer or internal ledger account, and then watched by address.

Deposit Address Model

Use unique transparent addresses per customer, subaccount, or deposit intent. transparent_transfer has no memo field. To require memos on covered payments after the governed require_memo_activation_height, set the account's require-memo flag with account_set, and the ledger then rejects incoming transparent_transfer, issued_payment, and memo-less payment_v2 or issued_payment_v2 with destination_memo_required, so covered deposits carry a memo that the exchange must validate for attribution. Escrow, atomic swap, offer, NFT, bridge and FastPay credits are not covered. See Custody And Exchange.

A deposit registry entry should include at minimum:

  • customer or internal account id;
  • chain id;
  • address;
  • ML-DSA public key hex from wallet_identity_from_backup;
  • wallet backup custody location or KMS reference;
  • account index or internal derivation label;
  • created-at timestamp;
  • status: active, disabled, swept, or recovery_hold;
  • last observed balance and last observed ledger height;
  • optional first-spend binding status.

The backup or seed material is private. The address and public key are safe to store in watch-only systems, but the public key alone cannot spend.

Mnemonic-backed wallet creation is a planned UX layer over the same custody boundary, not a replacement for custody controls. See docs/specs/wallet-mnemonic-design.md for the design. Mnemonic words, BIP39 seed bytes, passphrases, and derived master_seed_hex must be treated as private key material.

Deposit Detection

Controlled-testnet v0 supports address balance polling, tx/finality verification and account history: account_tx reads a disk-backed per-account index (account history). On 25 November 2026 that index was not usable on any of the six validators (an old v3 index, not rebuilt for v4), so their account_tx answers came from the bounded archive scan (Account Tx Index).

Minimum viable attribution flow:

  1. Generate a unique address for the customer/deposit intent.
  2. Persist the address-to-customer mapping before showing the address.
  3. Poll account for the assigned address.
  4. When balance increases, reconcile the delta against the customer mapping.
  5. Find the inbound transaction id with account_tx (or from the sender), query tx and require a confirmed finality summary before crediting.
  6. For controlled testnet, require conservative confirmation policy: credit only after finality RPC validation succeeds against an allowed endpoint.

Account history in source now includes transparent transactions and shielded withdrawals that credit transparent accounts. Native and issued payment_v2 rows expose signed memos, their hash, count and byte length; tx exposes the same rows. After deployment, serving nodes must run account-tx-index-build to replace the old index and backfill retained history.

Code (checked on main, 25 November 2026): account_tx_rows_for_archived_block in crates/node/src/block_finality.rs; the index build rebuild_account_tx_index and the per-block append append_account_tx_index_after_commit in crates/node/src/account_tx_disk_index.rs. Transparent shielded-pool deposits, FastLane primary effects and FastPay certificates still need separate reconciliation. See account history.

Withdrawal Model

Withdrawals are signed from the custody address using the SDK quote-bound flow:

  1. Restore public identity from the wallet backup.
  2. Request a fee quote with from set to that identity address.
  3. Decode the quote response and bind it to the exact original request.
  4. Sign with wallet_sign_transfer_from_quote(backup, request, quote).
  5. Submit the signed transfer through an RPC endpoint that permits writes.
  6. Decode submit response and poll tx finality by submitted tx id.
  7. Persist the finality proof id, block hash, certificate id, registry root, receipt code, and receipt message.

The SDK rejects quote sender, recipient, amount, and explicit-sequence mismatches against the request, plus chain-id mismatches with the wallet backup.

After the governed rejected_tx_fee_activation_height, a withdrawal included in a block but rejected for an effect-level reason returns a tec_<reason> receipt: the fee was burned and the sequence consumed, no amount moved. Re-sign with the next sequence instead of resubmitting the same transaction. See Custody And Exchange.

Watch-Only Constraints

Watch-only systems can safely hold:

  • address;
  • public key hex;
  • customer/internal attribution;
  • observed balances;
  • tx ids and finality summaries;
  • registry-root-backed finality metadata.

Watch-only systems cannot:

  • derive new deposit addresses from a public root;
  • recover a lost backup from the public key;
  • sign a withdrawal;
  • infer all historical deposits without an account-history source;
  • prove future spend authority for an unbound funded account unless the custody system preserved the matching backup.

Recovery And Key Loss

For controlled testnet, recovery is custody-process recovery, not protocol recovery:

  • losing the backup or seed for an address means losing spend authority;
  • the chain cannot rotate an account key after custody loses the original key;
  • backups must be encrypted and tested before an address is shown to a user;
  • a deposit address with uncertain backup status must be disabled immediately;
  • sweeping from old deposit addresses should use ordinary signed transfers into a fresh custody address.

Protocol-level account key rotation remains outside this v0 model and is tracked separately under wallet key-rotation UX.

Controlled-Testnet Exit Criteria

For the first controlled testnet, the exchange/custody model is credible when:

  • unique deposit address assignment is documented;
  • SDK create/restore/sign flow exists and is tested;
  • public RPC account, transfer_fee_quote, submit, and tx finality paths are available;
  • finality summaries include registry-root-backed compact certificates;
  • operators understand that account-history indexing is not yet production;
  • the public claims checklist does not imply hardware-wallet, xpub, or exchange-grade custody support.

Remaining Production Work

  • Deploy the expanded account history and backfill its index (v4 on main); reconcile balance-changing lanes that remain outside account_tx.
  • Hardware-wallet or external signer interface for ML-DSA.
  • Formal backup encryption and recovery standard.
  • BIP39 mnemonic create/import implementation and custody recovery policy.
  • Account key-rotation transaction and wallet UX.
  • Custodian audit packet covering dependency versions, KATs, key lifecycle, signing policy, finality policy, incident handling, and endpoint policy.