Skip to content

Conversation

@Her-Code
Copy link

@Her-Code Her-Code commented Oct 8, 2025

Summary

This PR addresses issue #1974.
It introduces a new fluent builder API for synchronizing wallets with Electrum servers, making wallet synchronization as simple as a one-liner call. The ElectrumSync builder provides an intuitive, chainable interface for configuring and executing wallet sync operations, significantly improving developer experience and reducing boilerplate code for common synchronization tasks.

Features

  • Fluent Builder API : Implement fluent API for ElectrumSync configuration
  • Dual Sync Modes : Fast sync (revealed addresses only) and full scan (until stop gap)
  • Configurable Parameters : Server URL, stop gap, batch size, and transaction output fetching
  • Type Safety : Add ElectrumSyncResult<K> type alias.
  • Add new bdk_builder module with sync functionality

@Her-Code
Copy link
Author

Heyy @oleonardolima, I think there is an issue with the CI - the pin-msrv.sh script is falling on socket 2 version pinning. Mind taking a look?

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always good to have a simplier API. However, this approach has too many sacrifices.

  1. bdk_electrum should only depend on bdk_core (and not bdk_chain). This way, we can make breaking changes to bdk_chain and bdk_electrum will still be compatible with both bdk_wallet and bdk_chain (since bdk_wallet is on a different release cycle).

  2. We loose the cache once we drop BdkElectrumClient. Subsequent syncs/scans cannot make use of the cache - affecting performance.

I'm not sure if these problems can be easily solved - maybe you have some ideas?

@evanlinjin
Copy link
Member

@Her-Code any updates on this?

@Her-Code
Copy link
Author

@Her-Code any updates on this?

Hey, I’m still working on it. I’ve been a bit busy but will update you soon.

@oleonardolima
Copy link
Contributor

Heyy @oleonardolima, I think there is an issue with the CI - the pin-msrv.sh script is falling on socket 2 version pinning. Mind taking a look?

I should be solved by now, you can do a rebase on top of master to get the latest fixed CI.

@oleonardolima
Copy link
Contributor

oleonardolima commented Nov 18, 2025

Heyy @oleonardolima, I think there is an issue with the CI - the pin-msrv.sh script is falling on socket 2 version pinning. Mind taking a look?

I should be solved by now, you can do a rebase on top of master to get the latest fixed CI.

--

Also, I agree with @evanlinjin comments, please mind those when continuing your working on this one.

@Her-Code Her-Code force-pushed the one_liner_sync branch 5 times, most recently from dfde574 to 5f4c4aa Compare November 27, 2025 11:59
- Added new `example_electrum_sync` crate module (lib.rs) implementing:
  - `ElectrumSyncManager` for long-lived Electrum connections
  - `SyncOptions` with builder-style convenience methods
  - One-liner sync API supporting fast sync and full scan
  - Internal helpers for building SyncRequest and FullScanRequest
  - Clean, documented, cache-preserving sync flow aligned with BDK rules

- Updated `main.rs` to use the new manager:
  - Demonstrates fast sync, full scan, custom stop_gap, custom batch_size

- Removed outdated `bdk-builder.rs` from the Electrum folder:
  - Functionality fully replaced by the new sync manager
  - Simplifies API surface and avoids conflicting builders
@Her-Code
Copy link
Author

Hey @evanlinjin , I removed bdk_builder.rs and introduced example_electrum_sync with ElectrumSyncManager and SyncOptions. The module only depends on bdk_core and it also preserves cache across syncs.What do you think?

@evanlinjin
Copy link
Member

@Her-Code which module only depends on bdk_core? What does this example show? Can you explain the PR please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants