Mac Users | Developers

Mac Users

Estimated reading time: 6 minutes

Nano X

Important
The Nano X does not support side loading, therefore you must use the device emulator Speculos for loading to work. See how to install and use it.

Nano S and S Plus

1. Install ledgerblue

Important
You need to install virtualenv to use the commands in this page. You can also use venv instead but you will need to replace the virtualenv commands accordingly.

ledgerblue is a package that contains Python tools to communicate with Ledger devices and manage applications life cycle. It is recommended to install this package in a Virtual Environment in your native environment (not a Docker image) to avoid hidapi issues.

Install the ledgerblue package in a virtual environment. Open a new terminal windo and execute the following commands:

virtualenv ledger
source ledger/bin/activate
pip install ledgerblue

2. Launch the install command

  • Connect your Ledger Nano S or S Plus and unlock it
  • Verify your firmware version is up to date and that you have enough space on your device
  • Run the following command in the virtualenv in app-boilerplate:
python3 -m ledgerblue.loadApp --curve  secp256k1 --appFlags 0x000 --path "44'" --tlv --targetId $(TARGET_ID) --targetVersion="$(TARGET_VERSION)" --delete --fileName bin/app.hex --appName $(APPNAME) --appVersion $(APPVERSION) --dataSize $((0x`cat debug/app.map |grep _envram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'` - 0x`cat debug/app.map |grep _nvram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'`)) `ICONHEX=$(ICONHEX_VALUE) ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"`

With:

  • TARGET_ID =
    • 0x31100004 if you’re using a Nano S
    • 0x33100004 if you’re using a Nano S Plus
  • TARGET_VERSION
    • Go in the docker image you ran in app-boilerplate folder.
      • If you’re using a Nano S, use the following command to get the TARGET_VERSION: cat $BOLOS_SDK/include/bolos_version.h | grep define | cut -f2 -d'"'
      • If you’re using a Nano S Plus, use the following command to get the TARGET_VERSION: BOLOS_SDK=$NANOSP_SDK cat $BOLOS_SDK/include/bolos_version.h | grep define | cut -f2 -d'"'
  • APPNAME & APPVERSION
    • The name and version of your app are located in the makefile (in the app folder)
  • ICONHEX_VALUE
    • Go in docker running for your app
    • Go to /app/icons and use the following command:
      • For Nano S: python3 $BOLOS_SDK/icon3.py --hexbitmaponly $ICONNAME
      • For Nano S Plus: BOLOS_SDK=$NANOSP_SDK python3 $BOLOS_SDK/icon3.py --hexbitmaponly $ICONNAME

$ICONNAME is the path of the icon that should be used for your app (the path of the .gif file). For Ledger Nano S Plus, you can use the same gif as the Ledger Nano X (generally named nanox_app_nameofapp.gif).

With a Nano S, your command should look like this:

python3 -m ledgerblue.loadApp --curve  secp256k1 --appFlags 0x000 --path "44'" --tlv --targetId 0x31100004 --targetVersion="2.1.0" --delete --fileName bin/app.hex --appName "Boilerplate" --appVersion "1.0.1" --dataSize $((0x`cat debug/app.map |grep _envram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'` - 0x`cat debug/app.map |grep _nvram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'`)) `ICONHEX="0100000000ffffff00ffffffff7ffe7ffe3ffc3ffc018007e00ff01ff80ff08ff1c7e3e7e7ffffffff" ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"`

With a Nano S Plus, your command should look like this:

python3 -m ledgerblue.loadApp --curve  secp256k1 --appFlags 0x000 --path "44'" --tlv --targetId 0x33100004 --targetVersion="2.1.0" --delete --fileName bin/app.hex --appName "Boilerplate" --appVersion "1.0.1" --dataSize $((0x`cat debug/app.map |grep _envram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'` - 0x`cat debug/app.map |grep _nvram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'`)) `ICONHEX="0100000000ffffff00000030000c8007e0c1ffcfffe01ff003fe817370380c0c0000" ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"`

When done, don not forget to deactivate the virtualenv with the deactivate command and exit your first terminal or exit the container with the exit command.

Stax

Coming soon

Delete the application

1. Clone the SDK

Important
The Nano S or S Plus SDK must first be locally cloned and stored in BOLOS_SDK for the loading to work.

Use the following commands for the Nano S:

git clone https://github.com/LedgerHQ/nanos-secure-sdk.git nanos-secure-sdk
export BOLOS_SDK=/Path/to/nanos-secure-sdk

For the Nano S Plus:

git clone https://github.com/LedgerHQ/nanos-secure-sdk.git nanosplus-secure-sdk
export BOLOS_SDK=/Path/to/nanosplus-secure-sdk

2. Delete

Launch the virtualenv if it is not running:

source ledger/bin/activate

Delete:

  1. Connect and unlock the Nano S or Nano S Plus.
  2. Go to the root of app‑boilerplate
  3. Type make delete to delete it

Did you find this page helpful?


How would you improve this page for developers?



Linux users
Manage your device with ledgerctl
Getting Started
Theme Features
Customization

Embedded Apps