You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sync a caller-chosen set of scripts with ElectrumClient #1148
Let a caller sync a set of scripts they choose with ElectrumClient, rather than every script the wallet has revealed.
Use case
A wallet sometimes needs to check one or two of its own scripts right away, like when a payjoin receiver wants to know whether a receipt to its address has reached the mempool, and a sender wants to know whether its inputs were spent.
The bindings offer two ways to do that today, and neither works well. ElectrumClient can look up a transaction by txid (fetch_tx, transaction_get_raw), but asking a server about a transaction you expect before it is broadcast tells the server you are part of it whether or not it ever exists, (and using payjoin, revealing a transaction that never confirms that combines clusters needlessly relates two otherwise unrelated users). Otherwise it can run full_scan or sync. A SyncRequestBuilder only comes from Wallet::start_sync_with_revealed_spks, which covers every revealed script.
The whole-wallet sync is slow for this. I timed it against electrs on regtest with a 170-transaction wallet (bdk_wallet 3.1.0, bdk_electrum 0.24.0, batch size 50, a new client for each sync, no prevout fetching), adding a fixed delay to each request. Syncing the revealed scripts took 178 sequential round trips, mostly one transaction.get per wallet transaction. Syncing only the payment address took 4. At 100 ms per round trip that is 17.9 s against 0.4 s.
bdk_core's SyncRequest::builder().spks(...) already supports this. Would you take a PR that adds either a SyncRequestBuilder constructor that takes a list of scripts, or ElectrumClient::script_get_history?
Additional context
bitcoindevkit/bdk_wallet#269 asks for something close on the Rust side, filtering the scripts in a wallet's SyncRequestBuilder.
I agree with what you're saying, @thunderbiscuit has #1012 he's working on, would that work for you (or do you need to supply scripts directly or something different potentially)
Activity
reez commentedon Oct 20, 2026
I agree with what you're saying, @thunderbiscuit has #1012 he's working on, would that work for you (or do you need to supply scripts directly or something different potentially)