/hardware-wallet

Use a world of microcontrollers to contruct your own bitcoin hardware wallet

Primary LanguageCMIT LicenseMIT

DIY Bitcoin Hardware Wallet (powered by uBitcoin)

This HWW is in BETA, use with TESTNET only, or with an amount of funds you are willing to lose

Use a world of microcontrollers to contruct your own bitcoin hardware wallet

For use with LNbits Legend OnchainWallet extension, but can other wallet applications can easily be built

Join us t.me/lnbits, t.me/makerbits

This very cheap off the shelf hardware wallet is designed to work with Lilygos Tdisplay, but you can easily make work with any ESP32.

Data is sent to/from the Hardware Wallet over webdev Serial, not the most secure data transmission method, but fine for handling small-medium sized amounts of funds. You can use LNbits OnchainWallet extension, or any other serial monitor.

Install instructions

  • Flash the hardware-wallet firmware directly from the browser using the installer

Build instructions

  • Buy a Lilygo Tdisplay (although with a little tinkering any ESP32 will do)
  • Install Arduino IDE 1.8.19
  • Install ESP32 boards, using boards manager
  • Download this repo
  • Copy these libraries into your Arduino install "libraries" folder
  • Open this wallet.ino file in the Arduino IDE
  • Select "TTGO-LoRa32-OLED-V1" from tools>board
  • Upload to device

Device Commands

The client (OnchainWallet extension or anyother one) communicates with the device using strings (called commands) of this form: /command-name {param1} {param2} ... {paramn}

  • the order of the parametes is relevant (the position gives its meaning)
  • if no the value is specified then the minus (-) character should be used at the respective position
  • eg: /password my-password-1

The device (HWW) can respond (not mandatory) with a string of the same form:

  • /command-name {resp1} {resp2} ... {respn}

The documentation for each command can be found in the linked .ino file

Run from SD Card (air-gapped)

Note: the device is not fully airgapped when other communication mediums are enabled (wifi, bluetooth, serial-port, etc).

In order to run from an SD Card one must:

  • mount the SD Card into a computer
  • create a file named commands.in.txt on the top level directory (no parent directory) of the SD Card
  • add the commands to the file. See sample files in examples/sd-card
  • mount the SD Card into the hardware device
  • reboot the device. On reboot the device will detect the commands.in.txt on the SD Card and will start executing the commands
  • wait for the device to complete execution
  • mount the SD Card into the computer. Two new files should be present:
    • commands.out.txt - contains the outputs of the commands. Here you will find the relevant data (like the signed PSBT)
    • commands.log.txt - contains the logs

How to use

// Guide to go here

Note: If using MacOS, you will need the CP210x USB to UART Bridge VCP Drivers available here https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers If you are using MacOS Big Sur or an Mac with M1 chip, you might encounter the issue A fatal error occurred: Failed to write to target RAM (result was 0107), this is related to the chipsest used by TTGO, you can find the correct driver and more info in this GitHub issue