Skip to content

Using the TREZOR Hardware Wallet

Introduction

One of the most secure and foolproof methods to store a private key is to use a hardware wallet. Hardware wallets are constructed so that the signature is done exclusively inside the wallet while the private key is never exposed. For the last several months, DECENT has been working on an unofficial Trezor wallet (https://www.trezor.io) firmware to support DECENT’s proprietary cryptocurrency, DCT. The updated firmware is based on the official 2.1.1 version release and only extends the existing functionality. This tutorial will show you how to use the Trezor wallet at the command line level.

How to update the firmware

WARNING

Before updating your current firmware, make sure to have your recovery seed backed up. Installing a custom firmware on your Trezor device will erase all data from it and may make it unusable.

Note: Your Trezor device warns you if you are using an unofficial firmware.

  • Download binary or build the firmware from sources on your own
  • Install python-trezor: https://wiki.trezor.io/Python#Install_python-trezor
  • Connect and start the device in bootloader mode—Start swiping your finger across the Trezor's touchscreen and plug in the USB cable when your finger is halfway through
  • Upload the firmware to the device: trezorctl firmware-update -f /path_to_firmware/firmware.bin
  • Optional (recommended) step—Verify the fingerprint: c77704910b74350e9675bb9d420e8944582a8399992a144b01c57c9727d770ee

Supported methods

The firmware supports two new protobuf messages: decent_get_public_key and decent_sign_transaction. Operations supported by the custom firmware: account_create_operation, account_update_operation and transfer_operation.

Keypair generation

Generate a key pair inside the Trezor wallet. Use the decent_get_public_key message to obtain the public key in order to update/register a DCore account for this key pair.

Example:

trezorctl decent_get_public_key -n "m/44'/343'/0'/0/0"

Returns: base58 encoded public key

Parameters:

  • -n, --address TEXT BIP-32 path, e.g. m/44'/343'/0'/0/0 [required]
  • -d, --show-display

Signing transactions

Example:

trezorctl  decent_sign_transaction -n "m/44'/343'/0'/0/0" -f /path/to/tx_file
Returns: TX signature

Parameters:

  • -n, --address TEXT BIP-32 path to source address, e.g., m/44'/343'/0'/0/0 [required]
  • -f, --file FILENAME Transaction in JSON format [required]

example TX file:

{
  "chain_id": "e37c1482f27b231d9953436ec6a7505efc708c79759f066ac1966ff4479920c9",
  "transaction": {
    "ref_block_num": 7,
    "ref_block_prefix": 4232245264,
    "expiration": "2019-08-07T12:44:30",
    "operations": [
      [
        39,
        {
          "fee": {
            "amount": 100000,
            "asset_id": "1.3.0"
          },
          "from": "1.2.15",
          "to": "1.2.11",
          "amount": {
            "amount": 100000000,
            "asset_id": "1.3.0"
          },
          "extensions": [

          ]
        }
      ]
    ],
    "extensions": [

    ]
  }
}


GitHub repository: https://github.com/Roznovjak/trezor-firmware/tree/add_DCT_support

Trezor user manual: https://wiki.trezor.io/User_manual

trezorctl tutorial: https://wiki.trezor.io/Using_trezorctl_commands_with_Trezor

BIP 44: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki