LedgerHQ / rust-app

A demo Rust app using the UI and SDK as crates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust Nano S Application

A simple application that receives a message, displays it, and requests user approval to sign. Can also display an example menu.

Building

Prerequisites

This project will try to build nanos-secure-sdk as a dependency. You should follow toolchain preparation instructions to get everything working.

In order to build easily, you should use cargo-ledger.

To run your app in an emulator, use Speculos.

You can build for nanosplus on either Windows or Linux with a simple cargo build or cargo build --release.

Loading

You can use cargo-ledger which builds, outputs a hex file and a manifest file for ledgerctl, and loads it on a device in a single cargo ledger build <target> --load command in your app directory.

Some options of the manifest file can be configured directly in Cargo.toml under a custom section:

[package.metadata.nanos]
curve =  ["secp256k1"]
flags = "0x40"
icon = "btc.gif"

Testing

One can for example use speculos

cargo run --release defaults to running speculos on the generated binary with the appropriate flags, if speculos is in your PATH.

There is a small test script that sends some of the available commands in test/test_cmds.py, or raw APDUs that can be used with ledgerctl.

About

A demo Rust app using the UI and SDK as crates.

License:Apache License 2.0


Languages

Language:Rust 87.6%Language:Python 12.4%