Golang

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.

Requirements

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
  1. Install Go using by following the official instructions: https://go.dev/doc/install

  2. Create a new folder for your project

mkdir my-w3bstream-applet 
cd my-w3bstream-applet
  1. Initialize the project with go mod:

go mod init my-w3bstream-applet

Installation

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"
...

Build

When it's time to build your applet, follow these steps:

  1. Run the following to download all required packages, including the W3bstream Kit:

go mod tidy
  1. 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

Contribute

The source code of the W3bstream Applet Kit for Go, including examples, can be found on GitHub at:

Last updated