Ledger Nano (Original) Python Library

0.1.32 · abandoned · verified Thu Apr 16

This library provides Python utilities to communicate with the *original* Ledger Nano hardware wallet over USB HID. It is specific to the first generation of Ledger devices and is largely superseded by `ledger-python` and `ledgerblue` for modern Ledger Nano S, X, and Stax devices. The current version is 0.1.32, with no active development since 2017, indicating an abandoned status.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates connecting to an original Ledger Nano and retrieving its firmware version. This example highlights the specific hardware compatibility and common setup requirements.

from btchip.btchipComm import DongleUSB
from btchip.btchip import btchip

# NOTE: This library is for the *original* Ledger Nano hardware wallet,
# NOT for Ledger Nano S/X/Stax. For modern devices, use 'ledger-python'.
#
# Requires the original Ledger Nano to be connected and proper USB HID
# permissions (e.g., udev rules on Linux).

dongle = None
try:
    # Initialize the USB dongle communication (timeout in ms)
    # DongleUSB() without args tries to autodetect original Nano.
    dongle = DongleUSB(timeout=5000)
    
    # Initialize the btchip interface with the dongle
    interface = btchip(dongle)
    
    # Example: Get firmware version
    firmware_version_response = interface.getFirmwareVersion()
    # getFirmwareVersion returns a BtchipFirmware object, which __str__ outputs 'VERSION_STRING STATUS_WORD'
    firmware_version = str(firmware_version_response).split(' ')[0] # Extract only the version string
    
    print(f"Successfully connected to original Ledger Nano.")
    print(f"Device Firmware Version: {firmware_version}")
    
except Exception as e:
    print(f"Failed to connect to original Ledger Nano: {e}")
    print("\nTroubleshooting:")
    print("- Ensure the original Ledger Nano is connected.")
    print("- On Linux, ensure appropriate udev rules are in place for Ledger HID devices.")
    print("- Verify 'hidapi' is correctly installed with its system dependencies.")
    print("- Remember: This library does NOT work with Ledger Nano S/X/Stax.")
finally:
    if dongle:
        dongle.close()

view raw JSON →