2023-12-06 21:14:16 -06:00
|
|
|
//! This crate is used for updating structures of [`bdk_chain`] with data from an Electrum server.
|
2023-03-01 11:20:00 +01:00
|
|
|
//!
|
2023-12-06 21:14:16 -06:00
|
|
|
//! 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`].
|
2023-03-01 11:20:00 +01:00
|
|
|
//!
|
2023-12-06 21:14:16 -06:00
|
|
|
//! The [`RelevantTxids`] only includes `txid`s 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:
|
2023-08-26 20:29:46 +08:00
|
|
|
//!
|
2023-12-06 21:14:16 -06:00
|
|
|
//! 1. Determine which full transactions are missing. Use [`RelevantTxids::missing_full_txs`].
|
2023-03-01 11:20:00 +01:00
|
|
|
//!
|
2023-12-06 21:14:16 -06:00
|
|
|
//! 2. Obtaining the full transactions. To do this via electrum use [`ElectrumApi::batch_transaction_get`].
|
2023-03-01 11:20:00 +01:00
|
|
|
//!
|
2023-12-06 21:14:16 -06:00
|
|
|
//! Refer to [`example_electrum`] for a complete example.
|
2023-03-01 11:20:00 +01:00
|
|
|
//!
|
2023-12-06 21:14:16 -06:00
|
|
|
//! [`ElectrumApi::batch_transaction_get`]: electrum_client::ElectrumApi::batch_transaction_get
|
|
|
|
//! [`example_electrum`]: https://github.com/bitcoindevkit/bdk/tree/master/example-crates/example_electrum
|
2023-03-01 11:20:00 +01:00
|
|
|
|
2023-07-19 17:42:52 +08:00
|
|
|
#![warn(missing_docs)]
|
|
|
|
|
2023-05-24 11:37:26 +08:00
|
|
|
mod electrum_ext;
|
2023-05-12 00:08:16 +08:00
|
|
|
pub use bdk_chain;
|
|
|
|
pub use electrum_client;
|
2023-05-24 11:37:26 +08:00
|
|
|
pub use electrum_ext::*;
|