3.3 KiB
7.3: Integrating with Hardware Wallets
ℹ️ NOTE: This is a draft in progress, so that I can get some feedback from early reviewers. It is not yet ready for learning.
One of the greatest powers of PSBTs is the ability to hand transactions off to hardware devices. This will be a great development tool for you if you continue to program with Bitcoin. However, it will be hard for you to use if you've set up a VM on Linode per §2.2 or used even more farflung options such as the setup of an AWS linked in §2.3, because obviously you have no way to hook a hardware device up to a VM.
So, you have three options: (1) read along without testing the code; (2) skip straight ahead to Chapter 8: Expanding Bitcoin Transactions in Other Ways; or (3) install Bitcoin on a local machine to fully test these commands. We suggest option #1.
⚠️ VERSION WARNING: This is an innovation from Bitcoin Core v 0.17.0. Earlier versions of Bitcoin Core will not be able to work with the PSBT while it is in process (though they will still be able to recognize the final transaction).
The methodology for integrating with a Hardware Wallet that is described in this chapter depends on the Bitcoin Hardware Wallet Interface released through Bitcoin Core and builds on the installation and usage instructions found there.
Install Bitcoin Core on a Local Machine
If you just plan to read over this section and not try to work with the commands until you have a local development environment set up, you can skip this instruction, which is about creating a Bitcoin Core installation on a local machine such as a Mac or UNIX machine.
There are versions of the Bitcoin Standup script that you used to create your VM for MacOS and for other UNIX instances.
If you have MacOS, you can install Bitcoin Standup MacOS.
If you have a local UNIX machine, you can install Bitcoin Standup Linux Scripts.
We will be using a Macintosh for the examples in this section.
Create an Alias for Bitcoin-CLI
Create an alias that causes bitcoin-cli
to run the correct command from the correct directory with any appropriate flags.
Here's an example alias from a Mac:
Mac$ $ alias bitcoin-cli="~/StandUp/BitcoinCore/bitcoin-0.20.0/bin/bitcoin-cli -testnet"
Install Python
The HWI program is written in python
, so you'll also need to install that.
Link to a Ledger
Import Addresses
Create a Transaction with PSBT
Summary: Integrating with Hardware Wallets
🔥 What's the power of HWI?
What's Next?
Move on to "Bitcoin Scripting" with Chapter Seven: Introducing Bitcoin Scripts.