obastemur / sputnikvm-in-browser

Run SputnikVM in browser through wasm32-unknown-emscripten target.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SputnikVM in Browser

This compiles the no_std version of SputnikVM and run it in browser, using Rust's wasm32-unknown-emscripten target.

Get Started

Installing a custom target for Rust is not yet an easy task so it is recommended to use rustup. The no_std version needs Rust nightly due to its use of alloc library.

rustup install nightly
rustup default nightly

After that, install the wasm32-unknown-emscripten target.

rustup target add wasm32-unknown-emscripten

You will need to install emscripten next. Note that the build can take quite a long time.

wget https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
tar -xvf emsdk-portable.tar.gz
cd emsdk-portable
./emsdk update
./emsdk install sdk-incoming-64bit
source ./emsdk-env.sh

After that, you can compile this project.

npm run compile
npm run serve

Go to http://127.0.0.1:8080 and open the web console. The example will execute a sample EVM program using SputnikVM, and if no error is reported, you will see a 0 printed.

About

Run SputnikVM in browser through wasm32-unknown-emscripten target.

License:Apache License 2.0


Languages

Language:Rust 57.9%Language:JavaScript 35.7%Language:HTML 6.4%