LEDGERCOMM-SEND(1)

NAME
ledgercomm-send - CLI tool to send APDUs to Ledger devices or Speculos emulator

SYNOPSIS
ledgercomm-send [OPTIONS] SUBCOMMAND [ARGUMENTS]

DESCRIPTION
ledgercomm-send is a command-line tool provided by the python-ledgercomm package for sending APDU (Application Protocol Data Unit) commands to Ledger Nano S/X hardware wallets (via HID interface) or the Speculos emulator (via TCP socket). It is part of the ledgercomm Python library, which facilitates communication with Ledger devices and the Speculos emulator for sending and receiving APDUs. The tool supports sending APDUs from text files, standard input, or Ledger Live log files. APDUs can be sent in raw format (hexadecimal strings or bytes) or using structured parameters (e.g., cla , ins , p1 , p2 , cdata ). It is designed for developers and users testing or interacting with Ledger devices or emulators. When using the HID interface for physical Ledger devices, the python3-hidapi package is required, and appropriate udev rules must be configured for the Ledger Nano S/X. For TCP communication with Speculos, no additional dependencies are needed.

OPTIONS

--hid
    Use the HID interface to communicate with physical Ledger Nano S/X devices instead of the default TCP interface for Speculos.

--server SERVER
    Specify the IP address of the Speculos server (default: 127.0.0.1).

--port PORT
    Specify the port of the Speculos server (default: 9999).

--startswith PREFIX
    Filter APDUs to only send those starting with the specified prefix (e.g., "=>"). Useful for parsing files with mixed content.

-h, --help
    Display the help message and exit.

SUBCOMMANDS

file FILE
    Send APDUs from a text file. The file can contain APDUs as hexadecimal strings, optionally prefixed with a string like "=>".

stdin
    Read APDUs from standard input (e.g., via a pipe).

log LOGFILE
    Send APDUs extracted from a Ledger Live log file.

EXAMPLES

Send an APDU to the Speculos emulator via standard input:

    echo "E003000000" | ledgercomm-send stdin

Send an APDU to a Ledger Nano S/X device via HID:

    ledgercomm-send --hid stdin

Send APDUs from a file, filtering by a prefix:

    ledgercomm-send --startswith "=>" file apdus.txt

Example content of apdus.txt :

    # this line won't be sent if --startswith "=>" is used
    => E003000000
    # another APDU to send
    => E004000000

DEPENDENCIES
For TCP communication with the Speculos emulator, no additional dependencies are required. For HID communication with Ledger Nano S/X devices, the python3-hidapi package must be installed. Additionally, appropriate udev rules must be configured for the Ledger device to be accessible.

NOTES
When using ledgercomm-send with a physical Ledger device, ensure the device is connected and the correct udev rules are set up (see Ledger documentation for details). For Speculos, ensure the emulator is running and accessible at the specified --server and --port

AUTHORS
Ledger <hello@ledger.fr> (upstream)
Debian packagers: Manuel Guerra <ar.manuelguerra@gmail.com>, Soren Stoutner <soren@debian.org>

SEE ALSO
Full documentation at: <https://github.com/LedgerHQ/ledgercomm>
Speculos emulator: <https://github.com/LedgerHQ/speculos>
APDU specification: <https://en.wikipedia.org/wiki/Smart_card_application_protocol_data_unit>