Replies: 3 comments 4 replies
|
I lean towards Option 2. It is the option where we decide the API, the dependencies and the release cadence, and maintaining a crate that already exists under the org looks cheaper than adopting one that is either declared test-only or no longer released. One caveat on the advisories, since they are part of the motivation: ( |
|
@tvpeter I want to make sure I understand your step 1 recommendation. Do you mean create our own separate crate for I'm generally in favor of your phased approach which gives us time to update the The other clients, |
|
I see the importance of replacing In terms of the recommendation, it looks good to me. However, I would prefer it if we rename |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Context
bdk_bitcoind_rpcis BDK's chain-source crate for Bitcoin Core. It pulls blocks and mempool data over JSON-RPC and returns them in a form BDK's chain structures (LocalChain,IndexedTxGraph,Wallet) can apply directly. It needs only about seven RPCs:getblockcount,getblockhash,getblock,getblockheader,getrawmempool,getrawtransactionandgetblockfilter.Today it depends on
bitcoincore-rpc, which provides four things:bitcoind, viajsonrpcon top ofminreq.RpcApitrait, which builds and serializes requests.bitcoincore-rpc-jsondeserializes Core's JSON into Rust structs.It is also a public dependency:
bdk_bitcoind_rpcre-exports it and exposes its error type. Replacing it is therefore a breaking change whichever option we pick.The problem
bitcoincore-rpcwas archived on 2025-11-25 and is no longer maintained.corepc, which has per-Core-version types.minreqdependency pulls inrustls-webpki0.101.7. That causes the RUSTSEC advisories incargo audit, and they can never be fixed upstream.corepc-client, is not meant for production. Its authors say production software should write its own client and depend only oncorepc-types.Option 1: Adopt an existing client
corepc-clientcorepc-typesper Core version;jsonrpc+bitreq. Test-only by its authors' own statement.jsonrpc+corepc-typesbitreq_http/bitreq_http_async). Still needs auth, method wrappers and error mapping, which is effectively writing a client.bitcoind-async-clientbitreqconnections.lightning-block-synclightning; no typed mempool or filter RPCs.bitcoincore-rpc-asyncPros
Cons
bdk_bitcoind_rpcreleases.reqwest,lightning).Option 2: Build our own client (
bdk_bitcoind_client, separate crate)A thin, BDK-owned client built on
corepc-typesandjsonrpc+bitreq, all maintained by rust-bitcoin. Version 0.2.0 is already published, with Core 28/29/30 feature flags, and the migration is proposed.Pros
rustls-webpki0.101 is never pulled in).bdk_esploraonrust-esplora-client,bdk_electrumonrust-electrum-client).Cons
bdk_bitcoind_rpcand bdk-cli.Option 3: Merge the client into
bdk_bitcoind_rpcPros
Cons
bitcoincore-rpcre-export covers broadcast and fees). Making the client public brings back the API leak and grows the crate's scope.bdk_coreand the emitter.Middle ground: move
bdk_bitcoind_clientinto thebdkrepo as a workspace crate. This removes cross-repo coordination and keeps a standalone, separately versioned client. The workspace MSRV (1.85) already matches.Option 4: Make
bdk_bitcoind_rpcsans-ioSans-io ("without I/O") means the library holds only protocol logic and state and never touches the network. It answers three questions:
bdk_chainandbdk_walletalready follow this idea (they do no I/O and only apply updates). The chain-source crates are where I/O happens today.Pros
bitcoind.getrawtransactioncalls in one round trip).Cons
mempool_atretry loop,FilterIterreorg rewinds).bdk_esploraandbdk_electrumunless they are converted too.Comparison
bitcoindRecommendation (author's opinion)
Use Option 2 now, keep Option 4 as the long-term direction, and don't adopt a third-party client.
bdk_bitcoind_clienttobdk_bitcoind_rpc.Emitterinternals into a private sans-io core and keep today's blocking API as a driver over it. This is largely non-breaking and gives the testing benefits immediately.bitreq_http_async) and request batching, and letbdk_bitcoind_clientshare the same request and response layer.Each step is small enough to review and release on its own, and the sans-io design gets proven by tests before it becomes public API.
All reactions