Dead Man's Switch / Last Will

When I die, my family will strugle with the keys of a bitcoin wallet.
But will be a nightmare when you have a full node with open channels!

That was my intention to write a script that solves this:

#!/bin/bash
ADDR="my Wallet ADDRESS (starting with bc1, 3..., 1...), where I wrote in my last will, where the keys are"
# uncomment for testing with testnet (needs a umbrel syncronized with testnet)
# TESTNET="--network=testnet" 

SAT_PER_BYTE=$(curl -sSL "http://localhost:3006/api/v1/fees/recommended" | jq -r .minimumFee)

echo "closes ALL channels at $SAT_PER_BYTE sats/vByte in 30 seconds..."

sleep 30
echo "yes" | docker exec -i lnd lncli $TESTNET closeallchannels --force --sat_per_vbyte $SAT_PER_BYTE

echo "Try to send onchain all, every 1h forever."
while true; do
	date
SAT_PER_BYTE=$(curl -sSL "http://localhost:3006/api/v1/fees/recommended" | jq -r .minimumFee)
	# the base58 (1..	Bitcoin pubkey hash, 3.. Bitcoin script hash) 
	# or bech32 (bc1...) encoded bitcoin address to send coins to on-chain
	docker exec lnd lncli $TESTNET sendcoins --sat_per_vbyte $SAT_PER_BYTE --sweepall --addr $ADDR
	sleep $((3600))
done

Save it as ~/deadMansSwitch.sh on tha machine that runs umbrel and chmod a+x ~/deadMansSwitch.sh

add an entry in crontab (using crontab -e), with the condition when to close
# Close all Lightning Channels and send coins to on-chain to my ADDRESS (DEAD MAN SWITCH)
00 14 1 * * if test -f ~/dms; then ~/deadMansSwitch.sh; fi

every 1st of month at 14:00 it is tested if the file ~/dms exists, if not, nothings happens.
Now create the file
touch ~/dms
and if you’re still alive you have to rm ~/dms before the time and create it after again.

If you have better ideas, what condition should be in cron (I have another, but it will not work for all using a Rasperry Pi).

9 Likes

Would it not be better to check your wallets for transactions. If no transaction in X months send warning email to owner that transaction is required before Y months or DMS activates. If no transactions after Y months - DMS.

1 Like

Excellent post and important topic. It will become more and more a problem with Bitcoin and cryptocurrency in general becoming an important part of people and family wealth.
Hopefully everything can be solved with code this time, and without trusting any third party.

Your script looks already pretty good, I’m not a programmer so I cannot review it in detail but on the principle I like it. As @damanic suggest I would add more user friendly ways to signal that you are still alive/in full capacity. Maybe using some app/script shortcut on your smartphone that prolong the timer for a certain time. A notification if you forgot a time long enough before would be a must for me as well. Also the timing can be decide for each situation, in my opinion the inheritor should not need to have access to all your Bitcoin wealth within a month. I would set a much longer timing, like 3 or 6 months, even a year but it’s up to everyone to decide.

Another aspect is how secure vs accessible will be the destination wallet. You want to be sure that the heirs learn about it before or very shortly after the transfer, so they can organize to secure the bitcoins in a properly set wallet (or several wallets) what might not be the one you used to transfer the coins. Also more importantly you should be sure that no-one with bad intentions will know about the wallet that will receive the coins, otherwise they might setup a script to stole the coins as soon as it hits the wallet, not letting a chance for the intended heir to transfer it. Even worst, if by mistake you let the script get triggered (forgetting to renew the timer, mistake at setup or modification of your setup), you want to be sure that your can transfer back the fund on a secure wallet before anyone else know. I would also have something that monitor the wallet and send you a notification if anything move in or out of it, then you have still some days before it trigger a notification for your heir to look for the private key/seed and instruction how to get access.

So there is another social, logistical aspect not to neglect. Where is the backup of the inheritance wallet? is there a risk that it get destroy? Is there a risk that in 5, 10, 15, 30 years it uses a technology that is obsolete and thus hard to recover? Is it single or multi-sign? Is it one wallet or multiple wallet (wife, kid 1, kid 2, grand-kid, parents…) Which could also end up to be problematic legally as you might not be allowed to split your wealth as much as you wish too depending on the jurisdiction and if you want to stay within the law or transfer undeclared wealth.

I think it’s a huge potential for services to offer planning and solution deployment. If you have some will and time to start a company or DAO about it.

EDIT: apparently there are already simple service for dead man switch like https://finalmessage.io/ (you can pay in bitcoins over LN), could be nice if they integrate a way to trigger your script in the same time or trigger the renewal of the script waiting time when you renew your switch by them. Then the Dead man switch can inform the heirs in due time.

However you still have to trust finalmessage to be alive when you need them, at least you check on them once every renewal. Would be even better if only managed on Bitcoin with timed multi-signed transactions. I imagine it could be done with smart contract as well but I think Ethereum doesn’t offer timed based smart contract, am I right?

Beside that I think their service is quite expensive, 50$ per year, espacially as you don’t intend to die in the next years, so if you use it for 30-40 years, it add up. But it all depend on how important is this service for you.

2 Likes

Excellent proposal.
I have never closed a channel and so I put the following question.
Isn’t it supposed when you close a channel, the sats return to the original Onchain wallet? (the owner’s).
The command ordering trigger, might consider the normal transfer to the owner’s wallet which may use the geographic distribution strategy (Multisig vs. Shamir’s Secret Sharing Scheme) - https://medium.com/clavestone/bitcoin-multisig-vs-shamirs-secret-sharing-scheme-ea83a888f033
I have 3 schemes distributed to different places with distribution order in case of my death.
The “proof of life” (DMS) is carried out using contacting the 3 places to find out if the schemes are still in the vaults.
Your script may help recover the funds from the channels before the schemes are distributed.

The command

closeallchannels --force --sat_per_vbyte $SAT_PER_BYTE

closes all channes and puts the sats in the bitcoin wallet of Umbrel.

The command
sendcoins --sat_per_vbyte $SAT_PER_BYTE --sweepall --addr $ADDR

sends all the sats in the bitcoin wallet to $ADDR .

That’s anyway only working as long as your Umbrel node is still online.
That’s the reson, I would not wait 6 months or more.

@pjw
What a brilliant idea!
I too have struggled with this issue, what happens to my node when i go AFK permanently sort of speak However, I did not think to approach the problem as you have. This is well worth me spending some time and maybe customising this a little but. For sure you have provided a solution to what is/could become a complicated problem.

Nice work!

This is a feature that should be on the Umbrel roadmap - it would get my vote especially one that was simple and had many thought through options available.