decred / atomicswap

On-chain atomic swaps for Decred and other cryptocurrencies.
https://blog.decred.org/2017/09/20/On-Chain-Atomic-Swaps/
ISC License
508 stars 231 forks source link

Zcoin atomic swap to be merged #50

Closed devwarrior777 closed 6 years ago

devwarrior777 commented 6 years ago

An atomic swap has been done between Decred testnet & Zcoin testnet

The output of the swap has been pasted in the file below:

There remain some issues with estimatefee and/or estimatesmartfee but these can probably be resolved either with talked about changes to the atomic swap cmd code or in the xzcwallet/xzcd zcoin-specific code. The swap is nonetheless successful.

To view the transactions on the Zcoin blockchain please use the temporary explorer at: http://45.76.2.255

API Example: http://45.76.2.255/api/getrawtransaction?txid=3583e1b9f2188862f0648e54ea29c4c2d8e8f31dfb015be80f18918cd106eb3f&decrypt=1

Note: warning: falling back to mempool relay fee policy

xcat-xzc-dcr_2018_01_13.txt

devwarrior777 commented 6 years ago

xcat-xzc-dcr_2018_01_13.txt file attached above shows the test output.

devwarrior777 commented 6 years ago

I have opened an Issue to get support for estimatefee by Zcoin. https://github.com/zcoinofficial/zcoin/issues/170 This RPC will almost certainly be in the next Zcoin release

jrick commented 6 years ago

I didn't go digging through their source, but it's possible (especially on the lesser used testnet) that these are implemented, but always return -1 due to a lack of transactions. When I was testing support for partatomicswap we had to flood the network with other transactions in order for the estimate RPCs to return anything useful.

jrick commented 6 years ago

So here's an issue that shouldn't have happened even with defaulting to the mempool relay fee policy:

Contract fee: 0 XZC (0.00000000 XZC/kB)

Looking at the actual transaction on that block explorer, it seems that it spends one previous output with value 2.999, and creates two outputs with values 0.7 and 2.299, and since the total input and output values are equal, there is no fee.

A fee is added to the redemption however:

Redeem fee: 0.000326 XZC (0.00101558 XZC/kB)

devwarrior777 commented 6 years ago

I have done a similar successful swap on mainnet and attach the details below.

Thanks for your feedback on both estimatefee and this Contract fee anomaly

mainnet test xzc_dcr_mainnet.txt

mainnet explorer: https://chainz.cryptoid.info/xzc/

devwarrior777 commented 6 years ago

I owe you guys a refund proof:

xzc_dcr_mainnet_refund_2018_01_24__1330.txt

devwarrior777 commented 6 years ago

Decred atomicswap

Zcoin

Zcoin v0.13.5.7 "fundrawtransaction now applies fees"

estimatefee/estimatesmartfee - all code exists and is enabled but the # transactions / block is not considered statistically significant. Experimenting with changing bitcoin parameters shows that estimation of fees works and will be available when transaction volumes increase.

jrick commented 6 years ago

Can you rebase+squash this and resolve the conflicts with the Gopkg.toml/lock files? To resolve those conflicts, you can revert both back to their state on master, add your new deps to Gopkg.toml, and then re-run dep ensure to update the lock without modifying anything else already in the lock.

edit: even easier method is to just revert those files to their master state and then re-run dep ensure. dep will update both the manifest and lockfile.

devwarrior777 commented 6 years ago

This is getting in a state - close this and I will do a new PR