bdk
bdk copied to clipboard
Mempool.space Integration in BDK
Description
mempool.space is a very nice and useful blockchain explorer. They also have a rich public API which can be used to query the blockchain data, which has more capabilities than Core RPC or other blockchain APIs.
Expected Outcomes
- Understanding of Bitcoin Blockchain APIs.
- Understanding of BDK’s blockchain syncing methods.
- A mempool.space backend in BDK library.
Resources
Skills Required
- Experience with git. Guide
- Basic familiarity with rust. First seven chapters of the book
- Familiarity with BDK’s descriptor usage.
- Familiarity with rust traits.
Mentor(s)
@rajarshimaitra
Difficulty : Medium
Competency Test (optional)
- Install rust, compile and run all bdk examples and tests.
- Read through the BDK docs.
- Make a dummy wallet with BDK with different blockchain backends.
- Familiarity with basic rust, should be able to write basic custom trait implementations on foreign structures.
mempool.space is just esplora. We actually use mempool.space as the default backend in gun
because it's much more reliable than blockstream.info.
Hmm makes sense. Probably it will be redundant in context of BDK. But might be a good exercise for students to get familiar with blockchain APIs and wallet syncing.
I don't remember who/when, but I think somebody said that they expose more powerful APIs that we could take advantage of (?)
@notmandatory do you remember this or I am just making this up?
Yes it was @wiz who suggested we integrate with mempool's more extensive api, docs are here:
https://mempool.space/api
original issue is #289.
Yeah I think mempool.space does indeed have more data and indexes but to be clear I mean that the Blockchain
trait can just use the esplora API it supports and do just fine.
Perhaps an interesting thing would be to add the mempool.space websocket backend to do live syncing similar to what @johncantrell97 was talking about with respect to fetching data live from blocks.
I just want to add that the cool thing about our API is that it can also run on a Raspberry Pi - this probably better enables integration with BDK for self-hosted projects
I just want to add that the cool thing about our API is that it can also run on a Raspberry Pi - this probably better enables integration with BDK for self-hosted projects
Don't you have to run rust esplora backend to support your API though? I thought it was pretty difficult to run on a raspberry pi. I had a lot of difficult on a old tower PC with 16gb ram.
No, that's the whole point, we support 3 backends: bitcoind RPC only, romanz/electrs, and blockstream/electrs - our mempool backend is a wrapper around these 3 to expose a unified API. Of course without one of the two supported electrs backends you can't do address lookups, and using romanz/electrs also has some limitations, but for the most part everything works ;)
mempool.space is just esplora
That's not true, as mempool can easily be self-hosted on a Raspberry Pi with just one click installation from the app stores on Umbrel, RaspiBlitz, RoninDojo, and MyNode - esplora only runs on a powerful server.
We actually use mempool.space as the default backend in gun because it's much more reliable than blockstream.info
Thanks, we own and operate our own global ISP for the mempool.space servers whereas Blockstream uses cloud providers and hosting companies, so it's great to hear we are more reliable :)