THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Designing Balance and UTXO Management SDKs

permalink THAMER
#bitcoin#sdk#software-engineering#wab

Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.

Observations rather than promises

Balance and UTXO calls describe an engine observation at a point in time. They do not reserve funds or guarantee that a later SEND will succeed. Concurrent spending, pending transactions and chain reorganizations may change the available state. Keep confirmed, unconfirmed and spendable concepts distinct according to the actual response schema.

Proposed Python model

from dataclasses import dataclass
@dataclass(frozen=True)
class BalanceView:
    confirmed_sat: int | None
    spendable_sat: int | None
    ready: bool

This is a client-side projection, not a declaration of wire fields. Map only verified fields and preserve unknown values. A warming or rejected response must not be converted into a successful zero balance. Use integer satoshis and reject invalid numeric types or overflow.

UTXO handling

Identify an output by transaction ID and output index, not by transaction ID alone. A UTXO snapshot is not a reservation. Do not assume the SDK may select inputs, lock coins or construct a raw transaction unless a documented engine operation explicitly supports that capability. The engine remains responsible for execution. Keep wallet scope and observation time with every snapshot.

Balance and UTXO requests are separate observations and may occur across different chain or mempool states. A discrepancy is a reason to investigate timing and semantics, not to overwrite the engine's accounting. Do not sum outputs across address types without verifying whether the returned sets overlap.

Acceptance plan

Capture sanitized fixtures for empty, funded, warming and rejected states. On Testnet observe an inbound payment before and after confirmation, then an authorized spend and change. Compare balance and output observations with transaction evidence. Test stale snapshots and concurrent calls without assuming atomicity across endpoints. Record unavailable values as unknown and never publish wallet credentials.

Primary reference

https://thamer.org/api

Related reading in this series

https://thamer.org/docs/wab-sdk-designing-bitcoin-sdk
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-wallet-identity-management
https://thamer.org/docs/wab-sdk-cross-language-interfaces
https://thamer.org/docs/wab-sdk-typed-json-contracts
https://thamer.org/docs/wab-sdk-authentication-credential-management
https://thamer.org/docs/wab-sdk-wallet-creation-restoration
https://thamer.org/docs/wab-sdk-receive-address-interfaces
https://thamer.org/docs/wab-sdk-transaction-execution
https://thamer.org/docs/wab-sdk-idempotency-retry-strategies
https://thamer.org/docs/wab-sdk-wallet-recovery-local-lifecycle

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects