The vault.py
script provides a command-line and interactive interface for Bitcoin vault operations, similar to the one described in the linked bitcoin-dev mailing list post.
Compared to that prototype, this version uses the CCV_FLAG_DEDUCT_OUTPUT_AMOUNT
to allow partial revaulting of a Vault UTXO. This was the only missing feature as compared to the implementation using OP_VAULT
(albeit with some differences in the revaulting semantics).
After following the root prerequisites, make sure to install the additional requirements:
$ pip install -r requirements.txt
vault.py
is a command line tool that allows to create, manage and spend the Vault UTXOs.
To run the script, navigate to the directory containing vault.py
and use the following command:
$ python vault.py -m
--mine-automatically
or-m
: Enables automatic mining any time transactions are broadcast (assuming a wallet is loaded in bitcoin-core).--script
or-s
: Executes commands from a specified script file, instead of running the interactive CLI interface. Some examples are in the (script)[scripts] folder.
While typing commands in interactive mode, the script offers auto-completion features to assist you.
You can use the following commands to work with regtest:
fund
: Funds the vault with a specified amount.mine [n]
: mines 1 orn
blocks.
The following commands allows to inspect the current state and history of known UTXOs:
list
: Lists available UTXOs known to the ContractManager.printall
: Prints in a nice formats for Markdown all the transactions from known UTXOs.
The following commands implement specific features of the vault UTXOs (trigger, recover, withdraw). Autocompletion can help
trigger
: Triggers an action with specified items and outputs.recover
: Recovers an item. Can be applied to one or more Vault, or Unvaulting (triggered) UTXO.withdraw
: Completes the withdrawal from the vault; will fail if the timelock of 10 blocks is not satisfied.
The scripts
folder has some example of interactions with the vault.