Go to file
Ariel Gabizon 3dcd20c767 tweaks 2017-07-14 15:53:47 -04:00
.gitignore Add cli interface beginning 2017-05-22 18:00:34 -07:00
EthXcatAPI.py change to shorter names 2017-07-14 10:41:36 -04:00
README.md Edit readme for cli workflow 2017-06-15 10:58:22 -07:00
api.py add api file 2017-07-05 21:09:09 +02:00
bXcat.py adapt api for ethereum xcat 2017-07-13 21:14:28 -04:00
bitcoin-xcat.py Fix contract saving 2017-05-23 11:22:21 -07:00
btc-p2sh-htlc.py don't print txid's in little endian 2017-05-16 18:39:08 +03:00
eth.py tweaks 2017-07-14 15:53:47 -04:00
htlc-redeemAfterTimeLock.py don't print txid's in little endian 2017-05-16 18:39:08 +03:00
requirements.txt Edit README 2017-05-12 16:10:06 -07:00
secret.json wip 2017-07-14 11:56:06 -04:00
test.py adapt api for ethereum xcat 2017-07-13 21:14:28 -04:00
trades.py Remove dead code, rename things 2017-05-26 15:21:23 -07:00
userInput.py Put user input in separate file, create test file to run through protocol 2017-05-26 15:08:57 -07:00
utils.py have api methods look at trade file themselves instead of expectin parameter 2017-07-05 15:54:40 +02:00
xcat.json wip 2017-07-14 11:56:06 -04:00
xcat.py have api methods look at trade file themselves instead of expectin parameter 2017-07-05 15:54:40 +02:00
zXcat.py tweaks 2017-07-14 15:53:47 -04:00
zXcatForEth.py adapt api for ethereum xcat 2017-07-13 21:14:28 -04:00
zcashcli.py Refactor into classes, add automation functions. Unfinished 2017-05-26 09:23:49 -07:00
zec-p2sh-htlc.py Add zec p2sh script, must install python-zcashlib 2017-05-12 16:27:29 -07:00

README.md

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).

Setup

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:

virtualenv -p python3 venv
source venv/bin/activate

To install dependencies, run:

pip install -r requirements.txt

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.

git clone https://github.com/arcalinea/python-bitcoinlib.git
cd python-bitcoinlib
git checkout zcashlib

Then, install the module locally in editable mode through pip, so that you can make changes to the code of python-zcashlib and they will be applied immediately. It is necessary to install python-zcashlib this way for now because the fork of the library likely contains many bugs, which need to be fixed before zec-p2sh-htlc.py will work properly.

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

I used the module future to make existing python2 code for the rpc interface compatible with python3.