| Crates.io | ledger_device_sdk |
| lib.rs | ledger_device_sdk |
| version | 1.31.0 |
| created_at | 2023-11-14 16:21:00.18152+00 |
| updated_at | 2026-01-15 11:23:15.652377+00 |
| description | Ledger device Rust SDK |
| homepage | |
| repository | https://github.com/LedgerHQ/ledger-device-rust-sdk |
| max_upload_size | |
| id | 1035021 |
| size | 536,653 |
Crate that allows developing Ledger device applications in Rust.
Contains:
io and seph modules)ecc, hash and hmac modules)math module)nvm module)nbgl module)libcallmodule)| Nano X | Nano S Plus | Stax | Flex | Apex P |
|---|---|---|---|---|
| :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
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 in rust-toolchain.toml)rustup component add rust-srcIf you wish to install the ARM gcc toolchain using your distribution's packages, these commands should work:
# On Debian and Ubuntu
sudo apt install clang gcc-arm-none-eabi gcc-multilib
# On Fedora or Red Hat Entreprise Linux
sudo dnf install clang arm-none-eabi-gcc arm-none-eabi-newlib
# On ArchLinux
sudo pacman -S clang arm-none-eabi-gcc arm-none-eabi-newlib
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):
docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
# Build using Docker
docker run --rm -v "$(pwd):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest \
cargo ledger build stax
Using cargo-ledger (recommended):
# Install cargo-ledger
cargo install cargo-ledger
# Setup custom targets (one-time)
cargo ledger setup
# Build for your target device
cargo ledger build nanox # Nano X
cargo ledger build nanosplus # Nano S+
cargo ledger build stax # Stax
cargo ledger build flex # Flex
cargo ledger build apex_p # Apex P
# Build and load to device
cargo ledger build nanosplus --load
Alternatively, using plain cargo:
cargo build --release --target=nanox # Nano X
cargo build --release --target=nanosplus # Nano S+
cargo build --release --target=stax # Stax
cargo build --release --target=flex # Flex
cargo build --release --target=apex_p # Apex P
For a complete application example, see the Rust Boilerplate App.
Key concepts for Ledger app development:
#![no_std] environment: No standard library, use core:: and alloc:: typesset_panic! macronbgl module for touchscreen devices (Stax/Flex/Apex P), ui module or nbgl with nano_nbgl feature for Nano devicesThe examples/ directory contains various demonstrations. Build and run with:
# Touchscreen devices (Stax, Flex, Apex P)
cargo run --example nbgl_home_and_settings --target stax --release \
--config examples/config.toml
# Nano devices (S+, X) - requires nano_nbgl feature for NBGL UI
cargo run --example nbgl_home_and_settings --target nanosplus --release \
--features nano_nbgl --config examples/config.toml
# View all available examples
ls examples/*.rs
Note: Running examples requires Speculos emulator. The config.toml automatically invokes Speculos as the target runner.
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:
clippy does not emit any warningsrustfmt's format (using cargo fmt)