### Install ledgerwallet from source Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Clone the repository, install dependencies, and then install the ledgerwallet package in editable mode. ```shell git clone https://github.com/LedgerHQ/ledgerctl.git pip3 install --upgrade protobuf setuptools ecdsa cd ledgerctl pip install -e . ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Installs the pre-commit hooks for the project. It is recommended to use pipx for installation. This ensures that code quality checks are performed before committing. ```console pre-commit install ``` -------------------------------- ### List Installed Applications Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Use this command to see all applications currently installed on the device. ```shell ledgerctl list ``` -------------------------------- ### Install HIDAPI dependencies on Debian/Ubuntu Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Install necessary packages for compiling HIDAPI on Debian or Ubuntu systems. This is a prerequisite for certain installations. ```shell sudo apt install python3-dev libusb-1.0-0-dev libudev-dev ``` -------------------------------- ### Install Custom App with ledgerctl Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Command to install a custom application using a manifest file with ledgerctl. ```shell ledgerctl install app.json ``` -------------------------------- ### Custom App Manifest Example Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Example TOML file structure for defining custom application parameters like name, version, icon, and data size for different Ledger device types. ```toml name = "Bitcoin" version = "1.3.13" [0x31100004] #NanoS icon = "nanos_app_bitcoin.gif" flags = "0xA50" derivationPath = {curves = ["secp256k1"]} binary = "bin/app.hex" dataSize = 64 [0x33100004] #NanoSP icon = "nanosp_app_bitcoin.gif" flags = "0xA50" derivationPath = {curves = ["secp256k1"]} binary = "bin/app_nanosp.hex" dataSize = 64 ``` -------------------------------- ### Install ledgerwallet using pip Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Install the ledgerwallet library and its dependencies using pip. Ensure protobuf, setuptools, and ecdsa are up-to-date. ```shell pip3 install --upgrade protobuf setuptools ecdsa pip3 install ledgerwallet ``` -------------------------------- ### Install Bitcoin Application (BOLOS SDK) Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md The standard method using the BOLOS SDK to compile and load the Bitcoin application, including icon and version details. ```shell python3 -m ledgerblue.loadApp --curve secp256k1 --tlv --targetId 0x31100004 --targetVersion="1.6.0" --delete --fileName bin/app.hex --appName "Bitcoin" --appVersion 1.3.13 --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=\`python3 /home/dev/sdk/icon3.py --hexbitmaponly nanos_app_bitcoin.gif 2>/dev/null exttt{` ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"` --path "" --appFlags 0xa50 --offline bin/app.apdu | grep "Application" | cut -f5 -d' ' > bin/app.sha256 ``` -------------------------------- ### Force Delete Previous App Version Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Use the -f flag with the install command to force deletion of an existing application version before installing a new one. ```shell ledgerctl install -f app.json ``` -------------------------------- ### Calculate Application Data Size Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md A one-liner command to calculate the data size required for custom app installation by subtracting NVRAM from ENVRAM data sizes found in the debug map. ```shell echo $(($(grep _envram_data debug/app.map | awk '{ print $1 }') - $(grep _nvram_data debug/app.map | awk '{ print $1 }'))) ``` -------------------------------- ### Install custom CA on Ledger device Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Install a custom certificate authority on the Ledger device to enable a secure channel for ledgerctl. The device must be in 'Recovery' mode. ```shell ledgerctl install-ca ``` -------------------------------- ### Run All Pre-commit Checks Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Executes all configured pre-commit hooks on all files in the repository. This should be run before submitting a pull request to ensure all checks pass. ```console pre-commit run --all-files ``` -------------------------------- ### Display Available Space Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Run this command to check the available memory on the Ledger device. ```shell ledgerctl meminfo ``` -------------------------------- ### Rebuild Proto Files Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Iterates through all .proto files in the ledgerwallet/proto directory and rebuilds them using grpc_tools.protoc. Ensure you have the necessary Python environment set up. ```shell for file in ledgerwallet/proto/*.proto; do \ python -m grpc_tools.protoc -I. --python_out=. --pyi_out=. $file; \ done ``` -------------------------------- ### Delete Application Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Command to remove a specific application, like Bitcoin, from the device. ```shell ledgerctl delete Bitcoin ``` -------------------------------- ### View APDUs for Bitcoin Application Source: https://github.com/ledgerhq/ledgerctl/blob/master/README.md Displays the raw Application Protocol Data Units (APDUs) exchanged between the host and the device when running the Bitcoin application, useful for debugging. ```shell $ ledgerctl -v run Bitcoin => e0d8000007426974636f696e <= 9000 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.