Python library for communicating with TREZOR Hardware Wallet
Project description
python-trezor
Python library and commandline client for communicating with TREZOR Hardware Wallet
See https://trezor.io for more information
Install
Python-trezor requires Python 3.3 or higher, and libusb 1.0. The easiest
way to install it is with pip. The rest of this guide assumes you have
a working pip; if not, you can refer to this
guide.
Trezor T only
On a typical Linux / Mac / BSD system, you already have all you need.
Install trezor with:
pip3 install --upgrade setuptools
pip3 install trezor
On Windows, you also need to install libusb and the appropriate drivers. This is, unfortunately, a topic bigger than this README.
Trezor One support
In addition to the above, you need to install development headers for HIDAPI.
On a Debian or Ubuntu based system, you can install these:
sudo apt-get install python3-dev python3-pip cython3 libusb-1.0-0-dev libudev-dev
When installing the trezor library, you need to specify that you want
hidapi:
pip3 install --upgrade setuptools
pip3 install trezor[hidapi]
Ethereum support
Ethereum requires additional python packages. Instead of
pip3 install trezor, specify pip3 install trezor[ethereum].
You can combine it with the above, to get both HIDAPI and Ethereum support:
pip3 install trezor[ethereum,hidapi]
FreeBSD
On FreeBSD you can install the packages:
pkg install security/py-trezor
or build via ports:
cd /usr/ports/security/py-trezor
make install clean
Command line client (trezorctl)
The included 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.
NOTE: An older version of the trezorctl command is available for
Debian Stretch
(and comes pre-installed on Tails OS).
Python Library
You can use this python library to interact with a Bitcoin Trezor and use its capabilities in your application. See examples here in the tools/ sub folder.
PIN Entering
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:
| 7 | 8 | 9 |
| 4 | 5 | 6 |
| 1 | 2 | 3 |
Example: your PIN is 1234 and TREZOR is displaying the following:
| 2 | 8 | 3 |
| 5 | 4 | 6 |
| 7 | 9 | 1 |
You have to enter: 3795
Contributing
Python-trezor pulls coins info and protobuf messages from
trezor-common repository. If
you are developing new features for Trezor, you will want to start
there. Once your changes are accepted to trezor-common, you can make a
PR against this repository. Don't forget to update the submodule with:
git submodule update --init --remote
Then, rebuild the protobuf messages and get coins.json by running:
python3 setup.py prebuild
To get support for BTC-like coins, these steps are enough and no further changes to the library are necessary.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
At the moment, the project does not adhere to Semantic Versioning. That is expected to change with version 1.0.
0.10.2 - 2018-06-21
Added
stellar_get_addressand_public_keyfunctions supportshow_displayparameter- trezorctl:
stellar_get_addressand_public_keycommands for the respective functionality
Removed
- trezorctl:
list_coinsis removed because we no longer parse the relevant protobuf field (and newer Trezor firmwares don't send it) #277
Fixed
- test support module was not included in the release, so code relying on the deprecated
ckd_publicmodule would fail #280
0.10.1 - 2018-06-11
Fixed
- previous release fails to build on Windows #274
0.10.0 - 2018-06-08
Added
- Lisk support #197
- Stellar support #167, #268
- Wanchain support #230
- support for "auto lock delay" feature
TrezorClienttakes an additional argumentstatethat allows reusing the previously entered passphrase #241- USB transports mention udev rules in exception messages #245
log.enable_debug_outputfunction turns on wire logging, instead of having to useTrezorClientVerbose- BIP32 paths now support
123hin addition to123'to indicate hardening - trezorctl:
-pnow supports prefix search for device path #226 - trezorctl: smarter handling of firmware updates #242, #269
Changed
- reorganized transports and moved into their own
transportsubmodule - protobuf messages and coins info is now regenerated at build time from the
trezor-commonrepository #248 - renamed
ed25519rawto_ed25519to indicate its privateness - renamed
ed25519cositocosiand expanded its API - protobuf messages are now logged through Python's
loggingfacility instead of custom printing throughVerboseWireMixin client.format_protobufis moved toprotobuf.format_messagetools.Hashis renamed totools.btc_hashcoinsmodulecoins_txapiis renamed totx_api.
coins_slip44is renamed toslip44.- build: stricter flake8 checks
- build: split requirements to separate files
- tests: unified finding test device, while respecting
TREZOR_PATHenv variable. - tests: auto-skip appropriately marked tests based on Trezor device version
- tests: only show wire output when run with
-v - tests: allow running
xfailed tests selectively based onpytest.ini - docs: updated README with clearer install instructions #185
- docs: switched changelog to Keep a Changelog format #94
Deprecated
ckd_publicis only maintained intests.supportsubmodule and considered privateTrezorClient.expand_pathis moved to plain functiontools.parse_pathTrezorDeviceis deprecated in favor oftransport.enumerate_devicesandtransport.get_transport- XPUB-related handling in
toolsis slated for removal
Removed
- most Python 2 compatibility constructs are gone #229
TrezorClientVerboseandVerboseWireMixinis removed- specific
tx_api.TxApi*classes removed in favor ofcoins.tx_api client.PRIME_DERIVATION_FLAGis removed in favor oftools.HARDENED_FLAGandtools.H_()- hard dependency on Ethereum libraries and HIDAPI is changed into extras that need to be
specified explicitly. Require
trezor[hidapi]ortrezor[ethereum]to get them.
Fixed
- WebUSB enumeration returning bad devices on Windows 10 #223
sign_txoperation sending empty address string #237- Wrongly formatted Ethereum signatures #236
- protobuf layer would wrongly encode signed integers #249, #250
- protobuf pretty-printing broken on Python 3.4 #256
- trezorctl: Matrix recovery on Windows wouldn't allow backspace #207
- aes_encfs_getpass.py: fixed Python 3 bug #169
0.9.1 - 2018-03-05
Added
- proper support for Trezor model T
- support for Monacoin
- improvements to
trezorctl:- add pretty-printing of features and protobuf debug dumps (fixes #199)
- support
TREZOR_PATHenvironment variable to preselect a Trezor device.
Removed
- gradually dropping Python 2 compatibility (pypi package will now be marked as Python 3 only)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file trezor-komodo-0.10.2.post1.tar.gz.
File metadata
- Download URL: trezor-komodo-0.10.2.post1.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c2455d488acfd0c47967229799bad34a68c424f4d48c4e1621c1a29c25ae77c
|
|
| MD5 |
c258010458b9425f0809c2281c13b7c9
|
|
| BLAKE2b-256 |
775666c36a7211d6212490c6625051eeba8df78298b0188c5913f0319c26fb75
|