Importing the Rust SDK


The Sawtooth Rust SDK assumes that you have the v1.1.5 version of Rust and its package manager Cargo, which can be installed with rustup.

Once you’ve got a working version of Sawtooth, there are a few additional steps you’ll need to take to get started developing for Sawtooth in Rust.

  1. Add Sawtooth to your Cargo.toml file. The Rust SDK is located at /project/sawtooth-core/sdk/rust in the main Sawtooth repository.

Sample Cargo.toml for a Sawtooth Rust project
name = "package_name"
version = "0.1.0"
authors = ["..."]

sawtooth_sdk = { git = "" }
// --snip--
  1. Import the SDK into your Rust files. At the top of your files, specify extern crate sawtooth_sdk; and then use the packages you need from the Sawtooth SDK. For example:

Sample header for a Rust file
extern crate sawtooth_sdk;

use sawtooth_sdk::processor::TransactionProcessor;

// --snip--