Python library and commandline client for communicating with TREZORHardware Wallet
See https://trezor.io for more information
Python-trezor requires Python 3.5 or higher, and libusb 1.0. The easiestway to install it is with pip
. The rest of this guide assumes you havea working pip
; if not, you can refer to thisguide.
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 installlibusb and theappropriate drivers. This is, unfortunately, atopic bigger than this README.
If your Trezor One is on firmware 1.6.3 or older, you will need HIDAPI supportfor it to be recognized. That requires additional packages.
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
On a Windows based system, you can install these (for more info on choco, refer to this):
choco install vcbuildtools python3 protoc
refreshenv
pip3 install protobuf
When installing the trezor library, you need to specify that you wanthidapi
:
pip3 install --upgrade setuptools
pip3 install trezor[hidapi]
Ethereum requires additional python packages. Instead ofpip3 install trezor
, specify pip3 install trezor[ethereum]
.
You can combine it with the above, to get both HIDAPI and Ethereumsupport:
pip3 install trezor[ethereum,hidapi]
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
Sometimes you might need to install the latest-and-greatest unreleased versionstraight from GitHub. You will need some prerequisites first:
sudo apt-get install protobuf-compiler protobuf-dev
pip3 install protobuf
If you just need to install the package, you can use pip again:
pip3 install git+https://github.com/trezor/python-trezor
If you want to work on the sources, make a local clone:
git clone https://github.com/trezor/python-trezor
cd python-trezor
python3 setup.py prebuild
python3 setup.py develop
The included trezorctl
python script can perform various tasks such aschanging setting in the Trezor, signing transactions, retrieving accountinfo and addresses. See the docs/ sub folder for detailedexamples and options.
NOTE: An older version of the trezorctl
command is available forDebian Stretch(and comes pre-installed on Tails OS).
You can use this python library to interact with a Bitcoin Trezor anduse its capabilities in your application. See examples here in thetools/ sub folder.
When you are asked for PIN, you have to enter scrambled PIN. Follow thenumbers shown on TREZOR display and enter the their positions using thenumeric 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
Python-trezor pulls coins info and protobuf messages fromtrezor-common repository. Ifyou are developing new features for Trezor, you will want to startthere. Once your changes are accepted to trezor-common
, you can make aPR 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 furtherchanges to the library are necessary.
我有一个数据框我想选择列A的值在[2,3]中的行 为此,我编写了一个简单的for循环: 有没有任何内置函数可以代替使用for循环来实现这一点?
Python Python 诞生之初就被誉为最容易上手的编程语言。进入火热的 AI 人工智能时代后,它也逐渐取代 Java,成为编程界的头牌语言。 Python 是一门新手友好、功能强大、高效灵活的编程语言,学会之后无论是想进入数据分析、人工智能、网站开发这些领域,还是希望掌握第一门编程语言,都可以用 Python 来开启无限未来的无限可能! 语言排行榜 编程之旅 Python 适合谁来学习? 想
一些相关名词 Python 是一门简单的高级动态语言,首次发布于 1991 年。它语法简单,使用缩进来定义代码块。 Python 支持命令式程序设计、面向对象、函数式编程、面向方面的程序设计、泛型等多种编程范式, 是一门优秀的多范式语言。 名词解释 技术名词 名词 解释 Python 通常指 Python 语言本身,并不包括可执行程序,但是在口语中常常与 Python 解释器混用。 CPython
为了在python中运用mongols,我提供了一个pymongols。它包括http_server和web_server。 仓库在pymongols 依赖 mongols python2,3 devel 安装 很简单,cd pymongols && make clean && make && sudo make install 修改Makefile中的PYVERSION变量即可轻松适配开发者版本
Python (发音:[ 'paiθ(ə)n; (US) 'paiθɔn ]n.蟒蛇,巨蛇 ),是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发展历史,成熟且稳定。Python 具有脚本语言中最丰富和强大的类库,足以支持绝大多数日常应用。 Python 语言的特点: 简单————Python是一种代表简单主义思想的语言。阅读一个良好的Python程
用Python编写的代码看起来与用其他传统编程语言(如C或Pascal)编写的代码非常相似。 还有人说,Python的语法是从C语言中大量借用的。这包括许多类似于C语言的Python关键字。 Python包括条件语句和循环语句,可用于准确提取数据以进行取证。 对于流控制,它提供if/else , while和循环遍历任何“可迭代”对象的高级for语句。 if a < b: max = b