Skip to main content

Bitcoin Hardware Wallet Interface

Build Status

The Bitcoin Hardware Wallet Interface is a Python library and command line tool for interacting with hardware wallets. It provides a standard way for software to work with hardware wallets without needing to implement device specific drivers. Python software can use the provided library (hwilib). Software in other languages can execute the hwi tool.

Prerequisites

Python 3 is required. The libraries and udev rules for each device must also be installed. Some libraries will need to be installed

For Ubuntu/Debian:

sudo apt install libusb-1.0-0-dev libudev-dev python3-dev

For Centos:

sudo yum -y install python3-devel libusbx-devel systemd-devel

For macOS:

brew install libusb

Install

git clone https://github.com/bitcoin-core/HWI.git
cd HWI
poetry install # or 'pip3 install .' or 'python3 setup.py install'

This project uses the Poetry dependency manager. HWI and its dependencies can be installed via poetry by executing the following in the root source directory:

poetry install

Pip can also be used to automatically install HWI and its dependencies using the setup.py file (which is usually in sync with pyproject.toml):

pip3 install .

The setup.py file can be used to install HWI and its dependencies so long as setuptools is also installed:

pip3 install -U setuptools
python3 setup.py install

Dependencies

See pyproject.toml for all dependencies. Dependencies under [tool.poetry.dependecies] are user dependencies, and [tool.poetry.dev-dependencies] for development based dependencies. These dependencies will be installed with any of the three above installation methods.

Usage

To use, first enumerate all devices and find the one that you want to use with

./hwi.py enumerate

Once the device type and device path is known, issue commands to it like so:

./hwi.py -t <type> -d <path> <command> <command args>

All output will be in JSON form and sent to stdout. Additional information or prompts will be sent to stderr and will not necessarily be in JSON. This additional information is for debugging purposes.

To see a complete list of available commands and global parameters, run ./hwi.py --help. To see options specific to a particular command, pass the --help parameter after the command name; for example:

./hwi.py getdescriptors --help

Device Support

The below table lists what devices and features are supported for each device.

Please also see docs for additional information about each device.

Feature \ Device Ledger Nano X Ledger Nano S Trezor One Trezor Model T Digital BitBox KeepKey Coldcard
Support Planned Yes Yes Yes Yes Yes Yes Yes
Implemented Yes Yes Yes Yes Yes Yes Yes
xpub retrieval Yes Yes Yes Yes Yes Yes Yes
Message Signing Yes Yes Yes Yes Yes Yes Yes
Device Setup N/A N/A Yes Yes Yes Yes N/A
Device Wipe N/A N/A Yes Yes Yes Yes N/A
Device Recovery N/A N/A Yes Yes N/A Yes N/A
Device Backup N/A N/A N/A N/A Yes N/A Yes
P2PKH Inputs Yes Yes Yes Yes Yes Yes Yes
P2SH-P2WPKH Inputs Yes Yes Yes Yes Yes Yes Yes
P2WPKH Inputs Yes Yes Yes Yes Yes Yes Yes
P2SH Multisig Inputs Yes Yes Yes Yes Yes Yes Yes
P2SH-P2WSH Multisig Inputs Yes Yes Yes Yes Yes Yes Yes
P2WSH Multisig Inputs Yes Yes Yes Yes Yes Yes Yes
Bare Multisig Inputs Yes Yes N/A N/A Yes N/A N/A
Arbitrary scriptPubKey Inputs Yes Yes N/A N/A Yes N/A N/A
Arbitrary redeemScript Inputs Yes Yes N/A N/A Yes N/A N/A
Arbitrary witnessScript Inputs Yes Yes N/A N/A Yes N/A N/A
Non-wallet inputs Yes Yes Yes Yes Yes Yes Yes
Mixed Segwit and Non-Segwit Inputs N/A N/A Yes N/A Yes Yes Yes
Display on device screen Yes Yes Yes Yes N/A Yes Yes

Using with Bitcoin Core

See Using Bitcoin Core with Hardware Wallets.

License

This project is available under the MIT License, Copyright Andrew Chow.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hwi-1.1.0.tar.gz (105.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hwi-1.1.0-py3-none-any.whl (174.9 kB view details)

Uploaded Python 3

File details

Details for the file hwi-1.1.0.tar.gz.

File metadata

  • Download URL: hwi-1.1.0.tar.gz
  • Upload date:
  • Size: 105.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for hwi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5daad2f995265effb9bd50c0b3dff75377288ce9cff53627102f8620738ad1b6
MD5 535fccdf55d3f75aa0ece633eab1283c
BLAKE2b-256 838af6f4c23db2212c45a44114efd6e7cebaf0b27fbcb4b966668d76f4850e87

See more details on using hashes here.

File details

Details for the file hwi-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: hwi-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 174.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.8

File hashes

Hashes for hwi-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c1cca49784985e07814fec253fd0f5566f6e7a19874fe88fd4993c91f7d2471
MD5 12161da5d54d52c61cc3f8ebea0f3728
BLAKE2b-256 1da4e17626384f1b5a9b04f35a584884520bd6fd3778c08dac826f45dd8cd7f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page