You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This is a long term issue that I'm opening in order to keep track of PRs moving towards this direction.
We can't directly compile node for wasm32-unknown-unknown. Instead, we should create a new library (named for example substrate-light-wasm) that exposes an API usable from JavaScript, thanks to wasm-bindgen.
Once that crate exists, we can use wasm-pack to generate .js and .wasm files from substrate-light-wasm. The .js can then be used from regular JavaScript code.
Some challenges include:
We can't use TCP/IP. Libp2p already provides a wasm-ext transport that can be used to "import" a transport from the JavaScript world, such as WebSockets.
The RPC needs either to be disabled, or be replaced with something that compiles for the browser.
The telemetry needs either be disabled, or be replaced with something that compiles for the browser. I have a WIP branch that replaces the telemetry with libp2p.
We need to remove background threads, and have a fall-back for background tasks when tokio isn't available.
The tokio dependencies need to be replaced with dependencies to their sub-crates: tokio-io, tokio-codec, etc.
ring and rust-crypto don't compile for WASM. As far as I know, only diffie-hellman exchanges aren't possible through pure-Rust-only crates at the moment. Libp2p uses WebCrypto as a replacement.
niklasad1, rphmeier, dvdplm, amaury1093 and riusricardoevq