This repository contains a (very much Work In Progress) framework to create and test smart contracts using the OP_CHECKCONTRACVERIFY
opcode of MATT.
Optionally, create a python environment:
$ python -m venv venv
$ source venv/bin/activate
Install the library with:
$ pip install .
The fastest way to get started is this docker container:
$ docker pull docker pull bigspider/bitcoin_matt
$ docker run -d -p 18443:18443 bigspider/bitcoin_matt
All the examples use the RPC_USER
, RPC_PASSWORD
, RPC_HOST
, RPC_PORT
environment variables to set up a connection with the regtest bitcoin node; the default values are the same as set in the container.
If they differ in your system, make sure to set them appropriately, or create a .env
file similar to the following:
RPC_HOST = "localhost"
RPC_USER = "rpcuser"
RPC_PASSWORD = "rpcpass"
RPC_PORT = "18443"
NOTE: the examples do not handle fee management and will send transactions with 0 fees; those are rejected with the default settings of bitcoin-core.
If not using the container above, please see an example of custom bitcoin.conf to work with the scripts in this repository.
The examples
folder contains some utility scripts to work with regtest bitcoin-core:
- init.sh creates/loads and funds a wallet named
testwallet
. Run it once before the examples and you're good to go. - fund.sh that allows to fund a certain address.
The following examples are currently implemented:
- Vault: an implementation of a vault, largely compatible with OP_VAULT BIP-0345.
- Rock-Paper-Scissors: play Rock-Paper-Scissors on bitcoin.