Anchor definition + docs
Previously, I have misunderstood the definition of anchor. If a tx is anchored in a block, it does not necessarily mean it is confirmed in that block. The tx can be confirmed in an ancestor block of the anchor block. With this new definition, we need a new trait `ConfirmationHeight` that has one method `confirmation_height`. This trait can be used to extend `Anchor` for those implementations that can give us the exact conirmation height of a tx (which is useful in most cases). Another change is to add another variant to the `ObservedAs` enum; `ObservedAs::ConfirmedImplicit(A)`. If a tx does not have an anchor, but another tx that spends it has an anchor that in in the best chain, we can assume that tx is also in the best chain. The logic of `TxGraph::try_get_chain_position` is also changed to reflect this. Some methods from `IndexedTxGraph` have been moved to `TxGraph` as they do not require the `Indexer`. Some `TxGraph` methods have been renamed for clarity and consistency. Also more docs are added.
The Bitcoin Dev Kit
BDK
A modern, lightweight, descriptor-based wallet library written in Rust!
Project Homepage | Documentation
About
The bdk libraries aims to provide well engineered and reviewed components for Bitcoin based applications.
It is built upon the excellent rust-bitcoin and rust-miniscript crates.
⚠ The Bitcoin Dev Kit developers are in the process of releasing a
v1.0which is a fundamental re-write of how the library works. See for some background on this project: https://bitcoindevkit.org/blog/road-to-bdk-1/ (ignore the timeline 😁) For a release timeline see thebdk_core_stagingrepo where a lot of the component work is being done. The plan is that everything in thebdk_core_stagingrepo will be moved into thecratesdirectory here.
Architecture
The project is split up into several crates in the /crates directory:
bdk: Contains the central high levelWallettype that is built from the low-level mechanisms provided by the other componentschain: Tools for storing and indexing chain datafile_store: A (experimental) persistence backend for storing chain data in a single file.esplora: Extends theesplora-clientcrate with methods to fetch chain data from an esplora HTTP server in the form that [bdk_chain] andWalletcan consume.electrum: Extends theelectrum-clientcrate with methods to fetch chain data from an electrum server in the form that [bdk_chain] andWalletcan consume.
Fully working examples of how to use these components are in /example-crates