Skip to content

Make chain-sources non-dependent on a specific bdk_chain version. #1543

@evanlinjin

Description

@evanlinjin

Describe the problem

We may want to be able to iterate fast on bdk_chain without breaking Wallet. This means Wallet may be of an older version of bdk_chain. Therefore, Wallet (currently) will have to use older versions of chain sources (since our chain sources depend on bdk_chain).

It will be a nice property if projects that use BDK can stay put on a specific bdk_chain version, but still use the latest chain-source crate version.

Additional context

Why would we need to break bdk_chain?

There are a couple a breaking changes that we simply do not have enough time to include in the v1.0-beta release.

  1. refactor(chain)! removed IndexedTxGraph 🗑 #1510
    Get rid of IndexedTxGraph and just put the Indexer in TxGraph. This removes a bunch of overhead and is in general much cleaner.
  2. refactor(chain)!: Remove Anchor trait and make anchors unique to (Txid, BlockId) #1515
    Removing the anchor trait, and representing the Anchor as a concrete type is much cleaner and a less error-prone API.

Both of these changes will break ChangeSet.

Proposed solution

Introduce bdk_core crate that moves structures and types from bdk_chain that will mostly stay constant.

  • Types: BlockId, ConfirmationBlockTime.
  • Updates: CheckPoint, introduce tx_graph::Update (instead of using TxGraph to update TxGraph).
  • Spk-client types: FullScanRequest, FullScanResult, SyncRequest, SyncResult.

Chain sources will only depend on bdk_core. Note that we need to introduce tx_graph::Update though.

Potential downsides

bdk_core will still need to depend on bitcoin. Any major version updates to bitcoin will be a breaking change and we will need to introduce a new major version for bdk_core. To make these suggested changes useful, we need to lock down on specific major releases of bitcoin.

Acknowledgement

Thank you to @LLFourn for bringing up this idea.

Metadata

Metadata

Labels

new featureNew feature or request

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions