[][src]Crate xpx_supercontracts_sdk

XPX Supercontracts SDK

The documentation describe basic functions and tools for implementation XPX Supercontracts based on XPX Wasm VM (WebAssembly Virtual Machine).

Currently supported target: wasm32-unknown-unknown.

Development flow

  • Check is installed target: rustup target list | grep wasm32-unknown-unknown
  • If target not install add it: ``rustup target add wasm32-unknown-unknown
    • Create boilerplate supercontract app: cargo new my-supercontract
  • Add to Cargo.toml:
This example is not tested
crate-type = ["cdylib"]

xpx_supercontracts_sdk = "0.1"
  • Here we go! Application ready to build. To build application: cargo build --release --target wasm32-unknown-unknown.


Supercontract functions should be external with specific attributes:

This example is not tested
use xpx_supercontracts_sdk::utils::{ping, debug_message};

pub extern "C" fn app_main() -> i64

External function ay Supercontract can freely naming but with only one underscore symbol _. It's no restriction to number of external functions. External function should has directive #[no_mangle]. External function can return only i64 type.

Be careful with large amount of data, it's most expensive operation for Gas calculation.


Most simple Supercontract that ping WasmVM and send debug message with result to WasmVM.

use xpx_supercontracts_sdk::utils::{ping, debug_message};

pub extern "C" fn app_main() -> i64 {
    let ping_number: usize = 99;
    let pong_result = ping(ping_number);
    let msg = format!("Supercontract Ping: {:?} and Pong: {:?}", ping_number, pong_result);
    return 0;



Basic HTTP functions


Execution error statuses


Basic functionality for communication with Storage


Basic Blockchain functions


Basic Transactions types for Blockchain functions and getters


Basic utils functions for communication with WasmVM.