Links

Applets and Handlers

A W3bstream Applet is a container for the actual logic of a W3bstrem node. Since W3bstream's execution engine is based on a WebAssembly virtual machine, Applets must be compiled as WASM modules:
W3bstream Applets must be compiled as WASM modules

Exporting event handlers

An Applet must export at least one public function to be called by the W3bstream Virtual Machine. Exported functions in an Applet are also called Event Handlers and they can be used as the target Handler in a Project's event strategy.​
Event Handlers in an applet must have the following signature:
Typescript
Go
Rust
C++
// A W3bstream Event handler defined in an Applet written in AssemblyScript
export function start(rid: i32): i32
// A W3bstream Event handler defined in an Applet written in Go
func do_something(event_id uint32) int32
// A W3bstream Event handler defined in an Appletwritten in Rust
pub extern "C" fn do_something(event_id: i32) -> i32 { ... }
// A W3bstream Event handler defined in an Applet written in C++
EMSCRIPTEN_KEEPALIVE uint32_t do_something(uint32_t event_id)

Calling W3bstream host functions

Using available SDKs, W3bstream applets can call several host functions, that give access to W3bstream's functionalities.
Typical host functions that you'll want to call from an applet range from logging functions to, data storage to blockchain transactions.
💡 Learn more
About WebAssembly
WebAssembly provides a way to create safe and portable code written in multiple languages that can run at near native speed. The full WebAssembly documentation is available at https://developer.mozilla.org/en-US/docs/WebAssembly
W3bstream is based on the WASI interface. To learn more about WASI, check out https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-intro.md​
Supported toolchains
More resources
Last modified 1mo ago