New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitcoin Cash Support #37

Merged
merged 4 commits into from Jan 19, 2018

Conversation

4 participants
@DesWurstes
Contributor

DesWurstes commented Nov 4, 2017

Ready To Be Merged

The first Bitcoin Cash atomic swap has been made!

To test both participate and initiate, the atomic swap was made as BCC-><-BCC.
Proof at the end of this Pull Request.

To do:

  • Add Chris Pacia's bchutil to dep
  • Test extractsecret, and auditcontract
  • Investigate whether all of BU, ABC, XT, Classic supports estimatesmartfee
  • Investigate whether BU is the only client that has problems with this little-effect piece of code, BitcoinUnlimited/BitcoinUnlimited#825 (needed for passing the fee to RPC, see this)
  • Test refund

Proof:

Secret:      1c219f5aa297cd6e43370af03139c18b616c5b951489110486fe2a8774b1f357
Secret hash: d179b059810d3a92f2034b3a7eda48793ac79c28

Contract fee: 0.00000224 BTC (0.00001000 BTC/kB)
Refund fee:   0.00000281 BTC (0.00001022 BTC/kB)

Contract (3KSmcFRuunMcTNN1bGdCdmNkt6S8VSPq8k):
63a614d179b059810d3a92f2034b3a7eda48793ac79c288876a91421cf3314cbb2ffa97d65847ce925c0fd0f12c2aa6704d80c005ab17576a914973d2163109e780cc499dcac0ab40fe0fab63af56888ac

Contract transaction (c46587a8709014cc644bde757a51445c9b829e73a2f08266b84ace09677c61a5):
0200000001e0b3fcb18629bffc29f41f3d97292262843a0d1ed5417df54b697a3cd58e6c04010000006b483045022100a24595c0797cda919ddf191b31cfa237aee7717a14602cb3139f816ed7940bf202200b07df394ead43162a52b043795c97f7c9cb48626068d4acd7166cea1b58dfab4121033c056ade10b36e72402c6cabaf3a144c2766284a5781dbba04969b9866eb720ffeffffff02e80300000000000017a914c2c07da0d1029012de3608322affa8e3d0a0d466875b247504000000001976a91488ced5c06b367d02c8f04b436b063ed49ce0009488ac1ba40700

Refund transaction (f7cc8e512b73d42d19110508fd80d51f1e0bc59c3c371435888ce5c8f521bbf6):
0200000001a5617c6709ce4ab86682f0a2739e829b5c44517a75de4b64cc149070a88765c400000000be47304402205a8cdf92a9d3cb54261100f6ee7352d398e25a193cdc132b95e0d2d77f2f7bb0022078de3bf3f7ff77580ec1ef6ad4f774c614252330e10091c0e07ac89b8107c7ce412103e31e1b29ef35cd226fee063be70d5f7b69e176a28c146acadbd5c11d0e43af2c004c5163a614d179b059810d3a92f2034b3a7eda48793ac79c288876a91421cf3314cbb2ffa97d65847ce925c0fd0f12c2aa6704d80c005ab17576a914973d2163109e780cc499dcac0ab40fe0fab63af56888ac0000000001cf020000000000001976a914e768d7ee85153d2fec57c002b60af7382ab87b6188acd80c005a

Publish contract transaction? [y/N] y
Published contract transaction (c46587a8709014cc644bde757a51445c9b829e73a2f08266b84ace09677c61a5)

Contract fee: 0.00000224 BTC (0.00001000 BTC/kB)
Refund fee:   0.00000281 BTC (0.00001022 BTC/kB)

Contract (3A7ZYY5SJiyZSA4wnpNEEprw75FA1dyEjm):
63a614d179b059810d3a92f2034b3a7eda48793ac79c288876a9149768e0f2b709a9b27410f299e8667eca7c907af76704bbbbfe59b17576a9144e5f167449bf4724b250eace368eeb347a05b79e6888ac

Contract transaction (5e1b408d005eef911c4bc9389d34a74572b271be794eaf51bd1ca978a923e3c2):
0200000001c10dbe9bf2237ef7b7676a30e6c4ef3223cef140163b25d927eb1116f1f01aca010000006b483045022100dc4c9af4adf9a38942875f96d9a357cd1275eb55e407f063e3807bd764b98079022008912d4340c0695fad6ca8f8b2fd83f88093fc1d53771cd651d7750902da1677412103a43b74d633b3c79e11f6aeeb3d1f1a45c43d4797378f39b4042801ffcb62a6aafeffffff02ee30ea0b000000001976a9144ce1bb1e060dbc4349d88f1cc99c379ea8995f7b88ace80300000000000017a9145c65628708065321444c8694e1a1b7f8db96d552871ba40700

Refund transaction (17646ba9d97939fa60a1bb46ba0496cab4661f95a52a4c3310eff895dd07d22e):
0200000001c2e323a978a91cbd51af4e79be71b27245a7349d38c94b1c91ef5e008d401b5e01000000be4730440220488c34d78d7aa3e15861835dd7b6c67f855f22a4f4917795c2e8c769030012720220038debd969c89c9d54b63b1d71157e11db916205e11e68e7da6039dcac02ccce41210323e5109c2db44697ce71c917f4506a10d82b193727bbd079858dc8fc894a7697004c5163a614d179b059810d3a92f2034b3a7eda48793ac79c288876a9149768e0f2b709a9b27410f299e8667eca7c907af76704bbbbfe59b17576a9144e5f167449bf4724b250eace368eeb347a05b79e6888ac0000000001cf020000000000001976a914815f0ac0ea87a60768028d20454f2d8ce9a005d288acbbbbfe59

DesWurstes:atomicswap DesWurstes$ /Users/DesWurstes/go/bin/btcatomicswap --rpcuser=bitcoinrpc --rpcpass=6lOxOOOPSGxyTKs66aql7x6vK redeem 63a614d179b059810d3a92f2034b3a7eda48793ac79c288876a9149768e0f2b709a9b27410f299e8667eca7c907af76704bbbbfe59b17576a9144e5f167449bf4724b250eace368eeb347a05b79e6888ac 0200000001c10dbe9bf2237ef7b7676a30e6c4ef3223cef140163b25d927eb1116f1f01aca010000006b483045022100dc4c9af4adf9a38942875f96d9a357cd1275eb55e407f063e3807bd764b98079022008912d4340c0695fad6ca8f8b2fd83f88093fc1d53771cd651d7750902da1677412103a43b74d633b3c79e11f6aeeb3d1f1a45c43d4797378f39b4042801ffcb62a6aafeffffff02ee30ea0b000000001976a9144ce1bb1e060dbc4349d88f1cc99c379ea8995f7b88ace80300000000000017a9145c65628708065321444c8694e1a1b7f8db96d552871ba40700 1c219f5aa297cd6e43370af03139c18b616c5b951489110486fe2a8774b1f357
Redeem fee: 0.00000314 BTC (0.00001019 BTC/kB)

Redeem transaction (dc1b1f11ef09041a78240c02e019f9867773dd39367dbe489c7be09a47baa28c):
0200000001c2e323a978a91cbd51af4e79be71b27245a7349d38c94b1c91ef5e008d401b5e01000000df473044022023a93c83e7b7cea3850c13de67670fca150345ee80c5a95367fdf0d4375d132602207e248b10e581161214ce8024fd732bf8e31351e585cad1389ccda000fd2d7475412103ad161d06f01e4d7c9b2bdb6b5f372492953b1cb6f8656ada567898409f41ee49201c219f5aa297cd6e43370af03139c18b616c5b951489110486fe2a8774b1f357514c5163a614d179b059810d3a92f2034b3a7eda48793ac79c288876a9149768e0f2b709a9b27410f299e8667eca7c907af76704bbbbfe59b17576a9144e5f167449bf4724b250eace368eeb347a05b79e6888acffffffff01ae020000000000001976a914ec5605bc9a6d8f956b59b1a1d8c27028d35bdbe888acbbbbfe59

Publish redeem transaction? [y/N] y
Published redeem transaction (dc1b1f11ef09041a78240c02e019f9867773dd39367dbe489c7be09a47baa28c)

Redeem fee: 0.00000314 BTC (0.00001016 BTC/kB)

Redeem transaction (f08720cf546429c66caf3c4a4ad930c78af98a11fcdd6f53a83d79c86667ce8a):
0200000001a5617c6709ce4ab86682f0a2739e829b5c44517a75de4b64cc149070a88765c400000000e0483045022100d12b8f8b16078816cd3b7f55a9c8d6b3a4bca382e148f0992e7bd2ef6c1ec82902201fda05716a0103bee8589653ac201466480ab513381c27c5dcba26aebb20f92b412103676cff7650b9e234b9ccbc2f49411824edb814d2009abb856e8f94745ee80191201c219f5aa297cd6e43370af03139c18b616c5b951489110486fe2a8774b1f357514c5163a614d179b059810d3a92f2034b3a7eda48793ac79c288876a91421cf3314cbb2ffa97d65847ce925c0fd0f12c2aa6704d80c005ab17576a914973d2163109e780cc499dcac0ab40fe0fab63af56888acffffffff01ae020000000000001976a9146e7c37283828af7148a202570c65f59febb40f0088acd80c005a

Publish redeem transaction? [y/N] y
Published redeem transaction (f08720cf546429c66caf3c4a4ad930c78af98a11fcdd6f53a83d79c86667ce8a)

Another proof that I am MCCCS: "I am MCCCS"

@DesWurstes DesWurstes changed the title from Bitcoin Cash Support!!! to Bitcoin Cash Support Nov 4, 2017

@gubatron

This comment has been minimized.

Show comment
Hide comment
@gubatron

gubatron Nov 4, 2017

Investigate whether all of BU, ABC, XT, Classic supports estimatesmartfee

This exists in bitcoinclassic's code, not sure if that means it does support it:

src/txmempool.cpp

CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) const
{
    LOCK(cs);
    return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
}

gubatron commented Nov 4, 2017

Investigate whether all of BU, ABC, XT, Classic supports estimatesmartfee

This exists in bitcoinclassic's code, not sure if that means it does support it:

src/txmempool.cpp

CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) const
{
    LOCK(cs);
    return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
}
@DesWurstes

This comment has been minimized.

Show comment
Hide comment
@DesWurstes

DesWurstes Nov 5, 2017

Contributor

Unfortunately Bitcoin XT supports fundrawtransaction 0% while Bitcoin ABC supports it 100%.

Bitcoin Classic and Unlimited don't allow the fees to be passed, which may be a problem only if fees rise.

Contributor

DesWurstes commented Nov 5, 2017

Unfortunately Bitcoin XT supports fundrawtransaction 0% while Bitcoin ABC supports it 100%.

Bitcoin Classic and Unlimited don't allow the fees to be passed, which may be a problem only if fees rise.

@dgenr8

This comment has been minimized.

Show comment
Hide comment
@dgenr8

dgenr8 Nov 6, 2017

Just make it great. XT will cherry-pick fundrawtransaction from core.

dgenr8 commented Nov 6, 2017

Just make it great. XT will cherry-pick fundrawtransaction from core.

@jrick

thanks for picking up the ball with this. just have some small suggestions about naming

Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go
Show outdated Hide outdated cmd/bccatomicswap/main.go

@DesWurstes DesWurstes referenced this pull request Nov 7, 2017

Merged

Update engine.go #1

@DesWurstes

This comment has been minimized.

Show comment
Hide comment
@DesWurstes

DesWurstes Nov 14, 2017

Contributor

It works. HF hasn't broken it.


@jrick One last question: Can this be used to mix coins trustlessly (and privately from others)?


Ready To Be Merged!

Contributor

DesWurstes commented Nov 14, 2017

It works. HF hasn't broken it.


@jrick One last question: Can this be used to mix coins trustlessly (and privately from others)?


Ready To Be Merged!

@jrick

This comment has been minimized.

Show comment
Hide comment
@jrick

jrick Nov 14, 2017

Member

no on that last question, you can passively observe both chains and see the swap due to the shared secret once it is revealed by both redeeming parties.

Member

jrick commented Nov 14, 2017

no on that last question, you can passively observe both chains and see the swap due to the shared secret once it is revealed by both redeeming parties.

@jrick

This comment has been minimized.

Show comment
Hide comment
@jrick

jrick Nov 27, 2017

Member

I'll try to give this another look soon, but it will need to be switched over to use OP_SHA256 instead of OP_RIPEMD160 since we just converted the rest of the tools. See 4c8c7c0 for how to make this change.

Member

jrick commented Nov 27, 2017

I'll try to give this another look soon, but it will need to be switched over to use OP_SHA256 instead of OP_RIPEMD160 since we just converted the rest of the tools. See 4c8c7c0 for how to make this change.

@DesWurstes

This comment has been minimized.

Show comment
Hide comment
@DesWurstes

DesWurstes Nov 28, 2017

Contributor

Should I add the new Bitcoin Cash Bech32 address format, or is it too early (14 Jan, planned by Amaury)?


Was your sha256 commit tested? Now this line throws an error:

https://github.com/DesWurstes/atomicswap/blob/BitcoinCash/cmd/bchatomicswap/main.go#L700

because pushes is nil.

Contributor

DesWurstes commented Nov 28, 2017

Should I add the new Bitcoin Cash Bech32 address format, or is it too early (14 Jan, planned by Amaury)?


Was your sha256 commit tested? Now this line throws an error:

https://github.com/DesWurstes/atomicswap/blob/BitcoinCash/cmd/bchatomicswap/main.go#L700

because pushes is nil.

@jrick

This comment has been minimized.

Show comment
Hide comment
@jrick

jrick Nov 28, 2017

Member

Ugh you're right, it needs updates for txscript as well or else it fails to parse the script as an atomic swap script. Had that sitting in my tree and didn't make those necessary changes first.

I'm going to revert the latest commit and put up an issue so that all the maintainers can coordinate, since it will need similar updates to their btcd fork.

Thanks for noticing that and sorry for the waste of time.

Member

jrick commented Nov 28, 2017

Ugh you're right, it needs updates for txscript as well or else it fails to parse the script as an atomic swap script. Had that sitting in my tree and didn't make those necessary changes first.

I'm going to revert the latest commit and put up an issue so that all the maintainers can coordinate, since it will need similar updates to their btcd fork.

Thanks for noticing that and sorry for the waste of time.

@dgenr8 dgenr8 referenced this pull request Dec 27, 2017

Merged

Add fundrawtransaction #288

@jrick jrick added this to Currencies being added in Additional cryptocurrency interop support Jan 12, 2018

@jrick

jrick approved these changes Jan 19, 2018

@jrick jrick merged commit 7912904 into decred:master Jan 19, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@DesWurstes DesWurstes deleted the DesWurstes:BitcoinCash branch Jan 19, 2018

@jrick jrick moved this from Under review to Completed in Additional cryptocurrency interop support Jan 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment