delvingbitcoin

OP_CAT Use cases series 3 : vaults

OP_CAT Use cases series 3 : vaults

Original Postby sCrypt-ts

Posted on: July 1, 2024 00:23 UTC

The latest discussion in the Bitcoin OP_CAT Use Cases Series focuses on constructing non-custodial vaults for enhancing the security of stored bitcoins.

These vaults, akin to decentralized solutions for preventing unauthorized access to funds, require a time delay for accessing the funds, thereby protecting against theft. By requiring a waiting period before transactions can complete, these vaults effectively deter attackers by making immediate theft impossible. This approach is compared to the traditional banking measure of blocking a stolen credit card.

Vaults operate with two keys: a vault key for regular online use and a recovery key for offline secure storage. The vault key is typically used for creating transactions from the vault, but any withdrawal must go through a time-locked period, allowing the owner to cancel unauthorized transactions with the recovery key. This system provides a window (e.g., 24 hours) during which the rightful owner can intervene to prevent theft, mirroring the process of transferring money between accounts but with added security measures to block fraudulent transfers.

The implementation of these vaults is achieved through smart contracts using sCrypt, a high-level language for Bitcoin smart contracts emphasizing readability and maintainability over traditional script code. The process involves three types of transactions: Trigger, Complete, and Cancel. Each type plays a role in securing and executing transactions from the vault, with specific conditions ensuring the security of the funds at each step. For instance, trigger transactions initiate the withdrawal process but must be followed by a complete transaction after the unvaulting period, while cancel transactions allow the vault owner to intercept and redirect the funds if necessary.

Illustrations and code snippets provided demonstrate the technical underpinnings of these vaults, including the necessary checks and balances embedded within the smart contracts to enforce the vault's security mechanisms. Alternative implementations and the advantages of using sCrypt for such applications are also discussed, highlighting its advantages in terms of readability and maintenance compared to traditional Bitcoin scripting languages.

Furthermore, the post includes links to explore the full Bitcoin ecosystem via The Mempool Open Source Project® and to view the full code repository on GitHub, offering readers resources for deeper exploration into Bitcoin vault implementations. The discussion concludes with references to similar works implemented on Bitcoin SV and alternative script versions, providing a comprehensive overview of the current state of non-custodial Bitcoin vault technology.