Skip to content

multiversx/mx-ledger-nano

Repository files navigation

MultiversX App for the Ledger Devices

Introduction

This is the official MultiversX wallet app for the Ledger Devices.

Prerequisites

Latest firmware

Before proceeding with the installation, please make sure your device is up-to-date with the latest firmware.

Connectivity

Furthermore, you need to configure your OS to enable the connectivity with the Nano S device. For example, on Linux, you have to issue the following command:

wget https://raw.githubusercontent.com/LedgerHQ/udev-rules/master/add_udev_rules.sh | sudo bash

For other platforms, please have a look on this article from ledger.com.

Python package ledgerblue

pip3 install --user --upgrade --no-cache-dir ledgerblue

Note that python3 and pip3 are required in order to install ledgerblue.

Loading a released version onto the device

Download the latest *.hex file from our releases page. If wget is available on your machine, then:

export APP_VERSION=1.0.20

wget https://github.com/multiversx/mx-ledger-nano/releases/download/v${APP_VERSION}/multiversx-ledger-app-v${APP_VERSION}.hex

Now that you've downloaded the app and ledgerblue package is available, let's load the app on the device:

export APP_VERSION=1.0.20

python3 -m ledgerblue.loadApp --curve ed25519 --path "44'/508'" --appFlags 0x240 --tlv --targetId 0x31100004 --targetVersion=2.1.0 --delete --appName MultiversX --appVersion ${APP_VERSION} --fileName multiversx-ledger-app-v${APP_VERSION}.hex --dataSize 64 --icon "0100000000ffffff00ffffffffffffffffe3c7c3c307e01ff87ffe1ff807e0c3c3e3c7ffffffffffff"

To remove the app from the device, issue the following command:

python3 -m ledgerblue.deleteApp --targetId 0x31100004 --appName MultiversX

ESDT tokens support

In order to perform whitelisted tokens operation, first an ESDT data providing is needed.

A concatenation between the following fields has to be sent by using INS 0x08: ticker len, ticker, id_len, id, decimals, chain_id_len, chain_id, signature

The signature is generated by signing the sha256 hash of ticker len, ticker, id_len, id, decimals, chain_id_len, chain_id with a private key managed by MultiversX team.

Testing

The testApp folder contains Go applications to prepare MultiversX transactions, which you can sign using the Ledger device. The signed transactions are then dispatched to the MultiversX Proxy, in order to be processed and saved on the blockchain.

Also, please note that on Windows you might receive the Unknown publisher warning from the UAC facility when you first run the testApp.

Development environment: building and installing

Build and load applications to device via ledger-app-builder Docker image

As an alternative to install and maintain many packages on your machine, Ledger applications can be built and loaded into the device by using the ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder Docker image.

First, you need to pull the docker image

docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

After that, go to the repository's root and run this command:

docker run --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

When in the container, run this to load the app onto the device: $ make load

Or this to remove it: $ make delete

If you want to check the build process for a specific device:

  • Nano S: $make load && make BOLOS_SDK=$NANOS_SDK
  • Nano X $make load && make BOLOS_SDK=$NANOX_SDK
  • Stax: $make load && make BOLOS_SDK=$STAX_SDK

Reference: https://github.com/LedgerHQ/ledger-app-builder

Install all dependencies (not recommended)

To build locally, you must first clone this repository, then set up the development environment:

$ source prepare-devenv s

This could take a while. Then, load the app as follows:

$ make load

To remove the app from the device, run:

$ make delete

GitHub workflows

Creating a PR against master or develop will trigger some workflows that will:

  • check the successful build for multiple environments
  • run clang-format11 for checking linter issues (example: ./clang-format11.0.0 -i utils.c)
  • look for spelling issues
  • run static code analyzer

Therefore, contributors must make sure that all the workflows pass before merging a PR into master or develop branches.