Go SDK
Functions to manage your allocations
Last updated
Functions to manage your allocations
Last updated
Please Note: This SDK is subject to tremendous changes in the next releases that can be backward incompatible. Please pay close attention to our announcements on Discord.
GoSDK is the official Go-based Software Development Kit (SDK) for the Züs decentralized storage network. It enables developers to integrate Züs storage functionalities into their applications while providing tools for wallet management, file operations, staking, and smart contract interactions.
The SDK supports various platforms, including Linux, macOS, and Windows. Additionally, GoSDK can be built for mobile (iOS/Android) and WebAssembly (WASM) to provide broader compatibility across different environments.
GoSDK is compatible with the following operating systems:
MacOS (10.14.5 or later)
Linux (Ubuntu 18+, CentOS 7+, Fedora 30+)
Windows (via WSL or native support)
Before installing GoSDK, ensure you have:
Go (Golang) installed: Install Go
Go Modules enabled: Run export GO111MODULE=on
in your terminal
Install GoSDK:
Create a file named sdkversion.go
and add the following code:
Build the sample application:
Run the executable:
If the GoSDK version is printed successfully, the installation is complete.
GoSDK supports mobile app development through gomobile
, allowing integration with iOS and Android apps.
Prerequisites
iOS: Requires Xcode Command Line Tools
Android: Requires Android Studio with NDK
Steps to Build for Mobile
Setup the Go Mobile environment:
(If golang.org/x/mobile/bind
is missing, install it using go get golang.org/x/mobile/bind
)
Build the SDK:
For iOS:
For Android:
To expose GoSDK functions in Mobile SDK, follow these steps:
For an existing file function (e.g., zboxcore/sdk/allocation.go
):
Add a wrapper function inside mobilesdk/sdk/zbox/allocation.go
For a new function:
Create a new Go file in mobilesdk/sdk/zbox/
Implement the function to call the respective GoSDK method.
Build the SDK again (make build-ios
or make build-android
).
GoSDK can be compiled into WASM for web applications. Example functions that have been exported include:
wasmsdk/ethwallet.go
(exports Ethereum wallet functions)
wasmsdk/wallet.go
(exports core wallet functionalities)
Steps to Export a GoSDK Function to WASM
Modify wasmsdk/wallet.go
or create a new file.
Register the function in WebAssembly (proxy.go
):
Compile the WebAssembly binary:
Test the WASM function:
Replace proxy.wasm
in the test client.
Run a local server (php -S localhost:82 test/server.php
).
Execute the exported function via JavaScript.
GoSDK includes a test suite to validate functionality.
Run all unit tests in bls0chain_test.go
:
Run a single test (e.g., TestSignatureScheme
):
go test
for WASMInstall Node.js (Required for testing)
Set environment variables for WASM testing:
Run the WASM test suite: