Skip to content
KeepKey Python client
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Run integration tests against latest emulator build Mar 14, 2019
device-protocol @ d5b31e9
keepkeylib update ethereum-lists with fox token Apr 26, 2019
tests test: fix some more tests my recover UI changes broke Jun 11, 2019
tools Binary hmac calculation (#4) Feb 23, 2018
.gitignore Segwit device-protocol Aug 30, 2018
.gitmodules Move the TokenType table here, out of the firmware repo Jan 6, 2019
COPYING bringing to latest Trezor v0.6.5 Aug 8, 2015 added May 31, 2016
README.rst ship 🐍🥚 too Mar 16, 2019 Add Nano support Feb 8, 2019 change to soft link Jan 8, 2016 Build python3-friendly protobuf (de)serializers Nov 17, 2018 update print staements May 31, 2016
keepkeyctl Make the testsuite WAAAAY less chatty by default Mar 13, 2019 Allow disabling auto_button Mar 13, 2019 brought in trezor changes May 31, 2016 Release v6.1.0 May 3, 2019



Client side implementation for KeepKey-compatible Bitcoin hardware wallets.

This is a modified version of python-trezor. The changes made were to support KeepKey's protocol, as well as the additional feature set of KeepKey. For example, by default, device_recovery command invokes KeepKey's style of device recovery using the Recovery Cipher.

See for more information.


also found in

#!/usr/bin/env python

from keepkeylib.client import KeepKeyClient
from keepkeylib.transport_hid import HidTransport

def main():
    # List all connected KeepKeys on USB
    devices = HidTransport.enumerate()

    # Check whether we found any
    if len(devices) == 0:
        print('No KeepKey found')

    # Use first connected device
    transport = HidTransport(devices[0])

    # Creates object for manipulating KeepKey
    client = KeepKeyClient(transport)

    # Print out KeepKey's features and settings

    # Get the first address of first BIP44 account
    # (should be the same address as shown in KeepKey wallet Chrome extension)
    bip32_path = client.expand_path("44'/0'/0'/0/0")
    address = client.get_address('Bitcoin', bip32_path)
    print('Bitcoin address:', address)


if __name__ == '__main__':

PIN Entering

When you are asked for PIN, you have to enter scrambled PIN. Follow the numbers shown on KeepKey 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 KeepKey is displaying the following:

2 8 3
5 4 6
7 9 1

You have to enter: 3795

How to install (virtualenv)

  • Install virtualenv
  • Clone repository
  • Run "virtualenv env" in the project root
  • Run "source env/bin/activate"
  • Run "python install"

How to install (Windows)

  • Install Python 2.7 (
  • Run C:\python27\scripts\pip.exe install cython
  • Install Microsoft Visual C++ Compiler for Python 2.7
  • Clone repository (using TortoiseGit) to local directory
  • Run C:\python27\python.exe install (or develop)

How to install (Debian-Ubuntu)

Running Tests

To run unit tests that don't require a device:

$ python tests/unit/*.py

Release Process

  • Check that the testsuite runs cleanly
  • Bump the version in
  • Tag the release
  • Build the release * sudo python3 sdist bdist_wheel bdist_egg
  • Upload the release * sudo python3 -m twine upload dist/* -s --sign-with gpg2
You can’t perform that action at this time.