Skip to content

Managing Bitcoin inheritance on-chain with the Heritage Wallet CLI.

License

Notifications You must be signed in to change notification settings

crypto7world/heritage-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

Heritage CLI

The Heritage wallet CLI, a Bitcoin Taproot wallet managing on-chain inheritance of bitcoins.
Explore the Heritage wallet service »
Report Bug

Table of Contents
  1. About The Project
  2. Stability and versioning
  3. Installation
  4. Usage
  5. Roadmap
  6. Minimum Supported Rust Version (MSRV)
  7. License
  8. Built With
  9. Acknowledgments
  10. Contact

About The Project

The heritage-cli project provides a CLI tool to manages Bitcoin wallets.

It can interact with the btcherit.com service or manage everything locally. On the private keys front, it can either manage them localy, or with the help of a Ledger hardware-wallet device.

Here is the basic workflow between the Bitcoin blockchain, the btcherit.com service and the heritage-cli:

Workflow

This PNG can be edited using Draw.io

  1. The btcherit.com service synchronize permanently with the Bitcoin blockchain;
  2. From the service, you can see and manage your wallet, and create new unsigned transactions;
  3. The heritage-cli sign those transactions using your private key(s), preferably managed on a Ledger device;
  4. From the service, you can broadcast the signed transactions.

If you don't have a Ledger device, installing the heritage-cli on an air-gapped computer will give you a very secure setup because your private keys never need to "touch" the Internet, but on the other-hand making transactions is burdensome because you need to transfer them in and out of the air-gapped computer to sign them then broadcast them.

Another advantage of this setup is that you only have to verify/trust the heritage-cli: the btcherit.com service does not know your private keys and cannot steal your coin!

Yeah, but I don't want to depend on an online service at all

And I understand: the CLI is able to work independently of the service! Provide it a custom Bitcoin Core or Electrum node for synchronization, and manage your Heritage wallet entirely on your own!

Beware though that you SHOULD make sure you understand what are the caveat of this mode of operation, most importantly that you HAVE TO backup your descriptors: it is even more important than to backup you seed.

What is the added value of the service if the CLI can fully operate on its own?

Using Taproot Bitcoin scripts to manage inheritance is only good as long as you don't forget to move your coins to "reset" the dead-man switch. The service is here to remind you of that, as well as making the operation easy or even seemless (for example, if you spend coins few months before the expiration of your deadman switch, the service will automatically use this transaction to "reset" it).

Also, if you are dead, your heirs should be notified and helped to retrieve the coins you left behind for them, the service is also handling this part.

Of course you can take steps to do all that on your own, the service is simply here to ease the burden.

(back to top)

Stability and versioning

The software provided is working and can be safely used for Bitcoin's holdings.

We are using Semantic Versioning (MAJOR.MINOR.PATCH).

Everything is still in the initial-development stage (version 0.x.x). While you can expect every new version to be in working order, you SHOULD NOT expect the CLI arguments and usage to be stable. That being said, new features and breaking changes will only happen on MINOR version increment, not on PATCH version increment.

(back to top)

Installation

From pre-compiled binaries

You can find precompiled binaries for the major platforms in the Release section of the repo:

Latest version - All releases

If you wish to install the v0.6.0-beta for Linux, you can run:

version="v0.6.0-beta"
wget https://github.com/crypto7world/heritage-cli/releases/download/${version}/heritage-cli-${version}-x86_64-unknown-linux-gnu.tar.gz
tar xvzf heritage-cli-${version}-x86_64-unknown-linux-gnu.tar.gz
./heritage-cli # to verify it worked, should display usage instructions

Note: If you are on Linux and plan on using a Ledger device, you need to install UDEV rules, go to the official Ledger repository: https://github.com/LedgerHQ/udev-rules

From source

To install the heritage-cli from sources, make sure you have Rust installed. You can use any method, just make sure to have the Minimum Supported Rust Version. Using rustup.rs is generally a winner:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

On Linux, you need to install the libudev package, for example on Ubuntu:

sudo apt-get install -y libudev-dev

Then clone this repo, cd into it and run cargo install:

git clone https://github.com/crypto7world/heritage-cli
cd heritage-cli
cargo install --bin heritage-cli --path .
export PATH="$PATH:$HOME/.cargo/bin" # Make sure cargo installation path is in your PATH
heritage-cli # to verify it worked, should display usage instructions

Alternatively you can just use cargo build -r and then copy the heritage-cli binary from the target directory to wherever you like.

(back to top)

Usage

You can get help simply by running

heritage-cli help

Or, to get help about a specific command heritage-cli help <command>, for example:

heritage-cli help wallet create
Creates a new Heritage wallet with the chosen online-wallet and key-provider

An Heritage wallet has two functional components: 
  - The "key-provider" is the component dedicated to key management. 
    It will be use mainly when creating a new wallet and each time you need to sign a Bitcoin transaction. 
    Its security is critical and using a Ledger device is recommended. 
  - The "online-wallet" is the component on which you can declare your Heritage Configuration, generate new Bitcoin addresses, synchronize with the blockchain and create new Unsigned transactions.

Usage: heritage-cli wallet create [OPTIONS]

Options:
[CLIP]

Login to the service

Assuming you use the btcherit.com service as the online-wallet, the CLI will need to be authenticated.

heritage-cli service login

It will open a web-browser tab so you can login to the service and grant access to the CLI.

It is not per-say a mandatory step, but it will make your life MUCH easier.

Create a new wallet using the service and a Ledger

Note: If you are on Linux, you need to install UDEV rules in order for your Ledger device to be found, go to the official Ledger repository: https://github.com/LedgerHQ/udev-rules

Create a new wallet named default that will use the btcherit.com service as online-wallet and a Ledger as key-provider by simply running:

heritage-cli wallet create

Make sure your Ledger device in plugged in and unlocked!

Create a new wallet using a local node and a Ledger

Note: If you are on Linux, you need to install UDEV rules in order for your Ledger device to be found, go to the official Ledger repository: https://github.com/LedgerHQ/udev-rules

Create a new wallet named default that will use a local bitcoin node as online-wallet and a Ledger as key-provider by running:

heritage-cli wallet create -o local

Make sure your Ledger device in plugged in and unlocked!

Restore a wallet from seed with local private keys (no Ledger)

If you already have a mnemonic you would like to restore, for example abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about:

heritage-cli wallet create --kp local --seed abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about

⛔ OBVIOUSLY DO NOT USE THAT MNEMONIC TO CREATE YOUR BITCOIN WALLET ⛔

Create a backup-access for your wallet and designate your wife as your heir

First create 2 wallets:

heritage-cli heir backup create --email <your-own-email>
heritage-cli heir wife create --email <your-wife-email>

Then set the Heritage Configuration of your wallet. As an example, this tells "after 360 days without the coins moving, I want my backup wallet to be able to spend the coins, then 30 days later, I want my wife's wallet to be able to spend":

heritage-cli wallet heritage-config set --sh backup:360 --sh wife:390

As you can see, there is nothing really special about a backup-access. It is just a regular heir that happen to be yourself.

At this point, you can create addresses and start receiving coins:

heritage-cli wallet new-address

Last but not least, don't forget to save the seeds of the backup and wife heirs!!

heritage-cli heir backup backup-mnemonic
heritage-cli heir wife backup-mnemonic

The information provided by these commands is all your heirs need to be able to spend your coins if the deadman switch is not reset. You can put those in sealed paper envelopes. It is safe, because as long as you don't loose your main access (and don't die), there is absolutely nothing anyone can do with these enveloppes.

Synchronize the wallet

The Heritage wallet architecture makes it rely mostly on its internal database, which need to be synchronized with the blockchain when you receive new coins:

heritage-cli wallet sync

If you are NOT USING the btcherit.com service, the CLI will attempt to connect to a local Bitcoin Core node by default. You can change this behavior, for example to use a local Electrum node:

heritage-cli blockchain --set --electrum-uri tcp://localhost:50001

See the Blockchain provider options for more:

Blockchain Provider options:
      --electrum-uri <ELECTRUM_URI>
          Set the Electrum server RPC endpoint URI to use when broadcasting a transaction or synchronizing a local wallet
      --bitcoincore-url <BITCOINCORE_URL>
          Set the Bitcoin Core server RPC endpoint URL to use when broadcasting a transaction or synchronizing a local wallet
      --auth-cookie <AUTH_COOKIE>
          Use the specified cookie-file to authenticate with Bitcoin Core
      --username <USERNAME>
          Use the specified username to authenticate with Bitcoin Core
      --password <PASSWORD>
          Use the specified password to authenticate with Bitcoin Core

Spending coins

You can spend coins like this, in one line:

heritage-cli wallet send-bitcoin -r <address>:<amount> --sign --broadcast

The CLI will create a new transaction, show it to you, ask you if you want to sign it and then broadcast it. And that's it.

You can also decompose thoses steps. For reference, here is a Bash script doing the same thing as the previous one-liner:

unsigned=$(heritage-cli wallet send-bitcoin -r <address>:<amount>)
signed=$(heritage-cli wallet sign $unsigned)
heritage-cli wallet broadcast $signed

(back to top)

Minimum Supported Rust Version (MSRV)

This binary compile with Rust 1.79.0

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Built With

Rust

And based upon 3 Rust projects without which I would not have gotten that far:

Thanks.

(back to top)

Acknowledgments

(back to top)

Contact

John Galt - @Crypto7W - john@crypto7.world

Though my real name is Jérémie Rodon (LinkedIn, GitHub), I operate this project under the pseudonym John Galt in reference to the character of Ayn Rand novel Atlas Shrugged (and, yes, I obviously embrace John Galt philosophy).

Project Link: https://github.com/crypto7world/heritage-cli

(back to top)

About

Managing Bitcoin inheritance on-chain with the Heritage Wallet CLI.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages