[ad_1]
This article first appeared on Medium.
We have developed a smart contract-based safe, in which Bitcoins locked inside can only be transferred after a user-defined time frame.
coffers
Key theft is a major problem that plagues Bitcoin users. One way to protect Bitcoins is to store them in a safe that prohibits instant withdrawal. To spend Bitcoins there, two sequential steps are required.
Issue a request to remove the coins from the vault in a first transaction, called unvault. Wait a predefined time (called a payback period), say 24 hours after the first transaction’s checkout, before the coins can be checked out in a subsequent transaction.
Both steps use a key called the vault key. Another key, called a recovery key, can have up to 24 hours to block the second transaction if the safe key is stolen. Typically, the safe key is stored in a hot wallet, while the recovery key in a cold wallet.
The first transaction signals that someone is trying to transfer the coins and gives the owner the option to block the second transaction which completes the transfer. Step 1 is to transfer money from a savings account to a checking account before spending it. Step 2 is like having 24 hours to reverse an unauthorized payment made from a checking account.
Implementation
Built on a relative timelock, we have developed the following vault contract.
Safe deposit box contract
At first, coins locked in the contract are canceled by calling unvault () on line 18 in a transaction. It basically mutates an un-vaulted state from false to true on line 22 and propagates the state to lines 24-26. If all goes well, the coins can be removed by calling remove () after the first transaction has been included in the blockchain for at least the non-evaluation period, at line 30. Lines 35-37 use the timelock relative as before. If a theft attempt is detected during this time, the recovery key may void the transaction and move the coins elsewhere on line 41.
Discussion
We have developed a deferred withdrawal safe.
Compared to safes offered by a trusted third party such as Coinbase, it is not a custodian. The user must monitor the state of the safe’s UTXO to detect if there is a transaction request¹. It does not require any consensus changes or new opcodes such as OP_CheckTemplateVerify in BIP 119 or OP_CheckOutputVerify in Bitcoin Covenants.
Additional measures can be added to make a safe even more secure, such as white lists or spending limits. It is also easy to expand it to contain tokens.
***
REMARK:
[1] There are ways to do this without running a full node, like realtime notifications in mAPI.
Watch: Introducing CoinGeek New York, Smart Contracts & Calcul on Bitcoin
New to Bitcoin? Check out the Bitcoin for Beginners section of CoinGeek, the ultimate resource guide to learn more about Bitcoin, as originally envisioned by Satoshi Nakamoto, and blockchain.
|
Sources 2/ https://coingeek.com/non-custodial-bitcoin-vaults/ The mention sources can contact us to remove/changing this article |
[ad_2]