Skip to content

Unify UTXO crates under one state model #6

Description

@gosunuts

Problem

The current architecture is fragmented by borrowed implementation concepts rather than by a single domain model.

  • crates/utxo owns the authoritative live UTXO set.
  • crates/index owns electrs-shaped funding/spending rows.
  • crates/wallet owns descriptors, PSBT helpers, and partial watched-state concepts.
  • crates/utreexo owns proof/accumulator logic but is not meaningfully wired into block apply.
  • crates/filters owns compact block filters for discovery/rescan.
  • crates/pruning owns block/undo deletion policy.
  • NodeState wires these together through optional handles and side effects.

This makes "coin state at a chain tip" implicit and scattered. Wallet funding, address/script lookup, UTXO proof attachment, indexing, and pruning should all consume one coherent UTXO/block delta model instead of each subsystem interpreting blocks independently.

Desired Direction

Make crates/utxo the center of the state model.

Conceptually:

crates/utxo
  CoinState
    ├─ live_utxo              // authoritative OutPoint -> Coin state
    ├─ watched_index?         // optional descriptor/script -> live coin projection
    ├─ funding_api?           // optional automated PSBT funding source
    └─ proof_provider?        // optional utreexo/full-node proof backend

wallet should not own coin state directly. Instead, it should observe wallet-relevant coins through the utxo state model and expose them as a simple deposit/withdrawal experience.

crates/wallet
  ├─ descriptor parsing/validation
  ├─ PSBT construction/finalization helpers
  └─ external signer trait only

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions