54 stable releases

new 1.18.4 Nov 7, 2024
1.18.2 Oct 31, 2024
1.13.1 Jul 31, 2024
1.8.0 Mar 26, 2024
1.0.1 Nov 24, 2023

#33 in Hardware support

Download history 287/week @ 2024-07-21 1104/week @ 2024-07-28 506/week @ 2024-08-04 166/week @ 2024-08-11 806/week @ 2024-08-18 890/week @ 2024-08-25 951/week @ 2024-09-01 888/week @ 2024-09-08 735/week @ 2024-09-15 1083/week @ 2024-09-22 1446/week @ 2024-09-29 899/week @ 2024-10-06 785/week @ 2024-10-13 699/week @ 2024-10-20 1255/week @ 2024-10-27 1030/week @ 2024-11-03

3,823 downloads per month
Used in ledger_device_ui_sdk

Apache-2.0

450KB
9K SLoC

Rust 7.5K SLoC // 0.0% comments C 2K SLoC // 0.0% comments GNU Style Assembly 36 SLoC Shell 26 SLoC // 0.2% comments

Ledger wallets SDK for Rust Applications

Crate that allows developing Ledger device apps in Rust with a default configuration.

Contains:

  • some safe wrappers over common syscalls
  • IO abstractions
  • signature abstractions
  • UI libraries (the ui module for Nano (S/SP/X) apps, nbgl module for Stax and Flex apps)

To learn more about using the SDK and what is required to publish an app on the Ledger Live app store, please don't hesitate to check the following resources :

Supported devices

Nano S Nano X Nano S Plus Stax Flex
✔️ ✔️ ✔️ ✔️ ✔️

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.

If 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.

Building for Nano S

cargo build --release -Z build-std=core --target=./nanos.json

Building for Nano X

cargo build --release -Z build-std=core --target=./nanox.json

Building for Nano S+

cargo build --release -Z build-std=core --target=./nanosplus.json

Building for Stax

cargo build --release -Z build-std=core --target=./stax.json

Building for Flex

cargo build --release -Z build-std=core --target=./flex.json

Building with rustc < 1.54

Building before rustc 1.54 should fail with error[E0635]: unknown feature const_fn_trait_bound.

This is solved by activating a specific feature: cargo build --features pre1_54

Contributing

You can submit an issue or even a pull request if you wish to contribute, we will check what we can do.

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 clippy does not emit any warnings
  • check that your code follows rustfmt's format (using cargo fmt)

Dependencies

~6–8.5MB
~141K SLoC