Heartbit
An on-chain Bitcoin inheritance protocol on Stacks that distributes funds to assigned recipients after a defined inactivity period.
Overview
Heartbit is an on-chain Bitcoin inheritance protocol built on Stacks. A user sets a custom inactivity period and assigns recipient wallets with specific percentage allocations. If they don’t check in with a “heartbeat” transaction before the deadline, the contract automatically redistributes their funds to the chosen recipients - a “dead man’s switch” for crypto assets. Built for the Bitcoin 2025 Official Hackathon.
The problem
A significant portion of Bitcoin is permanently lost to forgotten wallets, lost private keys, or holders passing away without a backup plan. Self-custodied Bitcoin is gone forever if the owner becomes unreachable and no one else holds the keys - and the usual fix, handing someone your keys, defeats the point of self-custody.
What I built
- On-chain inheritance logic in a Clarity smart contract: it tracks an owner’s activity via a periodic “heartbeat” transaction and, after a configurable period of silence, unlocks distribution to assigned recipients.
- Flexible recipient allocation - assign multiple recipient wallets with custom percentage splits and a custom inactivity threshold (e.g. 30 or 90 days).
- A Next.js + Tailwind + shadcn/ui frontend with clear setup flows and warnings, wired to the chain via Stacks.js and Hiro Wallet.
Tech & approach
The protocol settles on Bitcoin through Stacks, whose Clarity contracts inherit Bitcoin’s security while staying expressive. The inactivity timer is tracked using block height as an on-chain time proxy, and Stacks.js plus Hiro Wallet bridge the web app to the contracts. I used Clarinet for local contract testing.
The core design challenge was the inactivity mechanism. It has to be safe in both directions: a recipient must never claim early or maliciously while the owner is still active, but a genuinely unreachable owner’s assets must still pass on reliably. That meant carefully defining what counts as “activity,” how the countdown resets, and how secure percentage-based distribution is gated - the security of the whole protocol lives in those rules.
Challenges
Documentation for Stacks/Clarity was sparse and scattered, especially for timing-related logic, so a lot of the work was figuring out idioms from first principles. Getting precise, secure percentage-based fund distribution right was delicate, and ensuring smooth wallet integration across environments and testnets took real iteration.
What I learned
In Web3, the threat model is the design. Unlike a typical app where an edge case is a bug, here a flawed assumption is an exploit with money attached. Most of the thinking went into adversarial questions - “how would someone steal this?” - rather than features. I also learned to use block height as a reliable on-chain clock, and how to connect frontend state to blockchain state cleanly through Stacks.js.
It also reinforced the value of making self-custody less fragile: letting people hold their own keys and have a safety net, instead of choosing between control and continuity.
What I’d improve next
- Reminder systems (email, push notifications) so owners never miss a heartbeat by accident.
- Multi-token inheritance beyond STX.
- An analytics dashboard for tracking heartbeat status and claim eligibility, plus a formal write-up of the contract rules for public review.
Screenshots