You can use the trustbase pre-built binary download to start your work. The following steps show how to build trustbase client from scratch.
Build your own trustbase client
the first thing you will need to do is prepare the computer for Rust development - these steps will vary based on the computer's operating system. Once Rust is configured, you will use its toolchains to interact with Rust projects; the commands for Rust's toolchains will be the same for all supported, Unix-based operating systems..
This guide uses
rustup to help manage the Rust toolchain. First install and
# Install curl https://sh.rustup.rs -sSf | sh # Configure source ~/.cargo/env
Configure the Rust toolchain to default to the latest stable version:
rustup default stable
TrustBase uses WebAssembly (Wasm) to produce portable blockchain
runtimes. You will need to configure your Rust compiler to use
nightly builds to allow you to
compile TrustBase runtime code to the Wasm target.
Rust Nightly Toolchain
Developers building with TrustBase should use a specific Rust nightly version that is known to be compatible with the version of TrustBase they are using; this version will vary from project to project and different projects may use different mechanisms to communicate this version to developers. The TrustBase Node Template uses an init script and Makefile to specify the Rust nightly version and encapsulate the following steps. Use Rustup to install the correct nightly:
rustup install nightly-<yyyy-MM-dd>
Now, configure the nightly version to work with the Wasm compilation target:
rustup target add wasm32-unknown-unknown --toolchain nightly-<yyyy-MM-dd>
Specifying Nightly Version
WASM_BUILD_TOOLCHAIN environment variable to specify the Rust nightly version a TrustBase
project should use for Wasm compilation:
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --release
Note that this only builds the runtime with the specified nightly. The rest of project will be compiled with the default toolchain, i.e. the latest installed stable toolchain.
Compiling TrustBase client
Once the prerequisites are installed, you can use Git to clone the TrustBase repo.
git clone https://github.com/TrustBase/trustbase
Initialize WebAssembly build environment
Compile the client
cargo build --release --locked
The time required for the compilation step depends on the hardware you're using.