Your First Programmable Bitcoin Wallet: A Step-by-Step Guide to Building a "Dead Man's Switch" with Liana.
Automate Your Legacy: A Hands-On Guide to Building a Trustless Recovery Plan Without Writing Code.
For years, the mantra of Bitcoin has been “not your keys, not your coins.” We have trained ourselves to be hyper-vigilant custodians of 12 or 24 words. We etch them into steel, hide them in buried PVC pipes, and memorize them until we can recite them backwards.
But this hyper-vigilance breeds a new kind of anxiety: the single point of failure.
If you are the sole guardian of your keys, what happens if you are incapacitated? What happens if your primary residence burns down, taking your hardware wallet and your primary steel backup with it? The fear of losing access is often just as potent as the fear of theft.
For a long time, the solutions to these problems were complex multi-signature setups that required trusting third parties or possessing the technical knowledge to code raw Bitcoin scripts.
Enter Liana.
Liana is a revolutionary open-source wallet interface that makes programmable Bitcoin accessible to everyone. It is built on “Miniscript,” a language that allows us to write “If-This-Then-That” contracts for our money.
Liana allows you to create a wallet that understands time. You can tell your Bitcoin: “If I don’t move you every 6 months using Key A, then allow Key B to spend you.”
This is a “Dead Man’s Switch,” or in less morbid terms, an automated inheritance or recovery plan. It is a silent guardian that only activates when you are no longer active.
In this tutorial, we are going to move beyond theory. We are going to build your first time-locked wallet.
The Silent Guardian: How Bitcoin Time-Locking Solves the Self-Custody Dilemma.
In the world of Bitcoin, there is a pervasive anxiety that lurks beneath the surface of “being your own bank.” It is the fear of the single point of failure. We preach self-custody, we memorize seed phrases, and we buy steel plates to protect our backups from fire and flood. Yet, a nagging question remains in the back of our minds:
Important Prerequisites and Safety Warnings
Before we begin, it is vital to establish the ground rules.
RULE 1: DO NOT USE REAL BITCOIN FOR THIS TUTORIAL.
We will be using the Bitcoin Testnet (or Signet). These are playground versions of Bitcoin with coins that hold zero real-world value. They exist specifically for testing new wallet setups without financial risk. Do not send mainnet BTC to the wallet we create today until you have tested it thoroughly on Testnet first.
Prerequisites:
A desktop or laptop computer (Windows, macOS, or Linux).
An internet connection.
About 30-60 minutes of uninterrupted time.
Optional but recommended for later: A hardware wallet (like a Ledger, Trezor, Coldcard, or BitBox02). For this specific tutorial, Liana can generate temporary “hot” keys on your computer so you don’t need hardware right now, but in a real scenario, hardware is essential.
The Quantum Computing Leap: Top 10 Stocks to Bet on the Revolution (2026 Edition).
From Theory to Trillions: Positioning Your Portfolio for the Greatest Technological Shift Since the Internet.
Phase 1: The Mental Model
Before we click a single button, we must define what we are trying to build. Programmable wallets can get complicated, so we will start with the simplest, most effective use case: The Basic Recovery Protocol.
We are going to create a wallet with two distinct paths for spending funds:




