Dead Mans Switch
What is the Dead Man's Switch?
The Dead Man's Switch is the core security mechanism of LegacyVault, designed to solve the "Lost Key" problem. Instead of trusting a lawyer with your private keys, you trust a Smart Contract Timer.
You set a specific duration (e.g., 1 year) during initialization. As long as you are alive and active, you reset the timer. If you stop resetting it, the protocol assumes you are incapacitated.
How It Works
The system runs entirely on-chain on Arbitrum Stylus. The logic uses Unix Timestamp comparison to determine the vault's state.
1
The "Ping" Mechanism (Proof of Life)
The owner must periodically interact with the contract to prove they are still in control. Calling the ping() function updates the last_ping variable to the current block timestamp.
// Actual logic from BE/vault-logic/src/lib.rs
pub fn ping(&mut self) -> Result<(), Vec<u8>> {
// 1. Verify caller is the owner
if msg::sender() != self.owner.get() {
return Err(b"Not owner".to_vec());
}
// 2. Update the heartbeat timestamp
self.last_ping.set(U256::from(block::timestamp()));
Ok(())
}