Release v0.6.0

By Alekos Filini on 4/16/2021 - Tags: Rust, Release


A new release of BDK is out: v0.6.0 (opens new window) brings some new API calls, renamed types and some bugfixes.

You can find the full v0.6.0 changelog (opens new window) on GitHub.

# What's new in v0.6.0

Below are some highlights of the new release:

# A new way to generate addresses

The old get_new_address() method has been upgraded into a more generic get_address(), which takes a AddressIndex (opens new window) argument. AddressIndex is defined as an enum with the following variants:

  • AddressIndex::New increments the derivation index stored in the database and returns a new address. It's equivalent to the old get_new_address().
  • AddressIndex::LastUnused returns the address for the current derivation index if no usage has been detected. sync() should be called to ensure the internal database is up to date.
  • AddressIndex::Peek(index) returns the address at a given derivation index, without updating the database.
  • AddressIndex::Reset(index) returns the address at a given derivation index, and stores that value in the database.
// Prints the first ten addresses without updating the derivation index
for index in 0..10 {
    println!("Address #{}: {}", index, wallet.get_address(AddressIndex::Peek(index)?));
}

# Easier multiparty transaction creation

A new method called get_psbt_input() (opens new window) has been added to the Wallet structure, and it makes it very easy to get a complete PSBT input with all the required metadata for a given UTXO. This can be very convenient when working with add_foreign_utxo(), which was added in the previous release:

// On Alice's wallet
let alice_utxo = LocalUtxo { ... };
let alice_psbt_input = wallet_alice.get_psbt_input(alice_utxo.clone())?;
send_input_to_bob(alice_utxo.outpoint, alice_psbt_input)?;

// On Bob's wallet
let mut builder = wallet_bob.build_tx();
builder
    .add_recipient(addr.script_pubkey(), 60_000)
    .add_foreign_utxo(alice_outpoint, alice_psbt_input, satisfaction_weight)?
    ....

# Renamed types

To keep our coding style in line with the best practices defined by the Rust language, we've renamed some of our types and enum variants to avoid using upper case acronyms (opens new window).

Some examples are:

  • UTXO -> Utxo
  • RBFValue -> RbfValue
  • BIP69Lexicographic -> Bip69Lexicographic
  • P2PKH -> P2Pkh
  • BIP44Public -> Bip44Public

# New MSRV

Due to some changes in one of our dependency, our MSRV has been bumped up from 1.45 to 1.46, which was released in August 2020. The last release fully supporting 1.45 is v0.5.1.

# Contributors

A huge thanks to everybody who contributed to this new release with suggestions, pull requests and bug reports.

Since the v0.5.1 release around a month ago, we've had 37 new commits made by 7 different contributors for a total of 1092 additions and 548 deletions. Here's the full diff (opens new window).

A special thanks to the new contributor for this release: