Home

Awesome

Ledger Secure SDK

Are you developing an application?

If you are developing an application, for a smooth and quick integration:

Introduction

This directory contains the SDK for Nano S, Nano X, Nano S+, Stax, and Flex applications development.

It is the unified version of the previous Nano S, Nano X, Nano S+ SDKs.

As the previous SDKs, this SDK is tightly linked to the Ledger Hardware Wallet OS: BOLOS.

Indeed, it allows to interact with syscalls and cxlib functions which are embedded in the OS.

Hence you should make sure to use the right SDK version matching your development device OS.

You can find below two possibilities to build against the right SDK version.

Using the docker image

The easiest way to build against last device OS is to use the docker image provided by ledger and accessible on ghcr.io.

The corresponding GIT repository can be found here. Please have a look at its README.md for information about its usage.

Using the SDK directly (advanced users)

Advanced users that have setup the Ledger development environment can use this repository to build apps.

But for that, they need to understand how OS and SDK compatibility are tracked. This is done with the API_LEVEL which is defined in Makefile.defines.

The API_LEVEL on master branch is kept as the reserved value 0.

For each released OS there is a corresponding tag in the format <Device>_<os_version>, e.g. NanoX_v2.1.0 for the release of the OS version v2.1.0 for Nano X device. While on this tag, if you look at the value of the API_LEVEL which is defined in Makefile.defines you will retrieve the OS API_LEVEL.

There are also API_LEVEL_<N> branches with API_LEVEL value set to N. Their purpose is to allow cherry-picks of bug fixes and improvements that are merged on master so that they are available when building the apps for the corresponding OS.

On these API_LEVEL_<N> branches, there are tags following the format v<N>.<minor>.<patch>, e.g. v1.1.0 where N is the API_LEVEL. These tags are used to generate the SDK_VERSION which is available at compile time and allows to track the SDK version used to build an app.

The branch API_LEVEL_LNS tracks the sdk for the NanoS_v2.1.0. It's naming does not follow the API_LEVEL_<N> format because it is not a child of the branch API_LEVEL_0.

In short, to build an app for an OS, you should:

About API_LEVEL branches

This list the main API_LEVEL branches with their purposed (corresponding OS) and state if they should still be patched or not (OS not “active” anymore).

The full mapping of API_LEVEL branches, including OS release candidates, is available here.

NameRelated OSActive
LNS<br/> nanos_2.1.0:heavy_check_mark:
1nanox_2.1.0 <br/> nanos+_1.1.0:x:
5nanox_2.2.{0, 1, 2, 3} <br/> nanos+ 1.1.1:heavy_check_mark:
8stax_1.0.0:x:
10stax_1.1.0:x:
11stax_1.2.0 <br/> stax_1.2.1:x:
13stax_1.3.0:x:
15stax_1.4.0:x:
18nanos+_1.2.0:heavy_check_mark:
19flex_1.0.0 <br/> flex_1.0.1 <br/>:x:
21stax_1.5.0 <br/> flex_1.1.0 <br/> flex_1.1.1 <br/>:heavy_check_mark:
22stax_1.6.0 <br/> flex_1.2.0 <br/>:heavy_check_mark:

Cherry-picking process:

Contributing

Pre-commit

This repository uses pre-commit to identify simple programming issues at the time of code check-in.

To enable pre-commit in your development environment:

  1. Install pre-commit:

    pip install pre-commit
    
  2. Add pre-commit hooks

    pre-commit install --hook-type pre-commit
    pre-commit install --hook-type commit-msg
    

Documentation

HTML documentation can be generated by typing:

make doc TARGET=stax

make doc TARGET=nano

from root directory

The resulting documentation can be found in build/doc/html/index.html

If you have not already installed Doxygen, you can do it (on Linux-Ubuntu) with:

sudo apt-get install doxygen doxygen-doc graphviz