### Setup Bitcoin Core and HWI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Clone Bitcoin Core and HWI repositories, build Bitcoin Core, and install HWI. Ensure necessary dependencies like libudev-dev and libusb-1.0-0-dev are installed. ```bash $ git clone https://github.com/bitcoin/bitcoin.git $ cd bitcoin $ cmake -B build $ cmake --build build $ build/bin/bitcoind -daemon -addresstype=bech32 -changetype=bech32 $ cd .. $ git clone https://github.com/bitcoin-core/HWI.git $ cd HWI $ python3 setup.py install ``` -------------------------------- ### Install HWI with setup.py Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Installs HWI and its dependencies using the setup.py script after ensuring setuptools is installed. ```bash pip3 install -U setuptools python3 setup.py install ``` -------------------------------- ### Install Coldcard Emulator Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs necessary system packages for building the Coldcard emulator. ```bash build-essential git python3 python3-pip libudev-dev gcc-arm-none-eabi libffi-dev xterm swig libpcsclite-dev ``` -------------------------------- ### Install Coldcard Simulator Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs the necessary system packages for building the Coldcard simulator. ```bash build-essential git python3 python3-pip libudev-dev gcc-arm-none-eabi ``` -------------------------------- ### Install Ledger Emulator Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs necessary system packages for building the Ledger emulator. ```bash cmake gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gdb-multiarch qemu-user-static ``` -------------------------------- ### Install Bitbox Simulator Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs the necessary system packages for building the Bitbox simulator. ```bash build-essential git cmake ``` -------------------------------- ### Install Ubuntu/Debian Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Installs necessary development libraries for HWI on Ubuntu/Debian systems. ```bash sudo apt install libusb-1.0-0-dev libudev-dev python3-dev ``` -------------------------------- ### Setup Device Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Sets up a new device. You can provide a label and a backup passphrase. ```console usage: hwi setup [-h] [--label LABEL] [--backup_passphrase BACKUP_PASSPHRASE] ``` -------------------------------- ### Install BitBox02 Simulator Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs Docker as a dependency for the BitBox02 simulator. ```bash apt install docker.io ``` -------------------------------- ### Install HWI with pip Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Installs HWI and its dependencies using pip. ```bash pip3 install . ``` -------------------------------- ### Install Trezor Emulator Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs the necessary system packages for building the Trezor emulator. ```bash build-essential curl git python3 python3-pip libsdl2-dev libsdl2-image-dev gcc-arm-none-eabi libnewlib-arm-none-eabi gcc-multilib protobuf-compiler clang ``` -------------------------------- ### Install Python Dependencies for KeepKey Emulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs the protobuf Python package required for the KeepKey emulator. Ensure Python 2 is installed. ```bash pip install protobuf ``` -------------------------------- ### Start Bitcoin Core Daemon Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Start a Bitcoin Core daemon for testnet or mainnet. Ensure the datadir is specified for testnet. ```bash bitcoind -testnet -datadir=$HOME/.bitcoin-testnet ``` ```bash bitcoind ``` -------------------------------- ### Start HWI GUI for Testnet Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Launch the HWI GUI application for Bitcoin testnet. Ensure your Trezor device is plugged in and accessible. ```bash hwi-qt.py --testnet ``` -------------------------------- ### Install Coldcard Python Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs the required Python packages for the Coldcard simulator from the cloned repository. ```bash pip install -r ckcc_firmware/requirements.txt pip install -r ckcc_firmware/unix/requirements.txt ``` -------------------------------- ### Install CentOS Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Installs necessary development libraries for HWI on CentOS systems. ```bash sudo yum -y install python3-devel libusbx-devel systemd-devel ``` -------------------------------- ### Install Udev Rules Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Installs udev rules for HWI. Use the --location option to specify a custom path for the rules files. ```console usage: hwi installudevrules [-h] [--location LOCATION] ``` -------------------------------- ### Start Bitcoin Core Wallet for Testnet Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Launch the Bitcoin Core GUI wallet for the testnet. This allows you to manage your Bitcoin testnet funds. ```bash bitcoin-qt -testnet ``` -------------------------------- ### Clone HWI Repository and Install with Poetry Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Clones the HWI project from GitHub and installs it using Poetry. ```bash git clone https://github.com/bitcoin-core/HWI.git cd HWI poetry install ``` -------------------------------- ### Build Trezor Emulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Builds the Trezor emulator in headless mode after setting up the environment and installing dependencies. ```bash cd trezor-firmware/legacy export EMULATOR=1 TREZOR_TRANSPORT_V1=1 DEBUG_LINK=1 HEADLESS=1 script/setup pipenv install pipenv run script/cibuild ``` -------------------------------- ### Install Coldcard Emulator Python Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs Python dependencies for the Coldcard emulator from a requirements file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install HWI Python Wheel Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/installation.md Install the HWI Python package from a downloaded wheel file using pip. ```bash pip install hwi-1.1.2-py3-none-any.whl ``` -------------------------------- ### Install HWI Source Package Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/installation.md Install the HWI Python package from a downloaded source archive using pip. ```bash pip install hwi-1.1.2.tar.gz ``` -------------------------------- ### Install HWI from PyPI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/installation.md Install the HWI Python package directly from the Python Package Index (PyPI) using pip. ```bash pip install hwi ``` -------------------------------- ### Setup Watch-Only Wallet for Hardware Wallet Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Configure a watch-only wallet by enumerating the hardware wallet, setting derivation paths, and importing keys. Use the appropriate derivation path for testnet or mainnet. A full rescan may be necessary if the hardware wallet has existing funds. ```bash hwi.py enumerate # this shows you the fingerprint of your hardware wallet FINGERPRINT_TESTNET="yourHardwareWalletFingerprint" # shown by "hwi enumerate" # in this example we use SEGWIT BECH32 ADDRESSES DERIVATIONPATH_TESTNET=1 # testnet uses derivation paths like m/84h/1h/0h/0/* and m/84h/1h/0h/1/* DERIVATIONPATH_MAINNET=0 # mainnet uses derivation paths like m/84h/0h/0h/0/* and m/84h/0h/0h/1/* # if the mainnet path is used on testnet, it will work too, but Trezor device gives warnings # of unknown address on Trezor display. This is not recommended. Use the correct derivation path # for the corresponding network! wallet=wallet.test rec=$(hwi --testnet -f $FINGERPRINT_TESTNET getkeypool --addr-type wit --path m/84h/${DERIVATIONPATH_TESTNET}h/0h/0/* --keypool 0 1000) chg=$(hwi --testnet -f $FINGERPRINT_TESTNET getkeypool --addr-type wit --path m/84h/${DERIVATIONPATH_TESTNET}h/0h/1/* --keypool --internal 0 1000) bitcoin-cli -testnet createwallet "$wallet" true bitcoin-cli -testnet -rpcwallet="$wallet" importmulti "$rec" bitcoin-cli -testnet -rpcwallet="$wallet" importmulti "$chg" echo "If the hardware wallet has been used before and holds funds then you should rescan. Rescanning might take 30 minutes." bitcoin-cli -testnet -rpcwallet="$wallet" rescanblockchain # full rescan # after rescan unload wallet bitcoin-cli -testnet -rpcwallet="$wallet" unloadwallet ``` -------------------------------- ### Install macOS Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Installs the libusb library for HWI on macOS systems using Homebrew. ```bash brew install libusb ``` -------------------------------- ### Install ESP-IDF Libraries and Toolchain for Jade Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Clones and installs the specified version of the ESP-IDF libraries and toolchain. It sets the IDF_TOOLS_PATH and exports the necessary environment variables for subsequent builds. ```bash $ mkdir ./esp && cd ./esp $ export IDF_TOOLS_PATH="$(pwd)/esp-idf-tools" $ git clone --quiet --depth=1 --branch ${ESP_IDF_BRANCH} --single-branch --recursive https://github.com/espressif/esp-idf.git $ cd esp-idf && git checkout ${ESP_IDF_COMMIT} $ ./install.sh esp32 $ . ./export.sh $ cd ../.. ``` -------------------------------- ### Install Trezor Python Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs the required Python packages for the Trezor emulator using pipenv. ```bash pip install pipenv ``` -------------------------------- ### Install Ledger Emulator Python Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Installs required Python packages for the Ledger emulator using pip. ```bash pip install construct flask-cors flask-restful jsonschema mnemonic pyelftools pillow requests ``` -------------------------------- ### Get Command Help Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Displays help information for a specific HWI command, such as 'getdescriptors'. ```bash ./hwi.py getdescriptors --help ``` -------------------------------- ### Navigate to Bitcoin Core Directory Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Change the current directory to the 'bitcoin' folder where the bitcoin and HWI executables are located. This is the starting point for most commands. ```bash $ cd bitcoin ``` -------------------------------- ### Enumerate Hardware Wallets Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Use the HWI script to enumerate connected hardware wallets and identify their type, model, and device path. This example shows a Coldcard device. ```bash $ ./hwi.py enumerate [{"type": "coldcard", "model": "coldcard", "path": "0003:0005:00", "needs_pin_sent": false, "needs_passphrase_sent": false, "fingerprint": "e5dbc9cb"}] ``` -------------------------------- ### HWI Get XPUB Command Usage Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Details the usage for the 'hwi getxpub' command, which retrieves an extended public key from a specified derivation path. ```console usage: hwi getxpub [-h] path ``` -------------------------------- ### Install Deterministic Python for macOS Build Source: https://github.com/bitcoin-core/hwi/blob/master/docs/development/release-process.md Installs a specific version of Python (3.9.19) using pyenv with a patch for reproducible builds, essential for the macOS binary release. ```bash cat contrib/reproducible-python.diff | PYTHON_CONFIGURE_OPTS="--enable-framework" BUILD_DATE="Jan 1 2019" BUILD_TIME="00:00:00" pyenv install -kp 3.9.19 ``` -------------------------------- ### Get BIP49 xpub with HWI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/examples.md Obtain the xpub for BIP49 derivation path using the HWI tool. Ensure the hardware device is connected and recognized. ```default ./hwi.py -t "ledger" -d "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS02@14200000/Nano S@14200000/Nano S@0/IOUSBHostHIDDevice@14200000,0" getxpub m/49h/0h/0h => b'e0c4000000' <= b'1b30010208010003'9000 => b'f026000000' <= b''6d00 => b'e04000000d03800000318000000080000000' <= b'410437c2c1ebd83155843b3e8528b43b9786a8dc144df151b27677b76443e54b466d46b0d909d07065a2305cbba41709c78d886be37e446352186a682e9a3f9e2adc22314a594538323869434b7043576368665377396832746857377a533469486e4c444444dcdbabc6f75fbe7609bab04beb88566e3bfc98f66ab030d1af2a070f4064ec'9000 => b'e040000009028000003180000000' <= b'4104c34926ea569d26e4ca06ccae25fa4332a07df69fb922a73131cfccf6a544aa3309af253eb5cee3caf8ca9a347a9e8d4429ac55b7a13f72aca36ebb51ca0f489e22314e546e3969454c587046324264664b6f326f316265785a72526e75396d65764663b310aae1803b63157ef3bb7394f985126e5f9ad4b3a6bcb118cd97875dc0e1ce'9000 {"xpub": "xpub6DP8WTA5cy2qWzdtjMUpLJHkzonepEZytzxFLMzkrcW7U4prscYnmXRQ8BesvMP3iqgQUWisAU6ipXnZw2HnNreEPYJW6TUCAfmwJPyYgG6"} ``` -------------------------------- ### HWI Get Descriptors Command Usage Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Shows the usage for the 'hwi getdescriptors' command, which can be used to retrieve descriptors for a specific account. ```console usage: hwi getdescriptors [-h] [--account ACCOUNT] ``` -------------------------------- ### Get Xpub from Ledger Device (BIP44) Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/examples.md Derives the extended public key (xpub) for a specific derivation path on a Ledger device. This xpub can then be used with Bitcoin Core's `scantxoutset` RPC. ```bash ./hwi.py -t "ledger" -d "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS02@14200000/Nano S@14200000/Nano S@0/IOUSBHostHIDDevice@14200000,0" getxpub m/44h/0h/0h => b'e0c4000000' <= b'1b30010208010003'9000 => b'f026000000' <= b''6d00 => b'e04000000d038000002c8000000080000000' <= b'4104f4b866b49fb76529a076a1c5b25216c1f4b970cb8e3db9874beb15c5371fdb93747fde522d63be4a564dcda8a71c889f5165eac2990cafee9d416141ae8b09c722313667774c7a76697157783146317a653365676850464d58655438666a57466f4b66f9a82310c4530360ec3fee42049fbb7a3c0bfa72fdf2c5b25b09f1c3df21c938'9000 => b'e040000009028000002c80000000' <= b'4104280c846650d7771396a679a55b30c558501f0b5554160c1fbd1d7301c845dacc10c256af2c8d6a13ae4a83763fa747c0d4c09cfa60bfc16714e10b0a938a4a6a2231485451557a6535486571334872553755435174564652745a535839615352674a65d62f97789c088a0b0c3ed57754f75273c6696c0d7812c702ca4f2f72c8631c04'9000 {"xpub": "xpub6CyidiQae2HF71YigFJqteLsRi9D1EvZJm1Lr4DWWxFVruf3vDSbfyxD9znqVkUTUzc4EdgxDRoHXn64gMbFXQGKXg5nPNfvyVcpuPNn92n"} ``` -------------------------------- ### Verify Receiving Address in Bitcoin Core Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Use the Bitcoin Core console to get information about a specific address, verifying its solvability, watch-only status, and derivation path. ```bash getaddressinfo tb1q0r2gn9wzfjm5j5zshx5yp5342h928c8pmllfep ``` -------------------------------- ### HWI Get Master XPUB Command Usage Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Shows the usage for the 'hwi getmasterxpub' command, which retrieves the master extended public key for a given address type and account. ```console usage: hwi getmasterxpub [-h] [--addr-type {legacy,wit,sh_wit,tap}] [--account ACCOUNT] ``` -------------------------------- ### Build Coldcard Simulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Builds the Coldcard simulator using make after setting up the environment. ```bash cd firmware/unix make setup make ``` -------------------------------- ### Build Ledger Emulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Configures and builds the Ledger emulator using CMake and Make. ```bash cmake -Bbuild -H. make -C build/ ``` -------------------------------- ### Build BitBox02 Simulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Builds the BitBox02 simulator using Docker. ```bash make dockerdev make simulator ``` -------------------------------- ### Build Jade Firmware for Emulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Builds the Jade firmware configured for the emulator. It removes any existing sdkconfig, copies default QEMU configurations, and then runs the build process using idf.py. ```bash $ cd jade $ rm -f sdkconfig $ cp configs/sdkconfig_qemu.defaults sdkconfig.defaults $ idf.py all ``` -------------------------------- ### Clone and Configure QEMU Emulator for Jade Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Clones the QEMU emulator repository and configures it for the Jade build. It specifies the target architecture and numerous build options to disable unnecessary features. ```bash $ mkdir qemu $ git clone --depth 1 --branch ${ESP_QEMU_BRANCH} --single-branch --recursive https://github.com/espressif/qemu.git ./qemu $ cd qemu && checkout ${ESP_QEMU_COMMIT} $ ./configure \ --target-list=xtensa-softmmu \ --enable-gcrypt \ --enable-sanitizers \ --disable-user \ --disable-opengl \ --disable-curses \ --disable-capstone \ --disable-vnc \ --disable-parallels \ --disable-qed \ --disable-vvfat \ --disable-vdi \ --disable-qcow1 \ --disable-dmg \ --disable-cloop \ --disable-bochs \ --disable-replication \ --disable-live-block-migration \ --disable-keyring \ --disable-containers \ --disable-docs \ --disable-libssh \ --disable-xen \ --disable-tools \ --disable-zlib-test \ --disable-sdl \ --disable-gtk \ --disable-vhost-scsi \ --disable-qom-cast-debug \ --disable-tpm $ ninja -C build $ cd .. ``` -------------------------------- ### Build Bitbox Simulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Builds the Bitbox simulator using cmake and make after cloning the repository and creating a build directory. ```bash cd mcu mkdir -p build && cd build cmake .. -DBUILD_TYPE=simulator make ``` -------------------------------- ### HWI CLI Help Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Display the main help message for the HWI CLI, showing all available commands and global options. ```console usage: hwi [-h] [--device-path DEVICE_PATH] [--device-type DEVICE_TYPE] [--password PASSWORD] [--stdinpass] [--chain {main,test,regtest,signet,testnet4}] [--debug] [--fingerprint FINGERPRINT] [--version] [--stdin] [--interactive] [--expert] [--emulators] {enumerate,getmasterxpub,signtx,getxpub,signmessage,getkeypool,getdescriptors,displayaddress,setup,wipe,restore,backup,promptpin,togglepassphrase,sendpin,installudevrules} ... ``` -------------------------------- ### Extract Minimal Artifacts for Jade Emulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Copies the essential files required to run the Jade emulator from the build directories into a 'simulator' directory. This includes the QEMU executable, BIOS files, and the generated flash and efuse images. ```bash $ rm -fr simulator $ mkdir simulator $ cp qemu/build/qemu-system-xtensa simulator/ $ cp -R qemu/pc-bios simulator/ $ cp jade/main/qemu/flash_image.bin simulator/ $ cp jade/main/qemu/qemu_efuse.bin simulator/ $ cd .. ``` -------------------------------- ### Get BIP84 xpub with HWI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/examples.md Obtain the xpub for BIP84 derivation path using the HWI tool. Ensure the hardware device is connected and recognized. ```default ./hwi.py -t "ledger" -d "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS02@14200000/Nano S@14200000/Nano S@0/IOUSBHostHIDDevice@14200000,0" getxpub m/84h/0h/0h => b'e0c4000000' <= b'1b30010208010003'9000 => b'f026000000' <= b''6d00 => b'e04000000d03800000548000000080000000' <= b'4104c79ce10d23b84ec27996e02b83964ec1953fb474ba358e70de62a09cee28dd6590f76b105fb2707c74bbefff0b4aea4156364dd813826848e8c3240d286781b722314270736737486455576a483753704535386e6d62654642773367595a554536776b2017f28f680893adfc004f5ec6db3654577c19b463326329b5d1d90de8dc24cf'9000 => b'e040000009028000005480000000' <= b'410483472c03c4157d1b0f8ad98c9391dfbfc820e0180d683658ed863609da5f866aafa260048bc42cd97cb997479fd2619c5d160af68a442a80567b41fe3e763fbe22314e5531544d796971575871367278746375424a3433376d4e75736d745a73554769c03458c3a331489e3271a24a76f4ab024e040e7de7b5e88d8ce058d414f565c2'9000 {"xpub": "xpub6DP9afdc7qsz7s7mwAvciAR2dV6vPC3gyiQbqKDzDcPAq3UQChKPimHc3uCYfTTkpoXdwRTFnVTBdFpM9ysbf6KV34uMqkD3zXr6FzkJtcB"} ``` -------------------------------- ### Enumerate Devices Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Lists all connected hardware wallet devices recognized by HWI. ```bash ./hwi.py enumerate ``` -------------------------------- ### Get Current Block Height in Bitcoin Core Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Retrieve the current block height from the Bitcoin Core wallet. This can be used to verify transaction locktimes. ```bash getblockcount ``` -------------------------------- ### Create and Import Descriptor Wallet in Bitcoin Core Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Create a new descriptor wallet in Bitcoin Core and import the descriptors obtained from the hardware wallet. This allows Bitcoin Core to watch the keys. ```bash $ ../bitcoin/src/bitcoin-cli -named createwallet wallet_name=hwicoldcard disable_private_keys=true descriptors=true { "name": "hwicoldcard", "warning": "Wallet is an experimental descriptor wallet" } $ ../bitcoin/src/bitcoin-cli -rpcwallet=hwicoldcard importdescriptors '[{"desc": "wpkh([e5dbc9cb/84\'/0\' /0\]xpub6CbtS57jivMSuzcvp5YZxp6JhUU8YWup2axi2xkQRVHY8w4otp8YkEvfWBHgE5rA2AJYNHquuRoLFFdWeSi1UgVohcUeM7SkE9c8NftRwRJ/0/*)#cwyap6p3", "range": [0, 1000], "timestamp": "now", "internal": false, "keypool": true, "active": true, "watchonly": true}, {"desc": "wpkh([e5dbc9cb/84\' /0\' /0\]xpub6CbtS57jivMSuzcvp5YZxp6JhUU8YWup2axi2xkQRVHY8w4otp8YkEvfWBHgE5rA2AJYNHquuRoLFFdWeSi1UgVohcUeM7SkE9c8NftRwRJ/1/*)#f6puu03f", "range": [0, 1000], "timestamp": "now", "internal": true, "keypool": true, "active": true, "watchonly": true}]' [ { "success": true }, { "success": true } ] ``` -------------------------------- ### Build KeepKey Emulator Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Configures and builds the KeepKey emulator using CMake and Make. Sets the PATH to include the nanopb generator and specifies build options. ```bash $ export PATH=$PATH:`pwd`/nanopb/generator $ cmake -C cmake/caches/emulator.cmake . -DNANOPB_DIR=nanopb/ -DKK_HAVE_STRLCAT=OFF -DKK_HAVE_STRLCPY=OFF $ make kkemu ``` -------------------------------- ### Get Transaction Details in Bitcoin Core Console Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Use the `gettransaction` command in the Bitcoin Core console to retrieve details about a specific transaction using its transaction ID. ```bash gettransaction 58d9dccd190250742c47733f3c0f0d33075d65621196434f163f92b69847843f ``` -------------------------------- ### Verify Change Address in Bitcoin Core Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Use the Bitcoin Core console to get information about a change address, verifying its solvability, watch-only status, and derivation path. ```bash getaddressinfo tb1qca3u0ka22c934jfqw7gjr9vg4gwwjldpzatrh5 ``` -------------------------------- ### Clone Coldcard Firmware Repository Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Clones the official Coldcard firmware repository to build the simulator. ```bash $git clone https://github.com/coldcard/firmware ``` -------------------------------- ### Build HWI Binaries and Distributions with Docker Source: https://github.com/bitcoin-core/hwi/blob/master/docs/development/release-process.md Runs Docker containers to build HWI distribution archives and binaries for various platforms, including Linux, Windows, and ARM64. ```bash docker run -it --name hwi-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-builder /bin/bash -c "contrib/build_bin.sh && contrib/build_dist.sh" docker run -it --name hwi-wine-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-wine-builder /bin/bash -c "contrib/build_wine.sh" docker run --platform linux/arm64 -it --rm --name hwi-builder-arm64 -v $PWD:/opt/hwi --workdir /opt/hwi hwi-builder-arm64 /bin/bash -c "contrib/build_bin.sh --without-gui && contrib/build_dist.sh --without-gui" ``` -------------------------------- ### Get Key Pool from Hardware Wallet Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Fetch key pool descriptors from a hardware wallet using its fingerprint and a specified range. This is used to import keys into Bitcoin Core. ```bash $ ./hwi.py -f e5dbc9cb getkeypool 0 1000 [{"desc": "wpkh([e5dbc9cb/84'/0'/0']xpub6CbtS57jivMSuzcvp5YZxp6JhUU8YWup2axi2xkQRVHY8w4otp8YkEvfWBHgE5rA2AJYNHquuRoLFFdWeSi1UgVohcUeM7SkE9c8NftRwRJ/0/*)#cwyap6p3", "range": [0, 1000], "timestamp": "now", "internal": false, "keypool": true, "active": true, "watchonly": true}, {"desc": "wpkh([e5dbc9cb/84'/0'/0']xpub6CbtS57jivMSuzcvp5YZxp6JhUU8YWup2axi2xkQRVHY8w4otp8YkEvfWBHgE5rA2AJYNHquuRoLFFdWeSi1UgVohcUeM7SkE9c8NftRwRJ/1/*)#f6puu03f", "range": [0, 1000], "timestamp": "now", "internal": true, "keypool": true, "active": true, "watchonly": true}] ``` -------------------------------- ### Create Jade Emulator ROM Image Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Uses esptool.py to merge various binary files into a single flash image for the Jade emulator. This includes partition tables, OTA data, bootloader, and the main firmware binary. ```bash $ esptool.py --chip esp32 merge_bin --fill-flash-size 4MB -o main/qemu/flash_image.bin \ $ --flash_mode dio --flash_freq 40m --flash_size 4MB \ $ 0x9000 build/partition_table/partition-table.bin \ $ 0xe000 build/ota_data_initial.bin \ $ 0x1000 build/bootloader/bootloader.bin \ $ 0x10000 build/jade.bin $ cd .. ``` -------------------------------- ### HWI Get Keypool Command Usage Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Details the usage for the 'hwi getkeypool' command, which retrieves keys from the keypool. It supports options for internal/external keys, address types, and account specification. ```console usage: hwi getkeypool [-h] [--keypool | --nokeypool] [--internal] [--addr-type {legacy,wit,sh_wit,tap} | --all] [--account ACCOUNT] [--path PATH] start end ``` -------------------------------- ### Apply udev Rules and Configure User Group Source: https://github.com/bitcoin-core/hwi/blob/master/hwilib/udev/README.md This snippet shows the commands to copy udev rules to the system, trigger udev events, reload rules, create the 'plugdev' group if it doesn't exist, and add the current user to this group. ```Shell cd hwilib/; \ sudo cp udev/*.rules /etc/udev/rules.d/ && \ sudo udevadm trigger && \ sudo udevadm control --reload-rules && \ sudo groupadd plugdev && \ sudo usermod -aG plugdev `whoami` ``` -------------------------------- ### HWI Backup Command Usage Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Shows the usage for the 'hwi backup' command, including options for labeling the backup and setting a passphrase. ```console usage: hwi backup [-h] [--label LABEL] [--backup_passphrase BACKUP_PASSPHRASE] ``` -------------------------------- ### Build Docker Images for HWI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/development/release-process.md Builds the Docker images required for creating HWI distribution archives and binaries. Includes building for ARM64 architecture. ```bash docker build --no-cache -t hwi-builder -f contrib/build.Dockerfile . docker build --no-cache -t hwi-wine-builder -f contrib/build-wine.Dockerfile . # arm64 sudo apt-get install qemu-user-static docker buildx build --no-cache --platform linux/arm64 -t hwi-builder-arm64 -f contrib/build.Dockerfile . ``` -------------------------------- ### Clone KeepKey Firmware and Dependencies Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Clones the KeepKey firmware repository and its nanopb dependency. The nanopb repository is checked out to a specific version. ```bash $ git clone https://github.com/keepkey/keepkey-firmware.git $ cd keepkey-firmware $ git clone https://github.com/nanopb/nanopb.git -b nanopb-0.2.9.2 ``` -------------------------------- ### Sign PSBT Binary with HWI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/examples.md Converts a binary PSBT to base64, signs it using HWI, and converts the result back to binary. Requires base64 and jq utilities. ```bash cat example.psbt | base64 --wrap=0 | ./hwi.py -t ledger --stdin signtx | jq .[] --raw-output | base64 -d > example_result.psbt ``` -------------------------------- ### Issue Command to Device Source: https://github.com/bitcoin-core/hwi/blob/master/README.md Sends a command to a specific hardware wallet device, specifying its type and path. ```bash ./hwi.py -t -d ``` -------------------------------- ### Enumerate Ledger Devices Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/examples.md Lists connected Ledger devices and their paths. This command is useful for identifying the correct device path for subsequent operations. ```bash ./hwi.py enumerate [{"type": "ledger", "path": "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS02@14200000/Nano S@14200000/Nano S@0/IOUSBHostHIDDevice@14200000,0", "serial_number": "0001"}, {"type": "ledger", "path": "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS02@14200000/Nano S@14200000/Nano S@1/IOUSBHostHIDDevice@14200000,1", "serial_number": "0001"}] ``` -------------------------------- ### HWI Enumerate Command Usage Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Displays the usage for the 'hwi enumerate' command, which is used to list connected hardware wallet devices. ```console usage: hwi enumerate [-h] ``` -------------------------------- ### Scan UTXOs with BIP49 xpub Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/examples.md Use the obtained BIP49 xpub with Bitcoin Core's `scantxoutset` RPC to find relevant UTXOs. Requires Bitcoin Core v0.17.0 or later. ```default bitcoin-cli scantxoutset start '[{"desc":"sh(wpkh(xpub6DP8WTA5cy2qWzdtjMUpLJHkzonepEZytzxFLMzkrcW7U4prscYnmXRQ8BesvMP3iqgQUWisAU6ipXnZw2HnNreEPYJW6TUCAfmwJPyYgG6/0/*))","range":100}, {"desc":"sh(wpkh(xpub6DP8WTA5cy2qWzdtjMUpLJHkzonepEZytzxFLMzkrcW7U4prscYnmXRQ8BesvMP3iqgQUWisAU6ipXnZw2HnNreEPYJW6TUCAfmwJPyYgG6/1/*))","range":100}]' { "success": true, "searched_items": 49507771, "unspents": [ ], "total_amount": 0.00000000 } ``` -------------------------------- ### Clone Coldcard Emulator Repository Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Clones the Coldcard firmware repository, including submodules. ```bash git clone --recursive https://github.com/Coldcard/firmware.git ``` -------------------------------- ### hwi enumerate Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Enumerates connected hardware wallet devices. ```APIDOC ## hwi enumerate ```console usage: hwi enumerate [-h] ``` ### Optional Arguments - **-h, --help**: Show this help message and exit. ``` -------------------------------- ### Clone Trezor Firmware Repository Source: https://github.com/bitcoin-core/hwi/blob/master/test/README.md Clones the official Trezor firmware repository to build the emulator. ```bash $git clone https://github.com/trezor/trezor-firmware/ ``` -------------------------------- ### Sign a PSBT with HWI Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Use the HWI tool to sign a PSBT. This command requires the PSBT hex and the master fingerprint of the hardware device. ```default $ cd ../HWI $ ./hwi.py -f e5dbc9cb --testnet signtx cHNidP8BAHECAAAAAU8KWkCU7H4MYBiZHmLey6FavV3L3xLfy4tVEZoubx+2AAAAAAD+////AgDh9QUAAAAAFgAUVTwqL9q+W4jp29iZ19DlfMkbGb78eNcXAAAAABYAFLHuX3WRuPs3ypeQOziNw5qFlBH8AAAAAAABAR8AZc0dAAAAABYAFOHBlVRAplXb3rO39IoSBvhnGZEvIgYCIyDxz3Lnuizva+MtdJPOO9TGoldf5RziYDd63BZWA9QYgDjs2VQAAIABAACAAAAAgAAAAAAAAAAAAAAiAgP0HMQ2K693zCXTCudBUzemDhxLmFGETOnAV7vgDz2r9RiAOOzZVAAAgAEAAIAAAACAAQAAAAAAAAAA ``` -------------------------------- ### Prompt for PIN Source: https://github.com/bitcoin-core/hwi/blob/master/docs/usage/cli-usage.md Prompts the user to enter a PIN for device operations. ```console usage: hwi promptpin [-h] ``` -------------------------------- ### Create a Funded PSBT with Bitcoin Core Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/bitcoin-core-usage.md Use `walletcreatefundedpsbt` to create a PSBT funded by wallet inputs. This command selects coins using Bitcoin Core's algorithm and includes BIP 32 derivation paths. ```default $ src/bitcoin-cli -rpcwallet=hwicoldcard walletcreatefundedpsbt '[]' '[{"bc1q257z5t76hedc36wmmzva05890ny3kxd7xfwrgy":1}]' 0 '{"includeWatching":true}' true { "psbt": "cHNidP8BAHECAAAAAU8KWkCU7H4MYBiZHmLey6FavV3L3xLfy4tVEZoubx+2AAAAAAD+////AgDh9QUAAAAAFgAUVTwqL9q+W4jp29iZ19DlfMkbGb78eNcXAAAAABYAFLHuX3WRuPs3ypeQOziNw5qFlBH8AAAAAAABAR8AZc0dAAAAABYAFOHBlVRAplXb3rO39IoSBvhnGZEvIgYCIyDxz3Lnuizva+MtdJPOO9TGoldf5RziYDd63BZWA9QYgDjs2VQAAIABAACAAAAAgAAAAAAAAAAAAAAiAgP0HMQ2K693zCXTCudBUzemDhxLmFGETOnAV7vgDz2r9RiAOOzZVAAAgAEAAIAAAACAAQAAAAAAAAAA", "fee": 0.00002820, "changepos": 1 } ``` -------------------------------- ### Load Signed PSBT from Clipboard in Bitcoin Core Source: https://github.com/bitcoin-core/hwi/blob/master/docs/examples/walkthrough/walkthrough.md Load a signed Partially Signed Bitcoin Transaction (PSBT) from the clipboard into Bitcoin Core for broadcasting. ```bash File -> Load from Clipboard ```