diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 6dec3c08..f07a605f 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -34,7 +34,7 @@ jobs: - name: Make coverage directory run: mkdir coverage - name: Run grcov - run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only '**/crates/**' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info + run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only '**/wallet/**' --ignore '**/tests/**' --ignore '**/examples/**' -o ./coverage/lcov.info - name: Generate HTML coverage report run: genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info - name: Coveralls upload diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index f43a3d59..7cf5b305 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -27,7 +27,6 @@ jobs: - version: ${{ needs.prepare.outputs.rust_version }} clippy: true - version: 1.63.0 # Overall MSRV - - version: 1.75.0 # Specific MSRV for `bdk_electrum` features: - --no-default-features --features miniscript/no-std,bdk_chain/hashbrown - --all-features @@ -44,14 +43,6 @@ jobs: profile: minimal - name: Rust Cache uses: Swatinem/rust-cache@v2.7.7 - - name: Pin dependencies for 1.75 - if: matrix.rust.version == '1.75.0' - run: | - cargo update -p home --precise "0.5.9" - cargo update -p native-tls --precise "0.2.13" - cargo update -p idna_adapter --precise "1.1.0" - cargo update -p base64ct --precise "1.6.0" - cargo update -p minreq --precise "2.13.2" - name: Pin dependencies for MSRV if: matrix.rust.version == '1.63.0' run: ./ci/pin-msrv.sh @@ -59,13 +50,8 @@ jobs: env: MATRIX_RUST_VERSION: ${{ matrix.rust.version }} run: | - if [ $MATRIX_RUST_VERSION = '1.63.0' ]; then - cargo build --workspace --exclude 'example_*' --exclude 'bdk_electrum' ${{ matrix.features }} - cargo test --workspace --exclude 'example_*' --exclude 'bdk_electrum' ${{ matrix.features }} - else - cargo build --workspace --exclude 'example_*' ${{ matrix.features }} - cargo test --workspace --exclude 'example_*' ${{ matrix.features }} - fi + cargo build --workspace --exclude 'example_*' ${{ matrix.features }} + cargo test --workspace --exclude 'example_*' ${{ matrix.features }} check-no-std: needs: prepare @@ -85,18 +71,10 @@ jobs: # target: "thumbv6m-none-eabi" - name: Rust Cache uses: Swatinem/rust-cache@v2.7.7 - - name: Check bdk_chain - working-directory: ./crates/chain - # TODO "--target thumbv6m-none-eabi" should work but currently does not - run: cargo check --no-default-features --features miniscript/no-std,hashbrown - name: Check bdk wallet - working-directory: ./crates/wallet + working-directory: ./wallet # TODO "--target thumbv6m-none-eabi" should work but currently does not run: cargo check --no-default-features --features miniscript/no-std,bdk_chain/hashbrown - - name: Check esplora - working-directory: ./crates/esplora - # TODO "--target thumbv6m-none-eabi" should work but currently does not - run: cargo check --no-default-features --features bdk_chain/hashbrown check-wasm: needs: prepare @@ -124,11 +102,8 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2.7.7 - name: Check bdk wallet - working-directory: ./crates/wallet + working-directory: ./wallet run: cargo check --target wasm32-unknown-unknown --no-default-features --features miniscript/no-std,bdk_chain/hashbrown - - name: Check esplora - working-directory: ./crates/esplora - run: cargo check --target wasm32-unknown-unknown --no-default-features --features bdk_core/hashbrown,async fmt: needs: prepare @@ -179,10 +154,6 @@ jobs: strategy: matrix: example-dir: - - example_cli - - example_bitcoind_rpc_polling - - example_electrum - - example_esplora - example_wallet_electrum - example_wallet_esplora_async - example_wallet_esplora_blocking @@ -201,5 +172,5 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2.7.7 - name: Build - working-directory: example-crates/${{ matrix.example-dir }} + working-directory: examples/${{ matrix.example-dir }} run: cargo build diff --git a/Cargo.toml b/Cargo.toml index 2abc16bd..fbde1ace 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,22 +1,11 @@ [workspace] resolver = "2" members = [ - "crates/wallet", - "crates/chain", - "crates/core", - "crates/file_store", - "crates/electrum", - "crates/esplora", - "crates/bitcoind_rpc", - "crates/testenv", - "example-crates/example_cli", - "example-crates/example_electrum", - "example-crates/example_esplora", - "example-crates/example_bitcoind_rpc_polling", - "example-crates/example_wallet_electrum", - "example-crates/example_wallet_esplora_blocking", - "example-crates/example_wallet_esplora_async", - "example-crates/example_wallet_rpc", + "wallet", + "examples/example_wallet_electrum", + "examples/example_wallet_esplora_blocking", + "examples/example_wallet_esplora_async", + "examples/example_wallet_rpc", ] [workspace.package] diff --git a/README.md b/README.md index dc9ae77a..ce902c82 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# The Bitcoin Dev Kit +# The Bitcoin Dev Kit Wallet
-
-
-
+
+
+
@@ -28,44 +28,30 @@
## About
-The `bdk` libraries aims to provide well engineered and reviewed components for Bitcoin based applications.
+The `bdk_wallet` project provides a high level descriptor based wallet API for building Bitcoin applications.
It is built upon the excellent [`rust-bitcoin`] and [`rust-miniscript`] crates.
## Architecture
-The project is split up into several crates in the `/crates` directory:
+There is currently only one published crate in this repository:
-- [`wallet`](./crates/wallet): Contains the central high level `Wallet` type that is built from the low-level mechanisms provided by the other components
-- [`chain`](./crates/chain): Tools for storing and indexing chain data
-- [`file_store`](./crates/file_store): Persistence backend for storing chain data in a single file. Intended for testing and development purposes, not for production.
-- [`esplora`](./crates/esplora): Extends the [`esplora-client`] crate with methods to fetch chain data from an esplora HTTP server in the form that [`bdk_chain`] and `Wallet` can consume.
-- [`electrum`](./crates/electrum): Extends the [`electrum-client`] crate with methods to fetch chain data from an electrum server in the form that [`bdk_chain`] and `Wallet` can consume.
+- [`wallet`](./wallet): Contains the central high level `Wallet` type that is built from the low-level mechanisms provided by the other components.
+
+Crates that `bdk_wallet` depends on are found in the [`bdk`] repository.
-Fully working examples of how to use these components are in `/example-crates`:
-- [`example_cli`](./example-crates/example_cli): Library used by the `example_*` crates. Provides utilities for syncing, showing the balance, generating addresses and creating transactions without using the bdk_wallet `Wallet`.
-- [`example_electrum`](./example-crates/example_electrum): A command line Bitcoin wallet application built on top of `example_cli` and the `electrum` crate. It shows the power of the bdk tools (`chain` + `file_store` + `electrum`), without depending on the main `bdk_wallet` library.
-- [`example_esplora`](./example-crates/example_esplora): A command line Bitcoin wallet application built on top of `example_cli` and the `esplora` crate. It shows the power of the bdk tools (`chain` + `file_store` + `esplora`), without depending on the main `bdk_wallet` library.
-- [`example_bitcoind_rpc_polling`](./example-crates/example_bitcoind_rpc_polling): A command line Bitcoin wallet application built on top of `example_cli` and the `bitcoind_rpc` crate. It shows the power of the bdk tools (`chain` + `file_store` + `bitcoind_rpc`), without depending on the main `bdk_wallet` library.
-- [`example_wallet_esplora_blocking`](./example-crates/example_wallet_esplora_blocking): Uses the `Wallet` to sync and spend using the Esplora blocking interface.
-- [`example_wallet_esplora_async`](./example-crates/example_wallet_esplora_async): Uses the `Wallet` to sync and spend using the Esplora asynchronous interface.
-- [`example_wallet_electrum`](./example-crates/example_wallet_electrum): Uses the `Wallet` to sync and spend using Electrum.
+Fully working examples of how to use these components are in `/examples`:
+- [`example_wallet_esplora_blocking`](examples/example_wallet_esplora_blocking): Uses the `Wallet` to sync and spend using the Esplora blocking interface.
+- [`example_wallet_esplora_async`](examples/example_wallet_esplora_async): Uses the `Wallet` to sync and spend using the Esplora asynchronous interface.
+- [`example_wallet_electrum`](examples/example_wallet_electrum): Uses the `Wallet` to sync and spend using Electrum.
+
+[`bdk`]: https://github.com/bitcoindevkit/bdk
[`rust-miniscript`]: https://github.com/rust-bitcoin/rust-miniscript
[`rust-bitcoin`]: https://github.com/rust-bitcoin/rust-bitcoin
-[`esplora-client`]: https://docs.rs/esplora-client/
-[`electrum-client`]: https://docs.rs/electrum-client/
-[`bdk_chain`]: https://docs.rs/bdk-chain/
## Minimum Supported Rust Version (MSRV)
-The BDK library maintains a MSRV of 1.63.0. This includes the following crates:
-
-- `bdk_core`
-- `bdk_chain`
-- `bdk_bitcoind_rpc`.
-- `bdk_esplora`.
-- `bdk_wallet`.
-The MSRV of `bdk_electrum` is 1.75.0.
+The libraries in this repository maintain a MSRV of 1.63.0.
To build with the MSRV of 1.63.0 you will need to pin dependencies by running the [`pin-msrv.sh`](./ci/pin-msrv.sh) script.
diff --git a/ci/pin-msrv.sh b/ci/pin-msrv.sh
index 2e1a09e5..61fc4878 100755
--- a/ci/pin-msrv.sh
+++ b/ci/pin-msrv.sh
@@ -10,21 +10,13 @@ set -euo pipefail
# cargo clean
# rustup override set 1.63.0
-cargo update -p zstd-sys --precise "2.0.8+zstd.1.5.5"
-cargo update -p time --precise "0.3.20"
cargo update -p home --precise "0.5.5"
-cargo update -p proptest --precise "1.2.0"
cargo update -p url --precise "2.5.0"
cargo update -p tokio --precise "1.38.1"
cargo update -p tokio-util --precise "0.7.11"
cargo update -p indexmap --precise "2.5.0"
cargo update -p security-framework-sys --precise "2.11.1"
-cargo update -p csv --precise "1.3.0"
-cargo update -p unicode-width --precise "0.1.13"
-cargo update -p native-tls --precise "0.2.13"
-cargo update -p flate2 --precise "1.0.35"
-cargo update -p bzip2-sys --precise "0.1.12"
cargo update -p ring --precise "0.17.12"
cargo update -p once_cell --precise "1.20.3"
-cargo update -p base64ct --precise "1.6.0"
cargo update -p minreq --precise "2.13.2"
+cargo update -p native-tls --precise "0.2.13"
\ No newline at end of file
diff --git a/crates/bitcoind_rpc/CHANGELOG.md b/crates/bitcoind_rpc/CHANGELOG.md
deleted file mode 100644
index 6c0c8c68..00000000
--- a/crates/bitcoind_rpc/CHANGELOG.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Changelog
-
-All notable changes to this project can be found here and in each release's git tag and can be viewed with `git tag -ln100 "v*"`. See also [DEVELOPMENT_CYCLE.md](../../DEVELOPMENT_CYCLE.md) for more details.
-
-Contributors do not need to change this file but do need to add changelog details in their PR descriptions. The person making the next release will collect changelog details from included PRs and edit this file prior to each release.
-
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
-and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-## [bitcoind_rpc-0.18.0]
-
-### Added
-
-- Added `bip158` module as a means of updating `bdk_chain` structures #1614
-
-## [bitcoind_rpc-0.17.1]
-
-### Changed
-
-- Minor updates to fix new rustc 1.83.0 clippy warnings #1776
-
-[bitcoind_rpc-0.17.1]: https://github.com/bitcoindevkit/bdk/releases/tag/bitcoind_rpc-0.17.1
-[bitcoind_rpc-0.18.0]: https://github.com/bitcoindevkit/bdk/releases/tag/bitcoind_rpc-0.18.0
diff --git a/crates/bitcoind_rpc/Cargo.toml b/crates/bitcoind_rpc/Cargo.toml
deleted file mode 100644
index 7e5eda93..00000000
--- a/crates/bitcoind_rpc/Cargo.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-[package]
-name = "bdk_bitcoind_rpc"
-version = "0.18.0"
-edition = "2021"
-rust-version = "1.63"
-homepage = "https://bitcoindevkit.org"
-repository = "https://github.com/bitcoindevkit/bdk"
-documentation = "https://docs.rs/bdk_bitcoind_rpc"
-description = "This crate is used for emitting blockchain data from the `bitcoind` RPC interface."
-license = "MIT OR Apache-2.0"
-readme = "README.md"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[lints]
-workspace = true
-
-[dependencies]
-bitcoin = { version = "0.32.0", default-features = false }
-bitcoincore-rpc = { version = "0.19.0" }
-bdk_core = { path = "../core", version = "0.4.1", default-features = false }
-
-[dev-dependencies]
-bdk_bitcoind_rpc = { path = "." }
-bdk_testenv = { path = "../testenv" }
-bdk_chain = { path = "../chain" }
-
-[features]
-default = ["std"]
-std = ["bitcoin/std", "bdk_core/std"]
-serde = ["bitcoin/serde", "bdk_core/serde"]
-
-[[example]]
-name = "filter_iter"
-required-features = ["std"]
diff --git a/crates/bitcoind_rpc/README.md b/crates/bitcoind_rpc/README.md
deleted file mode 100644
index 12de8702..00000000
--- a/crates/bitcoind_rpc/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# BDK Bitcoind RPC
-
-This crate is used for emitting blockchain data from the `bitcoind` RPC interface.
diff --git a/crates/bitcoind_rpc/examples/README.md b/crates/bitcoind_rpc/examples/README.md
deleted file mode 100644
index 34cee07b..00000000
--- a/crates/bitcoind_rpc/examples/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Example bitcoind RPC sync
-
-### Simple Signet Test with FilterIter
-
-1. Start local signet bitcoind. (~8 GB space required)
- ```
- mkdir -p /tmp/signet/bitcoind
- bitcoind -signet -server -fallbackfee=0.0002 -blockfilterindex -datadir=/tmp/signet/bitcoind -daemon
- tail -f /tmp/signet/bitcoind/signet/debug.log
- ```
- Watch debug.log and wait for bitcoind to finish syncing.
-
-2. Set bitcoind env variables.
- ```
- export RPC_URL=127.0.0.1:38332
- export RPC_COOKIE=/tmp/signet/bitcoind/signet/.cookie
- ```
-3. Run `filter_iter` example.
- ```
- cargo run -p bdk_bitcoind_rpc --example filter_iter
- ```
\ No newline at end of file
diff --git a/crates/bitcoind_rpc/examples/filter_iter.rs b/crates/bitcoind_rpc/examples/filter_iter.rs
deleted file mode 100644
index 55c3325d..00000000
--- a/crates/bitcoind_rpc/examples/filter_iter.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-#![allow(clippy::print_stdout)]
-use std::time::Instant;
-
-use anyhow::Context;
-use bdk_bitcoind_rpc::bip158::{Event, EventInner, FilterIter};
-use bdk_chain::bitcoin::{constants::genesis_block, secp256k1::Secp256k1, Network};
-use bdk_chain::indexer::keychain_txout::KeychainTxOutIndex;
-use bdk_chain::local_chain::LocalChain;
-use bdk_chain::miniscript::Descriptor;
-use bdk_chain::{BlockId, ConfirmationBlockTime, IndexedTxGraph, SpkIterator};
-use bdk_testenv::anyhow;
-use bitcoin::Address;
-
-// This example shows how BDK chain and tx-graph structures are updated using compact
-// filters syncing. Assumes a connection can be made to a bitcoin node via environment
-// variables `RPC_URL` and `RPC_COOKIE`.
-
-// Usage: `cargo run -p bdk_bitcoind_rpc --example filter_iter`
-
-const EXTERNAL: &str = "tr([7d94197e]tprv8ZgxMBicQKsPe1chHGzaa84k1inY2nAXUL8iPSyWESPrEst4E5oCFXhPATqj5fvw34LDknJz7rtXyEC4fKoXryUdc9q87pTTzfQyv61cKdE/86'/1'/0'/0/*)#uswl2jj7";
-const INTERNAL: &str = "tr([7d94197e]tprv8ZgxMBicQKsPe1chHGzaa84k1inY2nAXUL8iPSyWESPrEst4E5oCFXhPATqj5fvw34LDknJz7rtXyEC4fKoXryUdc9q87pTTzfQyv61cKdE/86'/1'/0'/1/*)#dyt7h8zx";
-const SPK_COUNT: u32 = 25;
-const NETWORK: Network = Network::Signet;
-
-const START_HEIGHT: u32 = 170_000;
-const START_HASH: &str = "00000041c812a89f084f633e4cf47e819a2f6b1c0a15162355a930410522c99d";
-
-fn main() -> anyhow::Result<()> {
- // Setup receiving chain and graph structures.
- let secp = Secp256k1::new();
- let (descriptor, _) = Descriptor::parse_descriptor(&secp, EXTERNAL)?;
- let (change_descriptor, _) = Descriptor::parse_descriptor(&secp, INTERNAL)?;
- let (mut chain, _) = LocalChain::from_genesis_hash(genesis_block(NETWORK).block_hash());
- let mut graph = IndexedTxGraph::