I want to build a web wallet that uses Compact Block Filters

To do it, I think I need a reliable way to get data from bitcoin nodes in a web context, particularly (1) block headers (2) compact block filters (3) blocks themselves

Has anyone done any research into this? I found at least one electrum server that exposes its p2p interface via websockets, but I don't know if any bitcoin nodes do that. I thought about getting block headers from electrum servers and then downloading blocks from services like mempool_space and blockstream_info, but I suspect their rate limits would stop me from downloading more than ~100 blocks, and that still leaves me with the problem of finding someone that serves compact block filters in a web-friendly way.

What to do? Has anyone thought about running websockify on top of a bitcoin node to expose its p2p interface to the web? Maybe if a few nodes did that, a directory of web-friendly bitcoin nodes could be created, and web-SPV wallets could download blocks and block filters from them. Is that a good idea? Seeking feedback 🙂

Reply to this note

Please Login to reply.

Discussion

websockets socket proxy is usually the answer. I do that for talking to my lightning node from the browser. although cln has full support for websockets as well which is nice for non proxies connections.

> websockets socket proxy is usually the answer

I think it's part of the solution, except for this: if the user has to run the proxy, it's much less effective as a browser wallet. You might as well just "install" a wallet. That's why I wonder if any bitcoin nodes are running a generic websockets-to-tcp proxy like Websockify in front of their bitcoin node. If they are, then I can design a web wallet which gets block data from *them,* that way the user doesn't need to run a full node -- they'll just download data from other nodes, the same way "thin" bitcoin clients are supposed to do.

Nice! We need full SPV with merkel proofs, imho.

Seems like at least some of this should be doable by querying the API on mempool-space instances? (Not just the one at mempool.space.) And there are a lot of those, though I'm not sure they're listed anywhere.

All of the ones I've tried to use on the web regularly fail to deliver content because of a CORS restriction. I think most people who set those up want the "visual" block explorer in the browser but don't care about letting other people "programmatically" access that data from a browser. Even mempool.space and blockstream.info throw cors errors if a web page queries their api endpoints via the `fetch` method, for example

Re: block headers. I quickly put this together. When my node is fully synced, I will keep it updated. After that a decentralized nostr layer for the other items you suggest and merkle proofs.

http://bitcoin.cc/