Wapo is a poll-based async WebAssembly runtime that provides extended networking support for guest WASM applications. It originated as a module called SideVM in Phala PRuntime, now independent, and the execution engine has been switched from wasmer
to wasmtime
.
Wapo is mainly designed as the next version of the Phat Contract execution engine. However, it can be used as a general-purpose WebAssembly runtime with networking support. The Phat Contract execution engine today is based on Substrate's pallet-contracts, which is not flexible enough and also has many limitations. Here is the table of comparison between 2.3 and 3.0:
Phat Contract 2.0 | Phat Contract 3.0 | |
---|---|---|
Program type | WebAssembly | WebAssembly |
VM Engine | wasmi | wasmtime (faster) |
Incoming Networking | Query RPC | Query RPC or Listening on TCP port |
Outgoing Networking | HTTP requests (with time and size limit) | Arbitrary TCP connections |
Execution mode | Transaction/query-based, 10s limit | Long-running or query-based, no tx |
App Memory | 4MB for ink / 16 MB for JS | Up to 4GB due to wasm32 limit |
git clone https://github.com/Phala-Network/wapo.git --recursive
cd wapo/wapod
cargo run --release -- -m 1g
The above instructions will build and run the wapod, where -m 1g
means the memory size of the WASM instance is 1GB.
By default, the wapod will listen on http://127.0.0.1:8001/
for admin RPC requests. You can open this URL in your browser to see a simple debug console, deploy the examples.
WapoJS is another example which ports QuickJS to Wapo.
To run wapod in SGX, you need to install the Gramine SDK. See Gramine for more information.
Then you can build and run wapod in SGX as follows:
git clone https://github.com/Phala-Network/wapo.git --recursive
cd wapo/wapod/gramine-build
make dist
cd ../bin/
./gramine-sgx wapod
Wapo is licensed under the Apache License 2.0.