Edit readme for cli workflow

This commit is contained in:
Jay Graber 2017-06-15 10:58:22 -07:00
parent 84df93782b
commit d29830c9bf
1 changed files with 18 additions and 15 deletions

View File

@ -1,15 +1,14 @@
# ZBXCAT
A work-in-progress for Zcash Bitcoin Cross-Chain Atomic Transactions
Contains basic scripts we're still testing in regtest mode on both networks. This may all be refactored as we go.
Bitcoin scripts use the rpc proxy code in python-bitcoinlib, and Zcash script will use python-zcashlib (a Zcash fork of python-bitcoinlib).
## BTC p2sh HTLC script
## Setup
The script `btc-p2sh-htlc.py` creates and redeems a p2sh transaction on Bitcoin regtest using a preimage. TODO: Locktime scripting still needs work.
To successfully run it, you'll need python3, the dependencies installed, and a bitcoin daemon running in regtest mode.
To successfully run this, you'll need python3, the dependencies installed, and a bitcoin daemon running in regtest mode.
To install python3 in a virtualenv, run this command from the top level of the directory:
```
@ -22,15 +21,6 @@ To install dependencies, run:
pip install -r requirements.txt
```
To run a bitcoin daemon in regtest mode, with the ability to inspect transactions outside your wallet (useful for testing purposes), use the command
```
bitcoind -regtest -txindex=1 --daemon
```
## ZEC p2sh HTLC script
The script `zec-p2sh-htlc.py` is the same as the BTC script, but uses python-zcashlib, which is still a work in progress.
To install python-zcashlib for testing and editing, clone the repository to your local filesystem. It is currently on a branch of python-bitcoinlib maintained by @arcalinea.
```
@ -45,13 +35,26 @@ To install python-zcashlib from your local filesystem path in editable mode:
`pip install --editable (-e) <path-to-zcashlib-fork-of-python-bitcoinlib>`
## Run Zcash and Bitcoin daemons locally
To test, run a Zcash daemon and bitcoin daemon in regtest mode. You may have to change the port one of them runs on, for example with the flag `-port=18445`.
To run a bitcoin daemon in regtest mode, with the ability to inspect transactions outside your wallet (useful for testing purposes), use the command
```
bitcoind -regtest -txindex=1 -daemon -port=18445
```
Be sure to run a Zcash daemon in regtest mode.
```
zcashd -regtest -txindex=1 --daemon
```
## XCAT CLI interface
Run `xcat.py` to go through the protocol. `xcat.py new` creats a new trade, `xcat.py seller` progresses with the seller's next step, `xcat.py buyer` progresses with the buyer's next step.
To test the entire script workflow, run `test.py`.
## Misc
`protocol-pseudocode.py` is guaranteed to not run. It was written as a brainstorm/sketch of a hypothetical xcat protocol using @ebfull's fork of Zcash/Bitcoin that supports createhtlc as an rpc command. Including here in case it's useful in any way.
I used the module [future](http://python-future.org/futurize.html) to make existing python2 code for the rpc interface compatible with python3.