All Projects → bitcoindevkit → Bdk

bitcoindevkit / Bdk

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

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Bdk

Arcbit Android
arcbit - Android bitcoin wallet http://arcbit.io
Stars: ✭ 34 (-79.76%)
Mutual labels:  bitcoin, bitcoin-wallet
Hdwallet
Simple Swift library for creating HD cryptocurrencies wallets and working with crypto Coins/ERC20 tokens.
Stars: ✭ 80 (-52.38%)
Mutual labels:  bitcoin, bitcoin-wallet
Bitcoin Payments Woocommerce
Free Bitcoin/Altcoins Payment Gateway Addon for WooCommerce 2.1+ (or higher). Accept USD, Bitcoin, Litecoin, Dogecoin, Speedcoin, Darkcoin, Vertcoin, Reddcoin, Feathercoin, Vericoin, Potcoin payments in WooCommerce. Direct Integration on your website. No Chargebacks, Global, Secure. All in automatic mode.
Stars: ✭ 38 (-77.38%)
Mutual labels:  bitcoin, bitcoin-wallet
Balance Open
Balance Open: A GPL3-licensed macOS menu bar app for all the world’s currencies.
Stars: ✭ 279 (+66.07%)
Mutual labels:  bitcoin, bitcoin-wallet
Blockchain Java
A simplified blockchain implementation in Java
Stars: ✭ 160 (-4.76%)
Mutual labels:  bitcoin, bitcoin-wallet
Electrum
Electrum Bitcoin Wallet
Stars: ✭ 5,353 (+3086.31%)
Mutual labels:  bitcoin, bitcoin-wallet
Walletwasabi
Open-source, non-custodial, privacy focused Bitcoin wallet for Windows, Linux, and Mac. Built-in Tor, CoinJoin, and coin control features.
Stars: ✭ 1,197 (+612.5%)
Mutual labels:  bitcoin, bitcoin-wallet
Blixt Wallet
Bitcoin Lightning Wallet with focus on usability and user experience
Stars: ✭ 40 (-76.19%)
Mutual labels:  bitcoin, bitcoin-wallet
Bitstore Ios
Native iOS Bitcoin wallet
Stars: ✭ 103 (-38.69%)
Mutual labels:  bitcoin, bitcoin-wallet
Sentinel Android
Watch Only bitcoin wallet tracker for Android
Stars: ✭ 98 (-41.67%)
Mutual labels:  bitcoin, bitcoin-wallet
Bitcoin Wallet
Bitcoin Wallet app for your Android device. Standalone Bitcoin node, no centralized backend required.
Stars: ✭ 2,672 (+1490.48%)
Mutual labels:  bitcoin, bitcoin-wallet
Bitcoin Kit Ios
Full Bitcoin library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash and Dash blockchains.
Stars: ✭ 134 (-20.24%)
Mutual labels:  bitcoin, bitcoin-wallet
Golden Wallet React Native
Golden - Best Wallet Ever
Stars: ✭ 201 (+19.64%)
Mutual labels:  bitcoin, bitcoin-wallet
Coinbin
Javascript Bitcoin Wallet. Supports Multisig, Stealth, HD, SegWit, Bech32, Time Locked Addresses, RBF and more!
Stars: ✭ 694 (+313.1%)
Mutual labels:  bitcoin, bitcoin-wallet
Firmware
❄️ Firmware and simulator for Coldcard Hardware Wallet
Stars: ✭ 198 (+17.86%)
Mutual labels:  bitcoin, bitcoin-wallet
Viabtc exchange server docker
easy run viabtc_exchange_server use docker compose
Stars: ✭ 83 (-50.6%)
Mutual labels:  bitcoin, bitcoin-wallet
Bitcoinwallet
Bitcoin and ETH wallet
Stars: ✭ 124 (-26.19%)
Mutual labels:  bitcoin, bitcoin-wallet
Arcbit Ios
arcbit - iOS bitcoin wallet http://arcbit.io
Stars: ✭ 142 (-15.48%)
Mutual labels:  bitcoin, bitcoin-wallet
Proofofexistence
Core and web app for Proof of Existence - the original blockchain notary service
Stars: ✭ 155 (-7.74%)
Mutual labels:  bitcoin
Electrumx
Alternative implementation of spesmilo/electrum-server
Stars: ✭ 162 (-3.57%)
Mutual labels:  bitcoin

BDK

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.45+ Chat on Discord

Project Homepage | Documentation

About

The bdk library aims to be the core building block for Bitcoin wallets of any kind.

  • It uses Miniscript to support descriptors with generalized conditions. This exact same library can be used to build single-sig wallets, multisigs, timelocked contracts and more.
  • It supports multiple blockchain backends and databases, allowing developers to choose exactly what's right for their projects.
  • It's built to be cross-platform: the core logic works on desktop, mobile, and even WebAssembly.
  • It's very easy to extend: developers can implement customized logic for blockchain backends, databases, signers, coin selection, and more, without having to fork and modify this library.

Examples

Sync the balance of a descriptor

use bdk::Wallet;
use bdk::database::MemoryDatabase;
use bdk::blockchain::{noop_progress, ElectrumBlockchain};

use bdk::electrum_client::Client;

fn main() -> Result<(), bdk::Error> {
    let client = Client::new("ssl://electrum.blockstream.info:60002")?;
    let wallet = Wallet::new(
        "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)",
        Some("wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)"),
        bitcoin::Network::Testnet,
        MemoryDatabase::default(),
        ElectrumBlockchain::from(client)
    )?;

    wallet.sync(noop_progress(), None)?;

    println!("Descriptor balance: {} SAT", wallet.get_balance()?);

    Ok(())
}

Generate a few addresses

use bdk::{Wallet, database::MemoryDatabase};
use bdk::wallet::AddressIndex::New;

fn main() -> Result<(), bdk::Error> {
    let wallet = Wallet::new_offline(
        "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)",
        Some("wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)"),
        bitcoin::Network::Testnet,
        MemoryDatabase::default(),
    )?;

    println!("Address #0: {}", wallet.get_address(New)?);
    println!("Address #1: {}", wallet.get_address(New)?);
    println!("Address #2: {}", wallet.get_address(New)?);

    Ok(())
}

Create a transaction

use bdk::{FeeRate, Wallet};
use bdk::database::MemoryDatabase;
use bdk::blockchain::{noop_progress, ElectrumBlockchain};

use bdk::electrum_client::Client;
use bdk::wallet::AddressIndex::New;

use bitcoin::consensus::serialize;

fn main() -> Result<(), bdk::Error> {
    let client = Client::new("ssl://electrum.blockstream.info:60002")?;
    let wallet = Wallet::new(
        "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)",
        Some("wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)"),
        bitcoin::Network::Testnet,
        MemoryDatabase::default(),
        ElectrumBlockchain::from(client)
    )?;

    wallet.sync(noop_progress(), None)?;

    let send_to = wallet.get_address(New)?;
    let (psbt, details) = {
        let mut builder = wallet.build_tx();
        builder
            .add_recipient(send_to.script_pubkey(), 50_000)
            .enable_rbf()
            .do_not_spend_change()
            .fee_rate(FeeRate::from_sat_per_vb(5.0));
        builder.finish()?
    };

    println!("Transaction details: {:#?}", details);
    println!("Unsigned PSBT: {}", base64::encode(&serialize(&psbt)));

    Ok(())
}

Sign a transaction

use bdk::{Wallet, database::MemoryDatabase};

use bitcoin::consensus::deserialize;

fn main() -> Result<(), bdk::Error> {
    let wallet = Wallet::new_offline(
        "wpkh([c258d2e4/84h/1h/0h]tprv8griRPhA7342zfRyB6CqeKF8CJDXYu5pgnj1cjL1u2ngKcJha5jjTRimG82ABzJQ4MQe71CV54xfn25BbhCNfEGGJZnxvCDQCd6JkbvxW6h/0/*)",
        Some("wpkh([c258d2e4/84h/1h/0h]tprv8griRPhA7342zfRyB6CqeKF8CJDXYu5pgnj1cjL1u2ngKcJha5jjTRimG82ABzJQ4MQe71CV54xfn25BbhCNfEGGJZnxvCDQCd6JkbvxW6h/1/*)"),
        bitcoin::Network::Testnet,
        MemoryDatabase::default(),
    )?;

    let psbt = "...";
    let psbt = deserialize(&base64::decode(psbt).unwrap())?;

    let (signed_psbt, finalized) = wallet.sign(psbt, None)?;

    Ok(())
}

License

Licensed under either of

at your option.

Contribution

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].