Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ PoR Vault (Time-Locked Bitcoin Inheritance)

A non-custodial, Cypherpunk inheritance vault built in Rust.

This engine uses bare-metal Bitcoin primitives (P2WSH, OP_CSV, OP_IF) to create a cryptographic Dead Man's Switch. It allows a Primary Owner to hold funds securely, while mathematically guaranteeing that a Backup Owner can sweep the funds if the Primary Owner fails to "heartbeat" the vault within a specified timeframe.

🏗️ Architecture Features

  • Native Time-Locks: Uses standard OP_CHECKSEQUENCEVERIFY (OP_CSV) for consensus-layer time enforcement. No external oracles or smart contracts required.
  • Air-Gapped Cold Storage: Generates standard BIP-174 Partially Signed Bitcoin Transactions (PSBTs) allowing the Primary Key to remain permanently offline.
  • Wallet Interoperability: Outputs industry-standard Miniscript Descriptors, allowing the vault to be imported into professional wallets like Sparrow or Specter.
  • Mempool Resilience: Enforces BIP-125 Replace-By-Fee (RBF) to ensure time-critical sweep transactions never get permanently stuck in a congested mempool.
  • Symmetric Keystore: Private keys are never stored in plaintext. They are encrypted in memory using AES-256-GCM and PBKDF2 key derivation.
  • Autonomous Watchtower: Includes a multi-threaded, self-healing daemon that monitors the blockchain via mempool.space and alerts the owner before the time-lock expires.

🚀 Installation

Ensure you have Rust and Cargo installed.

git clone [https://github.com/YOUR_USERNAME/por-vault.git](https://github.com/YOUR_USERNAME/por-vault.git)
cd por-vault
cargo build --release

📖 Usage

Note: Add the --testnet flag to any command to run safely on the Bitcoin Testnet.

1. Create a Vault

Generates the cryptographic keypairs, the AES-encrypted keystore payloads, and the Miniscript Descriptor.

cargo run -- --testnet create --delay-blocks 52500
(52,500 blocks is approximately 1 year)

2. Start the Watchtower Daemon

Spawns a lightweight thread to monitor your vault on the blockchain. It will trigger an alarm if the Backup Owner's window is approaching.

cargo run -- --testnet daemon \
  --vault-address <VAULT_ADDRESS> \
  --delay-blocks 52500 \
  --alert-threshold 1008

3. Refresh (The Heartbeat)

Proves the Primary Owner is still alive by spending the UTXO back to the exact same vault, resetting the OP_CSV countdown. Outputs a Base64 PSBT for hardware wallet signing.

cargo run -- --testnet refresh \
  --primary-key <ENCRYPTED_PRIMARY_SECRET> \
  --backup-pubkey <BACKUP_PUBKEY> \
  --delay-blocks 52500

4. Recover (Dead Man's Switch)

If the time-lock has mathematically expired, the Backup Owner can sweep the funds to a destination address. The network will reject this transaction if the time delay has not passed.

cargo run -- --testnet recover \
  --backup-key <ENCRYPTED_BACKUP_SECRET> \
  --primary-pubkey <PRIMARY_PUBKEY> \
  --delay-blocks 52500 \
  --destination <SWEEP_ADDRESS>

⚠️ Security Disclaimer

This software was built for educational and architectural demonstration purposes. Cryptography is unforgiving. If you lose your keys, your password, or your Miniscript Descriptor, your funds will be permanently lost. Use on Mainnet at your own risk.

About

A non-custodial, Cypherpunk inheritance vault built in Rust.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages