lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
893 stars 182 forks source link

Possible to compile to WASM to run in browser #237

Open tiero opened 2 years ago

guggero commented 2 years ago

This hasn't been attempted yet. The main blocker for compiling it is probably the bbolt database library that is used for the filter storage. We'd need to build an alternative database backend for the browser. Also the current bitcoin p2p communication that uses TCP/IP directly would need to be bridged over HTTP.

ThomasFarstrike commented 1 year ago

I've been waiting for this feature for a while now and I see it's not gaining much traction...

I think it's doable, although not trivial. But it would be very exciting for sure!

Some possibilities this would unlock:

I might be interested in taking as stab at this but perhaps we need to flesh out the details a little bit more, to get it right the first time.

Any input or pointers would be greatly appreciated, like more details on:

maceip commented 11 months ago

it's already been done elsewhere, just needs to be glued-on here:

🌐 patch the btcwallet dep to use leveldb instead of boltdb (impl) 🌐 patch lnd (& neutrino) to use leveldb and websockets (impl) 🌐 use websocksify to proxy ws to tcp (impl)

i just compiled lnd@latest and btcwallet@latest with GOOS=js GOARCH=wasm, merged with those branches + a few fixes and loaded them in the browser with wasm_exec.js

given the chaotic state of bitcoin <-> wallet <-> browser ux compared with ethereum (thx to the metamask monopoly); putting effort here might pay dividends. to be sure, i installed the latest alby extension and tried to connect to roughly 20 featured sites; about a 2/3 of them were broken, didn't work, or required me to take too much action that I churned. This is unfortunate and further complicated by disjoint efforts across WebLN, Lightning Node Connect (LNC), and whatever is brewing in the nostr space; leading to confusing UX and onerous DX: