Rust Smart Contract API

This Technology Preview provides an updated Contract and Ledger API in Rust. It is targetted to be compiled to WebAssembly and run in the fabric-chaincode-wasm engine.

The API presented here is the evolution of the APIs available in the other SDKs to support developing smart contracts (chaincode). There are three other smart contract SDKs available for Go, Node.js, and Java SDK:

Getting setup

You’ll need some tools installed, some you might already have:

  • docker & docker-compose
  • rust and the Wasm toolchain
    • Stable Rust is sufficient, nightly is not required. Instructions at the rust-lang.org
    • To build a Wasm binary you will need to have the wasm target. Note that wasm-pack is not required here as there is no JavaScript host.
      • rustup target add wasm32-unknown-unknown
  • git
  • just for use as a script running tool

VSCode is our preferred editor, with the Rust Extension using the Rust Analyser. You may, of course, have your own favourite editor.

This also has been developed on Linux; but development should be possible on other platforms.

Guides

Essential reading, each guide around a single topic.

Samples

Two examples are available in this repo.

Note that ‘Secure Asset Transfer’ is a work in progress and will not yet compile