Skip to content

Latest commit

 

History

History
23 lines (12 loc) · 1.66 KB

debugging.md

File metadata and controls

23 lines (12 loc) · 1.66 KB

This page contains some information for developers on how to debug failures of the commands of the Ledger Bitcoin app.

Status Words

Failures in the app's commands are always reported by a corresponding Status Word; see bitcoin.md for the currently defined Status Words. Client libraries generally return structured versions of the same Status Words.

The Status Word is contained in the last 2 bytes of the APDU Response, interpreted as a big-endian 16-bit constant.

Error codes

In addition to the Status Word, some errors provide further details as an error code, contained in the first two bytes of the data portion of the reply.

Integrations can ignore the error codes and should not rely on them in production (as they are not guaranteed to be consistent across versions of the app); however, they can provide valuable debugging information for developers working on an integration.

You can see the list of the currently defined error codes in error_codes.h.

Running on Speculos with semihosting

When running the bitcoin app on the speculos emulator, additional debugging information can be printed on the command line (on the same terminal where speculos is running) by defining the DEBUG=10 constant when running the make command. See the ledger-app-builder for instructions on how to build the app for speculos.

Binaries produced in this way will crash if sideloading on a real device.

Note: DEBUG=10 is a feature of the Bitcoin app, and is not used in other Ledger apps.