26 breaking releases

1.0.0-alpha.0 Mar 20, 2023
0.28.0 Apr 11, 2023
0.27.2 Mar 15, 2023
0.25.0 Dec 5, 2022
0.1.0-beta.1+stub Sep 10, 2020

#1410 in Magic Beans

Download history 2380/week @ 2023-01-28 2332/week @ 2023-02-04 2343/week @ 2023-02-11 2275/week @ 2023-02-18 2981/week @ 2023-02-25 4251/week @ 2023-03-04 4369/week @ 2023-03-11 3232/week @ 2023-03-18 2842/week @ 2023-03-25 3100/week @ 2023-04-01 3173/week @ 2023-04-08 2730/week @ 2023-04-15 3198/week @ 2023-04-22 2770/week @ 2023-04-29 2914/week @ 2023-05-06 2571/week @ 2023-05-13

11,879 downloads per month
Used in 13 crates (11 directly)




A modern, lightweight, descriptor-based wallet library written in Rust!

Crate Info MIT or Apache-2.0 Licensed CI Status API Docs Rustc Version 1.57.0+ Chat on Discord

Project Homepage | Documentation


The bdk crate provides the Wallet type which is a simple, high-level interface built from the low-level components of bdk_chain. Wallet is a good starting point for many simple applications as well as a good demonstration of how to use the other mechanisms to construct a wallet. It has two keychains (external and internal) which are defined by miniscript descriptors and uses them to generate addresses. When you give it chain data it also uses the descriptors to find transaction outputs owned by them. From there, you can create and sign transactions.

For more information, see the Wallet's documentation.

Blockchain data

In order to get blockchain data for Wallet to consume, you have to put it into particular form. Right now this is KeychainScan which is defined in bdk_chain.

This can be created manually or from blockchain-scanning crates.

Blockchain Data Sources

  • bdk_esplora: Grabs blockchain data from Esplora for updating BDK structures.
  • bdk_electrum: Grabs blockchain data from Electrum for updating BDK structures.



To persist the Wallet on disk, Wallet needs to be constructed with a Persist implementation.



use bdk::{bitcoin::Network, wallet::{AddressIndex, Wallet}};

fn main() {
    // a type that implements `Persist`
    let db = ();

    let descriptor = "wpkh(tprv8ZgxMBicQKsPdy6LMhUtFHAgpocR8GC6QmwMSFpZs7h6Eziw3SpThFfczTDh5rW2krkqffa11UpX3XkeTTB2FvzZKWXqPY54Y6Rq4AQ5R8L/84'/0'/0'/0/*)";
    let mut wallet = Wallet::new(descriptor, None, db, Network::Testnet).expect("should create");

    // get a new address (this increments revealed derivation index)
    println!("revealed address: {}", wallet.get_address(AddressIndex::New));
    println!("staged changes: {:?}", wallet.staged());
    // persist changes
    wallet.commit().expect("must save");


Unit testing

cargo test


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~493K SLoC