The W3bstream Applet Kit for Go is a set of tools and libraries that enable developers to create W3bstream applets using the Go programming language. The Kit provides wrappers for W3bstream's host functions, allowing Go developers to interact with the W3bstream network and build decentralized applications that leverage the power and flexibility of the IoTeX blockchain.
Before you can use the W3bstream Applet Kit for Golang, you need to have the following tools installed on your system:
- Go (version 1.18 or later)
- TinyGo (0.25.0 or later)
Create a Go project
- Install Go using by following the official instructions: https://go.dev/doc/install
- Create a new folder for your project
mkdir my-w3bstream-applet
cd my-w3bstream-applet
- Initialize the project with
go mod
:
go mod init my-w3bstream-applet
To use the W3bstream Applet Kit in your Go projects, just import the module with:
package main
import "github.com/machinefi/w3bstream-wasm-golang-sdk/log"
...
When it's time to build your applet, follow these steps:
- Run the following to download all required packages, including the W3bstream Kit:
go mod tidy
- Build the applet as a WASM module with:
tinygo build -o my-w3bstream-applet.wasm -scheduler=none --no-debug -target=wasi my-w3bstream-applet.go
The source code of the W3bstream Applet Kit for Go, including examples, can be found on GitHub at:
{% embed url="https://github.com/machinefi/w3bstream-wasm-golang-sdk" %}