ram.py
is a simple contract that allows a Script to commit to some memory, and modify it in successive executions.
It is a building block for more complex smart contracts that require "memory" access.
After following the root prerequisites, make sure to install the additional requirements:
$ pip install -r requirements.txt
ram.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 ram.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
withdraw
: Given the proof for the value of an element, withdraw from the contract.write i value
: Given a valid proof for the value of thei
-th element, updates the state but replacing it withvalue
.