Skip to content

Repository files navigation

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.

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 \ DeviceLedger Nano XLedger Nano STrezor OneTrezor Model TDigital BitBoxKeepKeyColdcard
Support PlannedYesYesYesYesYesYesYes
ImplementedYesYesYesYesYesYesYes
xpub retrievalYesYesYesYesYesYesYes
Message SigningYesYesYesYesYesYesYes
Device SetupN/AN/AYesYesYesYesN/A
Device WipeN/AN/AYesYesYesYesN/A
Device RecoveryN/AN/AYesYesN/AYesN/A
Device BackupN/AN/AN/AN/AYesN/AYes
P2PKH InputsYesYesYesYesYesYesYes
P2SH-P2WPKH InputsYesYesYesYesYesYesYes
P2WPKH InputsYesYesYesYesYesYesYes
P2SH Multisig InputsYesYesYesYesYesYesYes
P2SH-P2WSH Multisig InputsYesYesYesYesYesYesYes
P2WSH Multisig InputsYesYesYesYesYesYesYes
Bare Multisig InputsYesYesN/AN/AYesN/AN/A
Arbitrary scriptPubKey InputsYesYesN/AN/AYesN/AN/A
Arbitrary redeemScript InputsYesYesN/AN/AYesN/AN/A
Arbitrary witnessScript InputsYesYesN/AN/AYesN/AN/A
Non-wallet inputsYesYesYesYesYesYesYes
Mixed Segwit and Non-Segwit InputsN/AN/AYesN/AYesYesYes
Display on device screenYesYesYesYesN/AYesYes

Using with Bitcoin Core

See Using Bitcoin Core with Hardware Wallets.

License

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

About

Bitcoin Hardware Wallet Interface

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages