Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Ledger device SDK for Rust Applications
Crate that allows developing Ledger device applications in Rust.
Contains:
- Safe wrappers over common syscalls and C SDK functions
- IO abstractions (
ioandsephmodules) - Cryptographic abstractions (
ecc,hashandhmacmodules) - Arithmetic (simple and modular) abstraction (
mathmodule) - Persistent data storage (
nvmmodule) - UI/UX libraries (
nbglmodule) - Swap support (
libcallmodule)
Supported devices
| Nano X | Nano S Plus | Stax | Flex | Apex P |
|---|---|---|---|---|
| :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Usage
Building requires adding rust-src to your Rust installation, and both Clang and arm-none-eabi-gcc.
On Ubuntu, gcc-multilib might also be required.
Using rustc nightly builds is mandatory as some unstable features are required.
rustup default nightly-2025-12-05(or use the version specified inrust-toolchain.toml)rustup component add rust-src- install Clang.
- install an ARM gcc toolchain
If you wish to install the ARM gcc toolchain using your distribution's packages, these commands should work:
# On Debian and Ubuntu
# On Fedora or Red Hat Entreprise Linux
# On ArchLinux
This SDK provides custom target files. One for each supported device.
We also provide a Docker container to build Rust applications for Ledger devices (recommended for reproducibility):
# Build using Docker
Building your app
Using cargo-ledger (recommended):
# Install cargo-ledger
# Setup custom targets (one-time)
# Build for your target device
# Build and load to device
Alternatively, using plain cargo:
Getting Started
For a complete application example, see the Rust Boilerplate App.
Key concepts for Ledger app development:
#![no_std]environment: No standard library, usecore::andalloc::types- Panic handler required: Every app must define a panic handler with
set_panic!macro - Device-specific UI: Use
nbglmodule for touchscreen devices (Stax/Flex/Apex P),uimodule ornbglwithnano_nbglfeature for Nano devices - Testing: Examples can be run with Speculos emulator
Examples
The examples/ directory contains various demonstrations. Build and run with:
# Touchscreen devices (Stax, Flex, Apex P)
# Nano devices (S+, X) - requires nano_nbgl feature for NBGL UI
# View all available examples
Note: Running examples requires Speculos emulator. The config.toml automatically invokes Speculos as the target runner.
Contributing
You can submit an issue or even a pull request if you wish to contribute.
Make sure you've followed the installation steps above. In order for your PR to be accepted, it will have to pass the CI, which performs the following checks:
- Check if the code builds on nightly
- Check that
clippydoes not emit any warnings - check that your code follows
rustfmt's format (usingcargo fmt)