Mempool.space support
Describe the enhancement
Hi all, my latest tests show that mempool.space does not work with bdk_esplora. The first error appearing is that mempool.space does not support the scripthash endpoints, only the address endpoints so we get this:
Cannot GET /api/v1/scripthash/.../txs as a 404
Also fee estimates does not work as the endpoint is not fee-estimates but fees/recommended.
I'll be very happy to work on this if it's decided to either add support to bdk_esplora or to create a dedicated bdk_mempool_space (valuable for websockets).
Use case
Esplora being too heavy on resources, it is not suitable for node runners. Most will directly connect to their node or use an indexer such as Electrum. Sadly Electrum or the node do not work on the browser for different reasons.
Mempool.space being a fork of Esplora, it exposes a REST API and a websocket API, ideal for browsers and Node through bdk-wasm.
Additional context Mempool.space being a fork of Esplora, we could expect it to simply work out of the box yet it doesn't. People running their own node on Umbrel or Start9 can easily run their own mempool.space instance, as easily as running Electrs.
This work would also help bark.
We are heavily reliant on package-relay which is currently not supported by esplora. See PR.
Having the ability to use mempool.space would help us forward
I still think it wouldn't be great if we just gave up and accepted an even more fragmented protocol space as it will be even worse UX (note that many users already struggle understanding the difference between Electrum and Esplora). It may be worth reaching out to Blockstream folks to see if they'd be interested in migrating to the mempool fork, if Blockstream/electrs indeed is considered deprecated/unmaintained.
The package-relay MR has been merged and be available in prod soon, sorry for the tremendous delay.
Hey, I just wanted to add something to this. It seems there is a little confusion regarding the APIs available in the Esplora/Blockstream version of electrs and mempool.space. You can actually use the mempool.space version of electrs with bdk_esplora, we use it in our testing framework for Bark although I'm not confident we test each endpoint. I think the confusion here is that if you check the official mempool.space docs it looks like they offer one REST API when they actually seem to run the mempool-electrs REST API (endpoints starting with /api/ and a custom REST API build on top (endpoints starting with /api/v1/). You can verify this by visiting https://mempool.space/api/fee-estimates.
My recommendation would be to just run the mempool.space implementation of electrs and use bdk_esplora with it or you could point bdk_esplora to https://mempool.space/api however they do implement rate limiting so it may not be useful for production.
Hi @PeteClubSeven and thanks for the advice. This is indeed confusing and there seems to be no guarantee whether or not mempool.space will stick to that API, as it is currently hidden.
@tnull, your comment seems to imply that your preference would be in supporting mempool.space rather than Esplora and ask Esplora to migrate to mempool instead?
@tnull, your comment seems to imply that your preference would be in supporting mempool.space rather than Esplora and ask Esplora to migrate to mempool instead?
No, my preference is that mempool.space and Blockstream start talking to each other to figure out a way so we have/maintain one compatible protocol standard (at least for a base set of features) instead of increasing the fragmentation in the ecosystem.
How they do it I don't really care tbh, Blockstream switching to mempool's fork was only one suggestion (although I doubt they'd actually do that).
Yes that makes sense, and as @PeteClubSeven mentioned, I might have been mistaken that the API is not supported and tried using the v1 endpoint instead of directly using the /api one. We're good for now!