Funded-note privacy boundary
Native ingress requiressenderFundingMode: "tcap_funded_note_v1", the wallet-signed payment message and restricted fundingNote material containing version 1, secret, blinding and commitment. Initial /intents forbids a signed deposit or bank context. Receiver validates scalar encodings and sender signature, encrypts the original approval and preserves its immutable commitment. Node performs slow authorization, recipient, asset and source-balance checks before FUNDING_READY. Its private preflight remains encrypted; a balance check reserves no funds. Public coordination and Cranker funding views omit the opening, while Receiver’s ingress operator can observe the HTTP body.
The sender then uses the owner-authenticated Node readiness/completion APIs, obtains a fresh hash and signs the exact deposit. Node alone can invoke Receiver’s internal POST /api/internal/node/work/funding. Atomic attachment requires version, initial commitment and unexpired signed readiness, merges only wire/context, and creates settlement under the completed funding commitment. Exact retries reconcile the same attachment; replacements fail. FUNDING_READY never wakes or leases a Cranker. Node’s final wire checks and simulation precede VERIFIED; the saved attestation, lease context and encrypted original remain available across later states.
The settlement projection contains the canonical global fundingRootAccount and thirteen proof inputs, with the funded root at index 12. It excludes note commitment, secret, blinding and membership paths. Receiver sanitizes the authorization transition and nested proof fields, then requires its public commitment to match verified work before storing it. Funded-tree/verifier setup and fresh proving artifacts must match this source contract; source and offline checks do not establish a deployed credit.
Storage and configuration
Receiver’s directory-localgit:commit:push:all publishes only its package to bigdreamsweb3/tsn-receiver on main, matching package.json. Its git:pull:all fetches Receiver tracking metadata without merging source. In a protocol checkout these commands use separate publication metadata and preserve the protocol branch/index; review the package procedure before publishing the complete local snapshot, including deletions. Service configuration and API behavior are unchanged.
The implementation selects local storage only when both TSN_RECEIVER_STORE=file and TSN_ALLOW_LOCAL_JSON_STORE=true. TSN_RECEIVER_LOCAL_FILE selects the local JSON file. Hosted operation uses a private D1 JSON record store; its URL/token are server-only and the namespace must already be initialized. Firebase storage/authentication is retired. The local implementation supports controlled development and does not establish shared, multi-process production durability.
The local file is an ordered manifest with individual work documents in its <file>.d companion directory, grouped by existing TCAP accounting epoch and work kind. Funding/TIN work stays unassigned; settlement is unassigned until a stored verified transition provides an accounting epoch. Original work IDs and API projections remain unchanged. Runtime accepts only this canonical format: an old monolithic anchor fails with TSN_RECEIVER_LOCAL_MANIFEST_INVALID without automatic import, backup creation or replacement. A missing anchor starts an empty new store, and locked journal recovery preserves multi-document updates. Protect the complete store together and inspect work through the documented Receiver API; this storage layout does not establish hosted D1 parity or prove settlement. See the service architecture for component contracts.
Ordinary document reads load their indexed record, while queries read their collection in manifest order. Every read validates the complete index and its selected files without caching. Initialization compaction, mutations and journal recovery still validate all indexed payloads. Shared lock scheduling retains a finite acquisition budget, so overloaded local requests may still return TSN_RECEIVER_LOCAL_STORE_BUSY.
TSN_RECEIVER_COLLECTION and TSN_RECEIVER_STATE_COLLECTION identify work and Node state collections. TSN_RECEIVER_NODE_API_KEY authenticates Node work/state requests. TSN_NODE_VERIFICATION_PUBLIC_KEY verifies Node decisions, while TSN_RECEIVER_NODE_PAYLOAD_KEY protects stored Node envelopes. These roles are separate: an API key does not make a decision signature valid. Node primary/fallback URLs, the selected RPC and existing program ID must agree with the worker and chain configuration.
Use the existing environment example for variable names and the storage-mode runbook for deployment constraints. Example URLs and IDs describe configuration, not verified current availability. Keep private keys, payload keys and service tokens out of browser builds and logs.
Build, tests and launch
These commands are existing root scripts; execute the launch command only when operating the intended environment:Observe and diagnose
After the corresponding Node repair,POST /api/internal/node/work/retry can requeue a settlement rejected with GPRU_HIDDEN_HEAD_WITNESS_UNAVAILABLE:, TCAP settlement asset is unavailable or its reserve binding is invalid, TCAP_FUNDING_ROOT_CHANGED_BEFORE_SETTLEMENT, GPRU transaction record is missing its twelve public hidden-head inputs or the former parser error TIP creation transaction version or signature is invalid. The endpoint requires TSN_RECEIVER_NODE_API_KEY, JSON {id, expectedVersion}, the original confirmed funding, deterministic settlement lineage and the same payload commitment. It rejects execution state and other reasons, archives the rejection in retryHistory and wakes Node for fresh verification of settlement. Local isolated-store and authentication tests cover the retry; live recovery remains unverified.
A single genuine confirmed deposit supports credit without creating a pool account or waiting for another depositor. The canonical global funding account authenticates current and up to 128 retained root/count records. New deposits within that window preserve funded membership; a retired root requires fresh unsigned verification. The latest shared head/nullifier state remains mandatory for one-time spending. Exact allowed HTTP 409 retired-funding-root, shared-root, epoch, route or authorization-expiry conflicts can return unsigned native work to RECEIVED through authenticated current-version retry. Credit retries retain confirmed funding, immutable lineage, the same note/nullifier and absence-of-execution checks. Saved signatures require reconciliation.
The root utility scripts/retry-settlement-snapshot.py previews the settlement’s current version with --work-id and reads the configured Node credential without printing it. Run it with the previewed --expected-version and explicit --execute to requeue settlement and allow later Cranker submission. Reconcile known signatures before recovery, load corrected services and preserve confirmed funding.
GET /api/health, GET /api/work and GET /api/work-status/[id] provide health or sanitized coordination views. Retain work ID, status, state version, reason and transaction signature when diagnosing failures. Avoid exporting the raw database or decrypted Node payload. A healthy process does not imply that the prover, recipient schema or chain accounts are ready.
For staged funding, status-by-ID adds fundingPhase, stateVersion, fundingReady, authorizationPayloadCommitment and readiness expiry/commitment. Its settlement is null before attachment; public status exposes no note, authorization message/signature, resolved preparation accounts, private preflight or amount. Owner funding preparation is a separate authenticated Node response. Existing historical status records preserve their earlier projection.
Node workers lease through /api/internal/node/work; Crankers authenticate through their wallet challenge/session flow and claim through /api/cranker/work. Receiver checks the signed Node execution projection before verified work is executable. Cranker lease requests have a specific implemented rate limit; this does not imply that every public Receiver endpoint has the same protection. Read the service API boundaries for request/error behavior.
Node work PUT renews only an unexpired NODE_VERIFYING claim whose owner, work version, lease ID and lease version match. Renewal extends the 60-second expiry and preserves the signed decision context; it cannot revive a completed, expired or reassigned claim. Load the corrected Node and Receiver together so long proof generation can renew its claim. Expired active claims can be reclaimed by normal leasing; this is separate from the guarded retry of REJECTED settlement.
For an HTTP 409, check expected state version, lease owner/expiry and the Node attestation projection against current source. Do not turn a rejected decision into VERIFIED by editing stored state. For missing funding confirmation, inspect the original chain signature before reconstructing work; a sender-signed deposit with an expired blockhash needs fresh sender approval. A shared balance-root change or later funded-tree append requires Node to prove against the current roots using the same funded note and nullifier.
Upgrade and recovery
Preserve durable work and configured identities during upgrades. Reconcile Receiver’s payload/attestation projection with Node and Cranker before switching worker versions; compare current root/verifier settings separately from application deployment. Keep any owner schema migration as an explicitly reviewed one-time operation. Never interpret an old local store as proof of the newly deployed program’s state. If a restart is required, take an appropriate protected storage backup and preserve unresolved signatures for reconciliation. A local store reset discards coordination history and belongs to a controlled development procedure, not routine payment recovery. The internal operations record defines the evidence needed for the first post-upgrade credit. For isolated Windows JSON storage, lock opening retries transientEPERM/EACCES at most eight times, with increasing delays totaling 1,120 ms. Exclusive lock creation remains required, and access errors do not trigger stale-lock deletion. Persistent failures remain errors; a recovered poll alone does not establish settlement execution.
Signed attempts and failed receipt recovery
Cranker saves a signed native settlement identity through authenticated work PUT before broadcasting. Receiver preserves the lease generation and prevents replacement identity. Once an attempt is recorded, lease expiry becomes FAILED for signature reconciliation rather than automatically making the settlement executable again. A FAILED receipt can describe an already finalized transaction. The current Node-service-authenticated receipt validator matches thirteen proof inputs, sixteen TSNP accounts, both signatures, exact instruction/Memo, canonical funded-root account and TCAP transition root. It does not require today’s funded-tree root to equal an earlier successful proof’s root. Preview leaves storage unchanged; execution updates only the receipt and archives the earlier error, without signing, submission, requeue or refund. The November 2 recovery record is historical evidence for the earlier twelve-input credit, separate from validation of the funded-note contract. See service contracts. An unresolved signed failure holds the shared-root lock before later credit verification. The authenticatedresolve-failed operation records nonexecution only for expired native credit whose exact predecessor root/sequence remain unchanged in finalized TCAP state, with corroborating receipt-absence, blockhash-expiry, checkpoint and funding checks. It preserves the old FAILED record and signed attempt, and wakes dependent work after the explicit write. Missing receipts alone, changed chain state and unavailable RPC never release the lock; see the endpoint contract.
Authenticated Cranker CONFIRMED PATCH can repair an expired native lease’s receipt only after matching the durable signed checkpoint, reporting payer and original authorization/lease generation to finalized chain execution. It also admits the immediately reclaimed FAILED version while preventing replacement attempts or changed authorization. The Cranker retries temporary finality/RPC/report transport failures with the same body up to six times, with a 25-second deadline and five-second delay; receipt/authorization mismatches remain errors. A remaining report failure leaves a pending receipt and retains its signature. Load corrected Receiver and Cranker together; the November 5 reference credit finalized before its original report missed expiry. Manual receipt repair and owner recovery remain separate operator steps.
Native leases and signing availability
Native hidden-head credit and epoch accounting receive a bounded 180-second Cranker lease covering Node authorization, Mother co-signing and submission. Node claims and funding/TIN/other-settlement Cranker claims remain 60 seconds. Signing requires the current active lease; expired unsigned work requires fresh verification, while a saved signature retains its reconciliation boundary. Receiver preserves the exact domain 404Receiver work was not found. Missing signing endpoints, transport/interrupted-body failure and HTTP 5xx can use configured fallback; exhaustion returns a sanitized signing-service 503. Exact signing/lifetime/height availability failures may requeue unsigned native work only under active owner/lease/version and no-checkpoint guards. Malformed metadata and signed attempts are excluded. Pool-specific recovery is retired.
Receiver forwards the final Mother-signed message/hash/lifetime/context response and rejects checkpoint replacement or lease/version changes. Local-file transaction queries use their held snapshot; this generic storage behavior remains while pool-only recovery is removed.