POC for Atomic cryptocurreny exchange based on atomic swaps
Development for version 1.0 has started!!
For the first POC the scope is swapping bitcoins (initiator) for TfChain/Rivine (acceptor) tokens.
Two scripts are created. The initator and acceptor scripts. They are essentially a TCP client and server using gRpc to communicate. Both of the parties will use Zerotier for easy, NAT friendly communication.
The flow is based on this readme and the same binaries are used from within the Python script. The binaries are adjusted so the output is JSON instead of plain text.
Flow overview:
This is a simplified flow since Blockchain technology needs time to get the nodes into sync. It will be required to poll the Blockchain (or get an event) to continue the flow when the required data is available.
Two environments will be needed. One will contain full blockchain nodes (or the least implementation needed for a simple wallet). Another one will contain the command line tools (bitcoin-cli / rivinec) to communicate with the nodes and all the required scripts and Ui implementation. In a later phase an orderbook will be added and we will use distributed lightweight wallets.
In a first phase a Dockerfile was created using to install both the bitcoind and tfchain binaries/daemons. The Docker has both scripts at disposal and can be used to easily initiate a swap.
The docker has to be started with these arguments so Zerotier works: --device=/dev/net/tun --cap-add=NET_ADMIN
docker pull jimber/atomicexchange
docker run --device=/dev/net/tun --cap-add=NET_ADMIN --cap-add=SYS_ADMIN -d --name crypto1 -v /crypto/crypto1:/crypto -e QT_WEBGL_WEBSOCKETSERVER=ws://0.0.0.0:33000 jimber/atomicexchange
Create pseudo code for flowCreate Dockerfile with bitcoin binariesAdjust Dockerfile for tfChain binariesCreate Python script using gRpc based on pseudo codePrepare environments for first swap (get tokens)Adjust btcatomic swap binaries for json outputAdjust rivine/tfchain binaries for json outputDo manual swapAdjust .md file to match outputAdd timers/checks in script where it is requiredDo automatic swap- Finetuning of script
Add Zerotier to docker so swap is possible in different networks

