payjoin / rust-payjoin

Supercharged payment batching to save you fees and preserve your privacy
https://payjoindevkit.org
85 stars 36 forks source link

The `bitcoincore-rpc` dependency has problems in our specific use case #350

Open DanGould opened 3 weeks ago

DanGould commented 3 weeks ago

bitcoincore-rpc presents us with a few problems

1. It depends on a different HTTP client stack than the rest of the project, minreq

Everywhere else in this project we use reqwest. There is an ecosystem-wide call for an async capable http crate with minimal dependencies which we discussed at rust-bitcoin summit. This crate does not exist as of writing, so we use reqwest for async requests in payjoin-cli and bitcoincore-rpc depends on minreq

2. It has no TLS support out of the box

Though minreq supports TLS, but afaict TLS is not exposed in bitcoincore-rpc and can't easily be enabled.

@thebrandonlucas ran into this problem trying to connect to a remote MutinyNet node hosted by voltage over HTTPS.

3. bitcoincore-rpc isn't really meant for production nor maintained

I've had this discussion with @tcharding: the maintainers intend that crate to be used for integration testing only and suggest production implementations depend on bitcoin-json-rpc-types and build their own application-specific client. There is a rust-miniscript PR for this dependency swap but I haven't found more specific documentation of best practice yet.

tcharding commented 3 weeks ago

Just to clarify, because all these crates are a bit confusing:

The next steps are:

Applications should write their own rpc client that supports just the subset of JSONRPC methods they need. There is nobody among the rust-bitcoin devs that is interested in supporting feature requests and bug reports against a production client. We do, however, feel obligated to provide the types and testing stuff. This obligation is the motivation for putting all these crates in a single repo so they can be more easily managed and isolated.

ref: https://crates.io/search?q=bitcoind-json-rpc