Rust is used as a key part of the Radix stack, and is published to crates.io
with each release.
There are a few Radix libraries which might be useful for integration or reference:
- The Engine Rust Libraries - which power the Radix Engine in the node, resim and resim
- The Radix Engine Toolkit core
- Wallet-compatible derivation
- Sargon
Engine Rust Crates
These crates are published to crates.io
at each protocol update.
All these crates inter-depend, so you must ensure you use the same version across all imported crates. These crates don't use standard semver - we recommend explicitly fixing the version for each protocol update, and manually updating.
Key libraries include:
- scrypto (docs) and scrypto-test (docs) - The crates used to create and test scrypto applications.
- radix-transactions (docs) - Builders and models for Radix transactions. Includes the:
- ManifestBuilder (article) - A rust-native tool for building any manifest.
- TransactionV1Builder - For building V1 Notarized Transactions
- TransactionV2Builder - For building V2 Notarized Transactions
- SignedPartialTransactionV2Builder - For building V2 Signed Partial Transactions, the recommended path to build subintents to build up a transaction
- AnyTransaction - an enum of all transactions and the canonical transaction serialization
- AnyManifest - an enum of all manifests
- AnyInstruction - a type alias for the latest version of instructions - an enum of all possible instructions.
- radix-common (docs) and radix-rust (docs) - Various common Radix traits and types.
Most libraries have an expansive prelude
which cover most of their key functionality, and is recommended to avoid import paths breaking between different versions.
There are also other crates, such as radix-engine, radix-engine-interface and many others. But these aren't typically used as libraries by integrators.
Rust Toolkit
The toolkit core is built in Rust, but it isn't published to crates.io
and is mostly built to be exposed over UniFFI or WASM. It isn't intended to be used directly.
We may more formally create a rust toolkit with a more stable API at some point, but for now we recommend using the Engine crates directly (notably, the radix-transactions crate).
Wallet compatible derivation
The wallet-compatible-derivation crate and CLI can be used to derive keys from mnemonics in the same manner as the official Radix Wallet, which enables creating a programmatic integration which can also be imported into a Radix wallet.
Sargon
The sargon crate is a UniFFI library which forms the core of the official Android and iOS wallets.
It's not intended to be consumed by anyone else, but might form a useful reference. It imports both the engine libraries and toolkit core.
Babylon Node
The babylon node has a rust-core, which might be a useful reference.