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

Support in browser and Node environments. #34

Open
darioAnongba opened this issue Dec 10, 2024 · 2 comments
Open

Support in browser and Node environments. #34

darioAnongba opened this issue Dec 10, 2024 · 2 comments

Comments

@darioAnongba
Copy link

Hi everyone,

I arrived in this repo by doing a deep dive starting from the BitcoinDevKit. I am writing a library called bdk-wasm enabling usage of BDK in the browser and Node by compiling it to WASM and creating TypeScript bindings.

I was surprised when I saw that BDK, when using the bitcoind_rpc feature, compiles to WASM just fine and can be executed. It sadly fails in the browser and Node with the following error:

JsonRpc(Transport(SocketError(Error { kind: Unsupported, message: \"operation not supported on this platform\" })))

The Bitcoin node exposes over HTTP and we can successfully query Esplora from the browser and Node using esplora_client. This package uses reqwest under the hood that has a target "wasm32-unknown-unknown". Meaning that I think this package could work easily within browser and Node when compiled to WASM.

Proposal

Add a feature or target mechanism that uses reqwest, adding support for Browser and Node environments.

Let me know if you think this won't work or if it's a bad idea. I'm happy to implement the changes myself.

@apoelstra
Copy link
Member

We've considered reqwest and passed on it because it has a very large dependency tree and doesn't match our MSRV policy (although it looks like right now we have the same MSRV).

We've also struggled to get anybody to maintain this crate -- nobody likes working on HTTP. It's a crufty mess of an overloaded protocol and an eternal source of mysterious "this happens to me on Mac OS 10.3 on Tuesdays when the microwave was on for more than 90 seconds, the error message is sockaddr had invalid syn packet metaflorp bitflags" type bugs.

So is WASM for that matter, and WASM has the additional problem that the tooling is unstable and impossible to pin or even to run in a sealed environment.

I'll leave this issue open since, in general, we would like to support WASM, and we're often willing to support popular crates like reqwest (at least, behind a default-off feature gate) that will work in our CI. But I personally am not willing to do the work to maintain this right now.

@darioAnongba
Copy link
Author

Hahaha understandable. Let's keep this open and see as it's true that we shouldn't expect someone to maintain this if there is no strong demand for it.

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

2 participants