docs: add BRC-100 wallet UTXO lifecycle reference - #474
Conversation
Documents the full transaction lifecycle across the BRC-100 wallet interface: every storage-layer call each UTXO method makes, the transaction and proof-request state machines, output spendability rules, and the funding/coin-selection pipeline. Diagrams are mermaid sequence and state diagrams, which docs-site already renders via CodeBlock -> Mermaid. Lanes are consistent across every diagram: App, Wallet, Signer, Manager, Storage, Database, Services, Monitor. Covers both @bsv/wallet-toolbox and go-wallet-toolbox, with the BRC-100 spec as the reference for both, and collects fourteen implementation differences -- including two behavioral divergences that are not specified by BRC-100 and produce different observable results: failed transactions release spent inputs in TypeScript but not in Go, and change becomes spendable at different points in the broadcast flow. Linked from docs/architecture/brc-100.md and docs/specs/brc-100-wallet.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lug8S7eE3uxTFRtr5pU9kw
The page claimed reorg handling, double-spend review, and broadcaster push events were absent in go-wallet-toolbox. They are not. It compared TypeScript's nineteen registered monitor tasks against Go's four and read the difference as missing behavior, when Go moves most of that work off the scheduler: - pkg/monitor runs an SSE broadcast-event pipeline with a persisted replay cursor, plus reorg and new-tip consumers. Provider.HandleReorg invalidates merkle proofs for orphaned blocks -- event-driven, not polled. - confirmDoubleSpends re-verifies every aggregated double-spend verdict inline before it becomes terminal, downgrading false positives to serviceError for retry. What Go genuinely does not reproduce is the reviewStatus cascade, plus purge and action-batch cleanup. The section now says that and explains the two mechanisms, rather than counting scheduled tasks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lug8S7eE3uxTFRtr5pU9kw
|
|
CI is red on Root cause — one failure, three cascades.
Why it isn't this branch. The full diff against No
Not fixing it here. Happy to open a separate PR for the bump if a maintainer wants it. Otherwise this branch should go green once the advisory is remediated on Generated by Claude Code |



Program and scope
docs/specs/brc-100-wallet.mddescribes method shapes but no flow. The lifecycle knowledge was scattered across un-frontmattered engineering notes inpackages/wallet/wallet-toolbox/CURRENT_STATE.md(which docs-site does not publish), prose ingo-wallet-toolbox/docs/, and one-issue-at-a-time gap docs ingo-wallet-toolbox/plans/. Nothing mapped the TypeScript and Go implementations against each other method-by-method:conformance/PARITY_MATRIX.jsonis language-agnostic (TS vs "other impls"), not TS↔Go.docs/specs/brc-100-wallet.mdis left alone (docs/**is not covered byformat:root); only the two-line link insertion was made there.Impact
Affected packages/services and intended patch versions: none. No published bytes change.
What the page contains
New
docs/architecture/wallet-utxo-lifecycle.md:createAction,signAction,processAction, funding/coin-selection,internalizeAction,abortAction, and the Monitor. Lanes are consistent across every diagram: App → Wallet → Signer → Manager → Storage → Database → Services → Monitor.determineReqTxStatusand broadcast-outcome matrices.WalletWireCallsorder, with lighter diagrams for the crypto, certificate, and wallet-state groups, and a note on the non-BRC-100 helpers both implementations add.Two of those differences are behavioral and observable, not cosmetic:
failed, then re-marks only those the chain positively confirms are gone. Go never releases them, on the reasoning that a missing-inputs verdict can be a false positive. Same event, different resulting balance. BRC-100 does not specify this.listOutputscan return different sets for an in-flight transaction.Also worth reviewer attention:
getNetworkreturnsmain/testin Go where the spec requiresmainnet/testnet, and Go's V1 storage client returns empty collections with anilerror forfindOutputBasketsAuth/findOutputsAuth— indistinguishable from a genuine empty result.A companion Go-side page is opened separately against
bsv-blockchain/go-wallet-toolbox.Diagram format note
Mermaid fences render on docs-site already —
docs-site/src/components/CodeBlock.tsxrouteslang === 'mermaid'to the lazy-loadedMermaidcomponent. No new dependency. This is the first publisheddocs/page to use one; existing mermaid lives only in unpublished package-local notes.Verification
pnpm --filter docs-site validate→Frontmatter valid: 116 files checked/Links OK: 116 files checkedpnpm docs:facts:check→ parity matrix verified (75 files, 6681 vectors), stack facts verified, 31 package READMEs, 96 freshness records, 0 findingspnpm --filter docs-site build→ 121 pages prerendered, Pagefind indexed,Built links OK: 121 HTML files checkednpx prettier --check docs/architecture/wallet-utxo-lifecycle.md docs/architecture/brc-100.md→ cleanmermaid.parse()under jsdom → 0 failed. Confirmed the 13 blocks on this page reach the built chunk (10sequenceDiagram, 3stateDiagram-v2).Every
file:linecitation and every claimed difference was read against source in both repositories rather than inferred. The four strongest claims (failed-input handling, the remote-client stubs, thegetNetworkvalues, and the protocol-name minimum) were each confirmed at the exact line, including their in-code rationale comments.Security and dependencies
Dependency evidence
Not applicable — no dependency change.
Release and operations
Completion evidence
Generated by Claude Code