This reverts commit
|2 weeks ago|
|.changelog.d||2 weeks ago|
|bash_completion.d||3 years ago|
|docs||2 months ago|
|helper-scripts||8 months ago|
|src/trezorlib||2 weeks ago|
|tests||2 months ago|
|tools||7 months ago|
|.gitignore||9 months ago|
|.towncrier.template.md||1 year ago|
|AUTHORS||1 year ago|
|CHANGELOG.md||1 month ago|
|CHANGELOG.unreleased||1 year ago|
|COPYING||3 years ago|
|MANIFEST.in||8 months ago|
|Makefile||5 months ago|
|README.md||2 months ago|
|default.nix||3 years ago|
|pyrightconfig.json||5 months ago|
|requirements-optional.txt||5 months ago|
|requirements.txt||2 months ago|
|setup.cfg||6 months ago|
|setup.py||2 months ago|
|towncrier.toml||2 months ago|
|tox.ini||1 month ago|
Python library and command-line client for communicating with Trezor Hardware Wallet.
See https://trezor.io for more information.
Python Trezor tools require Python 3.6 or higher, and libusb 1.0. The easiest
way to install it is with
pip. The rest of this guide assumes you have
pip; if not, you can refer to this
On a typical system, you already have all you need. Install
pip3 install trezor
Firmware version requirements
Current trezorlib version supports Trezor One version 1.8.0 and up, and Trezor T version 2.1.0 and up.
For firmware versions below 1.8.0 and 2.1.0 respectively, the only supported operation is "upgrade firmware".
Trezor One with firmware older than 1.7.0 and bootloader older than 1.6.0 (including pre-2021 fresh-out-of-the-box units) will not be recognized, unless you install HIDAPI support (see below).
Ethereum: To support Ethereum signing from command line, additional packages are needed. Install with:
pip3 install trezor[ethereum]
Stellar: To support Stellar signing from command line, additional packages are needed. Install with:
pip3 install trezor[stellar]
Firmware-less Trezor One: If you are setting up a brand new Trezor One manufactured before 2021 (with pre-installed bootloader older than 1.6.0), you will need HIDAPI support. On Linux, you will need the following packages (or their equivalents) as prerequisites:
pip3 install trezor[hidapi]
To install all three, use
pip3 install trezor[hidapi,ethereum,stellar].
Check out Repology to see if your operating system has an up-to-date python-trezor package.
Installing latest version from GitHub
pip3 install "git+https://github.com/trezor/trezor-firmware#egg=trezor&subdirectory=python"
Running from source
Install the Poetry tool, checkout
trezor-firmware from git, and enter the poetry shell:
pip3 install poetry git clone https://github.com/trezor/trezor-firmware cd trezor-firmware poetry install poetry shell
In this environment, trezorlib and the
trezorctl tool is running from the live
sources, so your changes are immediately effective.
Command line client (trezorctl)
trezorctl python script can perform various tasks such as
changing setting in the Trezor, signing transactions, retrieving account
info and addresses. See the docs/ sub folder for detailed
examples and options.
You can use this python library to interact with a Trezor and use its capabilities in your application. See examples here in the tools/ sub folder.
When you are asked for PIN, you have to enter scrambled PIN. Follow the numbers shown on Trezor display and enter the their positions using the numeric keyboard mapping:
Example: your PIN is 1234 and Trezor is displaying the following:
You have to enter: 3795
If you want to change protobuf or coin definitions, you will need to regenerate
definitions in the
First, make sure your submodules are up-to-date with:
git submodule update --init --recursive
Then, rebuild the protobuf messages by running, from the
To get support for BTC-like coins, these steps are enough and no further changes to the library are necessary.