Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to compile to WASM to run in browser #237

Open
tiero opened this issue Nov 23, 2021 · 3 comments
Open

Possible to compile to WASM to run in browser #237

tiero opened this issue Nov 23, 2021 · 3 comments

Comments

@tiero
Copy link

tiero commented Nov 23, 2021

No description provided.

@guggero
Copy link
Member

guggero commented Nov 23, 2021

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
Copy link

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:

  • Running Neutrino in the webbrowser (obviously) would allow using Lightning completely from the browser, nothing to install, no external node to setup and run.
  • Getting non-custodial mobile Lightning wallets to work in the browser. For example, the Breez wallet includes Neutrino and is written in Flutter, so running it in the browser should be possible, if Neutrino would work in the browser.
  • Bundling a Lightning node with a Lightning browser plugin (such as Zebedee) to allow them to be non-custodial.
  • Many more use cases, I'm sure...

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:

  • exactly what would be the best technology to (re)use for the database?
  • exactly how could the Bitcoin p2p traffic be bridged over HTTP? Any existing technologies or solutions we can base this on?

@maceip
Copy link

maceip commented Aug 10, 2023

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants