BDK Balance API
Summer of Bitcoin work on how a wallet decides which coins to trust
Telling you your balance is the most basic thing a Bitcoin wallet does, and also one of the subtlest. Unconfirmed money can still be replaced or double-spent, so a wallet has to decide which pending coins it is willing to present as spendable.
BDK used to answer that by looking at which of your keychains the money landed on: anything arriving on a change address was trusted. That rule breaks in both directions, and it produced two long-standing bugs (bdk_wallet#16 and bdk_wallet#273) pointing in opposite ways.
As part of Summer of Bitcoin I replaced it with an ancestry-based classification: a coin is trusted when its entire unconfirmed history only spends coins you already own, and tainted as soon as it pulls in somebody else’s. The work spans the chain layer (bdk#2246, plus the small blocks_since_conf primitive in bdk#2263) and the wallet layer (bdk_wallet#431), and it added a new locked balance category for coins whose descriptor timelock has not matured yet (bdk_wallet#538).
Both chain-layer pull requests were merged into bdk in September 2026 and featured in Bitcoin Optech. The two wallet-layer pull requests stay open as drafts until a bdk_chain release ships the new API.