10 breaking releases

0.11.0 Apr 15, 2024
0.10.0 Mar 27, 2024
0.9.0 Mar 5, 2024
0.4.0 Oct 12, 2023
0.2.0 Mar 20, 2023

#6 in #bdk

Download history 6/week @ 2024-01-15 5/week @ 2024-01-29 121/week @ 2024-02-12 89/week @ 2024-02-19 47/week @ 2024-02-26 139/week @ 2024-03-04 38/week @ 2024-03-11 116/week @ 2024-03-25 126/week @ 2024-04-01 143/week @ 2024-04-15

385 downloads per month

MIT/Apache

220KB
3.5K SLoC

BDK Electrum

BDK Electrum extends electrum-client to update bdk_chain structures from an Electrum server.


lib.rs:

This crate is used for updating structures of bdk_chain with data from an Electrum server.

The two primary methods are ElectrumExt::sync and ElectrumExt::full_scan. In most cases ElectrumExt::sync is used to sync the transaction histories of scripts that the application cares about, for example the scripts for all the receive addresses of a Wallet's keychain that it has shown a user. ElectrumExt::full_scan is meant to be used when importing or restoring a keychain where the range of possibly used scripts is not known. In this case it is necessary to scan all keychain scripts until a number (the "stop gap") of unused scripts is discovered. For a sync or full scan the user receives relevant blockchain data and output updates for bdk_chain including RelevantTxids.

The RelevantTxids only includes txids and not full transactions. The caller is responsible for obtaining full transactions before applying new data to their bdk_chain. This can be done with these steps:

  1. Determine which full transactions are missing. Use RelevantTxids::missing_full_txs.

  2. Obtaining the full transactions. To do this via electrum use ElectrumApi::batch_transaction_get.

Refer to example_electrum for a complete example.

Dependencies

~8.5MB
~118K SLoC