jmininger / ledger-app-kadena

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

This application has been packaged up with Nix. If you are on Linux and have Nix installed, builds and development environments are one command away.

Prerequisites

This project will try to build nanos-secure-sdk, so you will need:

Linux

  1. A standard ARM gcc (sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi)
  2. Cross compilation headers (sudo apt-get install gcc-multilib)
  3. Python3 (sudo apt-get install python3)
  4. Pip3 (sudo apt-get install python3-pip)

Windows

  1. install Clang
  2. install an ARM GCC toolchain
  3. Python

Other things you will need:

  • Cargo-ledger
  • Speculos (make sure you add speculos.py to your PATH by running export PATH=/path/to/speculos:$PATH)
  • The correct target for rustc: rustup target add thumbv6m-none-eabi

You can build on either Windows or Linux with a simple cargo build or cargo build --release. It currently builds on stable.

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

License:Apache License 2.0


Languages

Language:Nix 75.6%Language:Rust 13.5%Language:TypeScript 10.5%Language:Shell 0.3%Language:JavaScript 0.1%