diff --git a/README.md b/README.md index 1b24eeb..303ef79 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ TsfWDVTAcsLaHUhHnLLKkGnZuJz2vkmM6Vr _Party B runs:_ ``` -$ bitcoin-cli -testnet getnewaddress +$ bitcoin-cli -testnet getnewaddress "comment" "legacy" n31og5QGuS28dmHpDH6PQD5wmVQ2K2spAG ``` @@ -243,24 +243,25 @@ should be saved in case a refund is necessary. _Party A runs:_ ``` -$ btcatomicswap --testnet --rpcuser=user --rpcpass=pass initiate n31og5QGuS28dmHpDH6PQD5wmVQ2K2spAG 1.0 -Secret: 3e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16 -Secret hash: 29c36b8dd380e0426bdc1d834e74a630bfd5d111 +$ ./btcatomicswap --testnet --rpcuser=user --rpcpass=AtomicSwap1234 initiate mkTqX7oLvzxjLFjsfpeRtLkKsyDwsekNDJ 0.0009 +warning: falling back to mempool relay fee policy +Secret: 901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd +Secret hash: 91ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd2 -Contract fee: 0.0000744 BTC (0.00020000 BTC/kB) -Refund fee: 0.00000281 BTC (0.00001018 BTC/kB) +Contract fee: 0.00000166 BTC (0.00000672 BTC/kB) +Refund fee: 0.00000297 BTC (0.00001021 BTC/kB) -Contract (2MwQAMPeRGdCzFzPy7DmCnQudDVGNBFJK8S): -63a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a914ebcf822c4a2cdb5f6a6b9c4a59b74d66461da5816704d728bd59b17576a91406fb26221375b1cbe2c17c14f1bc2510b9f8f8ff6888ac +Contract (2N6Tn86gmckeQH4caubCoJF7DkGZuX7F8PP): +6382012088a82091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a9143641b9cac269f3f85b7c521f563dfc5eb49228a96704ba1b335db17576a914685ec9625a6084b9a287d7023857534a54e089516888ac -Contract transaction (346f4901dff1d69197850289b481f4331913126a8886861e7d5f27e837e0fe88): -010000000267864c7145e43c84d13b514518cfdc7ca5cf2b04764ed2672caa9c8f6338a3e3010000006b483045022100901602e523f25e9659951d186eec7e8b9df9d194e8013fb6d7a05e4eafdbb61602207b66e0179a42c54d4fcfca2b1ccd89d56253cc83724593187713f6befb37866201210288ef714849ce7735b64ed886d056b80d0a384ca299090f684820d31e7682825afeffffff3ac58ce49bcef3d047ea80281659a78cd7ef8537ca2bfce336abdce41450d2d7000000006b483045022100bd1246fc18d26a9cc85c14fb60655da2f2e845af906504b8ba3acbb1b0ebf08202201ec2cd5a0c94e9e6b971ec3198be0ff57e91115342cd98ccece98d8b18294d86012103406e35c37b3b85481db7b7f7807315720dd6486c25e4f3af93d5d5f21e743881feffffff0248957e01000000001976a914c1925e7398d325820bba18726c387e9d80047ef588ac00e1f5050000000017a9142d913627b881255c417787cc255ccad9a33ce48d8700000000 +Contract transaction (9e47b18deb57cf0f53fa615d360ded1cd6f28aed560056e6f1771741e01c7db5): +020000000001018e4a97368348a4561c5644a4263232d7c6d251489ea055631a04ab60f00afe7b0000000017160014f4e813007dd822942bc84a593e29ba81fa9b818cfeffffff02905f01000000000017a91490f97392e65b9395a55b574b1b448e155380ea4d876a2600000000000017a91498cf0bc7b56953b3cfb7b3c7270bff8c09247d4c870247304402205d10647e2eff1898d94adbb89a5e0aee15f1e1bea56a047e114ef5b8cb6a8dc202203240bf57659d75bdf5e446b1a71371a4747b3a7ecc532e9cd3a8306a473492a7012102b8a75060633a360d13a17e01e2f3c0e25e8e905806485cdcc097bf58b18bada900000000 -Refund transaction (45c7c175f333981508229f6fa637410fbbf4f086b657035c07adda6a49207e03): -000000000188fee037e8275f7d1e8686886a12131933f481b48902859791d6f1df01496f3401000000bf4830450221009344b17316054eae5d293b34683177fa5e7c7ba9b0001ebb2b3deca83bef552e022067088b7342bed0155b2ccef69d97cd293faa687f589d2a351aa6e154953c0c65012103a3a9f2c0492a40b134363e82959fa6132b86e0969e0b25109beb53b1debc4324004c5163a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a914ebcf822c4a2cdb5f6a6b9c4a59b74d66461da5816704d728bd59b17576a91406fb26221375b1cbe2c17c14f1bc2510b9f8f8ff6888ac0000000001e7dff505000000001976a914f5261c9e58aaa9461923c3f78f8f12f0eec22ed388acd728bd59 +Refund transaction (1ae7c98ab417ba0de6cb677533df01ac65bb6389bd6eee4cab3f342a64a3f126): +0200000001b57d1ce0411777f1e6560056ed8af2d61ced0d365d61fa530fcf57eb8db1479e00000000ce473044022023df603da2c1f0a07ca0d54bff7d49bf8aac0145deaa44d3c6e301cff55dd8dc02206270f8df5aaf051b6489e87c86d1b6643ecea5e65e81b5918aa374ea9c6a8e5b012102df0cfe61b1a028cbca0c126477294a07cfde153b5ac89b2b0aba1d0fc584e8f9004c616382012088a82091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a9143641b9cac269f3f85b7c521f563dfc5eb49228a96704ba1b335db17576a914685ec9625a6084b9a287d7023857534a54e089516888ac0000000001675e0100000000001976a9143b76a395ecd840b3903119f52e43521d5013825c88acba1b335d Publish contract transaction? [y/N] y -Published contract transaction (346f4901dff1d69197850289b481f4331913126a8886861e7d5f27e837e0fe88) +Published contract transaction ("9e47b18deb57cf0f53fa615d360ded1cd6f28aed560056e6f1771741e01c7db5") ``` Once A has initialized the swap, B must audit the contract and contract @@ -272,16 +273,16 @@ transaction to verify: _Party B runs:_ ``` -$ btcatomicswap --testnet auditcontract 63a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a914ebcf822c4a2cdb5f6a6b9c4a59b74d66461da5816704d728bd59b17576a91406fb26221375b1cbe2c17c14f1bc2510b9f8f8ff6888ac 010000000267864c7145e43c84d13b514518cfdc7ca5cf2b04764ed2672caa9c8f6338a3e3010000006b483045022100901602e523f25e9659951d186eec7e8b9df9d194e8013fb6d7a05e4eafdbb61602207b66e0179a42c54d4fcfca2b1ccd89d56253cc83724593187713f6befb37866201210288ef714849ce7735b64ed886d056b80d0a384ca299090f684820d31e7682825afeffffff3ac58ce49bcef3d047ea80281659a78cd7ef8537ca2bfce336abdce41450d2d7000000006b483045022100bd1246fc18d26a9cc85c14fb60655da2f2e845af906504b8ba3acbb1b0ebf08202201ec2cd5a0c94e9e6b971ec3198be0ff57e91115342cd98ccece98d8b18294d86012103406e35c37b3b85481db7b7f7807315720dd6486c25e4f3af93d5d5f21e743881feffffff0248957e01000000001976a914c1925e7398d325820bba18726c387e9d80047ef588ac00e1f5050000000017a9142d913627b881255c417787cc255ccad9a33ce48d8700000000 -Contract address: 2MwQAMPeRGdCzFzPy7DmCnQudDVGNBFJK8S -Contract value: 1 BTC -Recipient address: n31og5QGuS28dmHpDH6PQD5wmVQ2K2spAG -Author's refund address: mg9sDLhfByfAWFo4zq3JZ7nsLfsN59XPue +$ ./btcatomicswap --testnet auditcontract 6382012088a82091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a9143641b9cac269f3f85b7c521f563dfc5eb49228a96704ba1b335db17576a914685ec9625a6084b9a287d7023857534a54e089516888ac 020000000001018e4a97368348a4561c5644a4263232d7c6d251489ea055631a04ab60f00afe7b0000000017160014f4e813007dd822942bc84a593e29ba81fa9b818cfeffffff02905f01000000000017a91490f97392e65b9395a55b574b1b448e155380ea4d876a2600000000000017a91498cf0bc7b56953b3cfb7b3c7270bff8c09247d4c870247304402205d10647e2eff1898d94adbb89a5e0aee15f1e1bea56a047e114ef5b8cb6a8dc202203240bf57659d75bdf5e446b1a71371a4747b3a7ecc532e9cd3a8306a473492a7012102b8a75060633a360d13a17e01e2f3c0e25e8e905806485cdcc097bf58b18bada900000000 +Contract address: 2N6Tn86gmckeQH4caubCoJF7DkGZuX7F8PP +Contract value: 0.0009 BTC +Recipient address: mkTqX7oLvzxjLFjsfpeRtLkKsyDwsekNDJ +Author's refund address: mq2p7txzWjjhaSqpcQaQwugCbbEUQk2mbQ -Secret hash: 29c36b8dd380e0426bdc1d834e74a630bfd5d111 +Secret hash: 91ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd2 -Locktime: 2017-09-16 13:36:23 +0000 UTC -Locktime reached in 47h56m54s +Locktime: 2019-07-20 13:48:42 +0000 UTC +Locktime reached in 47h54m42s ``` Auditing the contract also reveals the hash of the secret, which is needed for @@ -295,23 +296,23 @@ expires, but should be saved in case a refund is necessary. _Party B runs:_ ``` -$ dcratomicswap --testnet participate TsfWDVTAcsLaHUhHnLLKkGnZuJz2vkmM6Vr 1.0 29c36b8dd380e0426bdc1d834e74a630bfd5d111 -Passphrase: +$ ./dcratomicswap --testnet participate Tsjz12Auk15DCXiseXZTwAnk16dPKrfwNKs 0.5 91ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd2 +Passphrase: -Contract fee: 0.000251 DCR (0.00100400 DCR/kB) -Refund fee: 0.000301 DCR (0.00100669 DCR/kB) +Contract fee: 0.0000251 DCR (0.00010080 DCR/kB) +Refund fee: 0.000317 DCR (0.00100635 DCR/kB) -Contract (TcZpybEVDVTuoE3TCBxW3ui12YEZWrw5ccS): -63a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a9149ee19833332a04d2be97b5c99c970191221c070c6704e6dabb59b17576a914b0ec0640c89cf803b8fdbd6e0183c354f71748c46888ac +Contract (TctyvA4mDrTUANTKoaCmxu3K5e86RREiCPC): +6382012088c02091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a914d00355ba3824bf8361e4d6e17d9583cc4aef1c07670459cc315db17576a914eb1b8b80600edcaebe186cbcbd028ae77cafd51f6888ac -Contract transaction (a51a7ebc178731016f897684e8e6fbbd65798a84d0a0bd78fe2b53b8384fd918): -010000000137afc6c25b027cb0a1db19a7aac365854796260c4c1077e3e8accae5e4c300e90300000001ffffffff02441455980100000000001976a9144d7c96b6d2360e48a07528332e537d81e068f8ba88ac00e1f50500000000000017a914195fb53333e61a415e9fda21bb991b38b5a4e1c387000000000000000001ffffffffffffffff00000000ffffffff6b483045022100b30971448c93be84c28b98ae159963e9521a84d0c3849821b6e8897d59cf4e6c0220228785cb8d1dba40752e4bd09d99b92b27bc3837b1c547f8b4ee8aba1dfec9310121035a12a086ecd1397f7f68146f4f251253b7c0092e167a1c92ff9e89cf96c68b5f +Contract transaction (5615b8804a5a55c8c2f980b234632ed34c4cacd059fa5049c050106a9ce7c829): +01000000018a0de13d9d1b64e9b90299d60a27cd0b2bfe7d21e699d3d05803a309554bebac0000000000ffffffff023dac532d0200000000001976a914c9cceaa10fb5311db1837d91f731784380fcb40488ac80f0fa0200000000000017a914eb7af990b1a30518bf5001a9cd44f101ab180e7e870000000000000000018ba64e300200000000000000ffffffff6a47304402207a84361dedad66a0183fb18b2b6a20df66aaf8691464ff15e47905e77e759cf102205254e5d7217b58afdd61382cf8cef4a0dfc87b8b567fa349a7a831e5325391cf01210285d70911132d1e59a18944fde6e37462e895d4b52f3cabed1396328292c3ab1c -Refund transaction (836288fa26bbce52342c8569ca4e0db7dec81b2187eb453c1fd5c5d06838f60a): -000000000118d94f38b8532bfe78bda0d0848a7965bdfbe6e88476896f01318717bc7e1aa5010000000000000000016c6bf5050000000000001976a9140b4dae42b84dbad7b7e35f61602cb6a2393f0ae088ace6dabb590000000001ffffffffffffffff00000000ffffffffbe47304402201bd55803eae6de4ea19c618060f82c38e9ca04047c346dc7025f54d8276f13f602205cdf104db74563559e570f186cbc68549d623618b96c7ec971d1a996dab78fbd01210244e4e75a9318ac06656d145c3d3205b2f4f25615698f458e80233c4bb78c91ac004c5163a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a9149ee19833332a04d2be97b5c99c970191221c070c6704e6dabb59b17576a914b0ec0640c89cf803b8fdbd6e0183c354f71748c46888ac +Refund transaction (a95dbe50f41b492b2051a1bead9f0b577d8ed99bd5ab72d9a3f23847d04bc6e9): +010000000129c8e79c6a1050c04950fa59d0ac4c4cd32e6334b280f9c2c8555a4a80b8155601000000000000000001ac74fa020000000000001976a914363dc8adb0786bf38b10916a56d4c690640c1eac88ac59cc315d0000000001000000000000000000000000ffffffffce4730440220725470675bd54c4a9756c1fc0b6417a91943f0bbea8f9c5286e5cc1153cc2acd02207b12b2714549aef9d35b0b268f1917222f842fd23a0bafa96914b378ac285f1701210389ec97a79b17f6dd48fbd7e7bfe19fb9609b363b0e18b65bcde26e53046478b2004c616382012088c02091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a914d00355ba3824bf8361e4d6e17d9583cc4aef1c07670459cc315db17576a914eb1b8b80600edcaebe186cbcbd028ae77cafd51f6888ac Publish contract transaction? [y/N] y -Published contract transaction (a51a7ebc178731016f897684e8e6fbbd65798a84d0a0bd78fe2b53b8384fd918) +Published contract transaction (5615b8804a5a55c8c2f980b234632ed34c4cacd059fa5049c050106a9ce7c829) ``` B now informs A that the Decred contract transaction has been created and @@ -328,16 +329,16 @@ audits the contract and contract transaction to verify: _Party A runs:_ ``` -$ dcratomicswap --testnet auditcontract 63a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a9149ee19833332a04d2be97b5c99c970191221c070c6704e6dabb59b17576a914b0ec0640c89cf803b8fdbd6e0183c354f71748c46888ac 010000000137afc6c25b027cb0a1db19a7aac365854796260c4c1077e3e8accae5e4c300e90300000001ffffffff02441455980100000000001976a9144d7c96b6d2360e48a07528332e537d81e068f8ba88ac00e1f50500000000000017a914195fb53333e61a415e9fda21bb991b38b5a4e1c387000000000000000001ffffffffffffffff00000000ffffffff6b483045022100b30971448c93be84c28b98ae159963e9521a84d0c3849821b6e8897d59cf4e6c0220228785cb8d1dba40752e4bd09d99b92b27bc3837b1c547f8b4ee8aba1dfec9310121035a12a086ecd1397f7f68146f4f251253b7c0092e167a1c92ff9e89cf96c68b5f -Contract address: TcZpybEVDVTuoE3TCBxW3ui12YEZWrw5ccS -Contract value: 1 DCR -Recipient address: TsfWDVTAcsLaHUhHnLLKkGnZuJz2vkmM6Vr -Author's refund address: Tsh9c9aytRaDcbLLxDRcQDRx66aXATh28R3 +$ ./dcratomicswap --testnet auditcontract 6382012088c02091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a914d00355ba3824bf8361e4d6e17d9583cc4aef1c07670459cc315db17576a914eb1b8b80600edcaebe186cbcbd028ae77cafd51f6888ac 01000000018a0de13d9d1b64e9b90299d60a27cd0b2bfe7d21e699d3d05803a309554bebac0000000000ffffffff023dac532d0200000000001976a914c9cceaa10fb5311db1837d91f731784380fcb40488ac80f0fa0200000000000017a914eb7af990b1a30518bf5001a9cd44f101ab180e7e870000000000000000018ba64e300200000000000000ffffffff6a47304402207a84361dedad66a0183fb18b2b6a20df66aaf8691464ff15e47905e77e759cf102205254e5d7217b58afdd61382cf8cef4a0dfc87b8b567fa349a7a831e5325391cf01210285d70911132d1e59a18944fde6e37462e895d4b52f3cabed1396328292c3ab1c +Contract address: TctyvA4mDrTUANTKoaCmxu3K5e86RREiCPC +Contract value: 0.5 DCR +Recipient address: Tsjz12Auk15DCXiseXZTwAnk16dPKrfwNKs +Author's refund address: TsnTGGVg5LoRV3tynLPshrXVNNVXF6mTZHi -Secret hash: 29c36b8dd380e0426bdc1d834e74a630bfd5d111 +Secret hash: 91ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd2 -Locktime: 2017-09-15 13:51:34 +0000 UTC -Locktime reached in 23h58m10s +Locktime: 2019-07-19 13:57:45 +0000 UTC +Locktime reached in 23h52m45s ``` Now that both parties have paid into their respective contracts, A may withdraw @@ -346,16 +347,16 @@ reveals the secret to B, allowing B to withdraw from the Bitcoin contract. _Party A runs:_ ``` -$ dcratomicswap --testnet redeem 63a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a9149ee19833332a04d2be97b5c99c970191221c070c6704e6dabb59b17576a914b0ec0640c89cf803b8fdbd6e0183c354f71748c46888ac 010000000137afc6c25b027cb0a1db19a7aac365854796260c4c1077e3e8accae5e4c300e90300000001ffffffff02441455980100000000001976a9144d7c96b6d2360e48a07528332e537d81e068f8ba88ac00e1f50500000000000017a914195fb53333e61a415e9fda21bb991b38b5a4e1c387000000000000000001ffffffffffffffff00000000ffffffff6b483045022100b30971448c93be84c28b98ae159963e9521a84d0c3849821b6e8897d59cf4e6c0220228785cb8d1dba40752e4bd09d99b92b27bc3837b1c547f8b4ee8aba1dfec9310121035a12a086ecd1397f7f68146f4f251253b7c0092e167a1c92ff9e89cf96c68b5f 3e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16 -Passphrase: +$ ./dcratomicswap --testnet redeem 6382012088c02091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a914d00355ba3824bf8361e4d6e17d9583cc4aef1c07670459cc315db17576a914eb1b8b80600edcaebe186cbcbd028ae77cafd51f6888ac 01000000018a0de13d9d1b64e9b90299d60a27cd0b2bfe7d21e699d3d05803a309554bebac0000000000ffffffff023dac532d0200000000001976a914c9cceaa10fb5311db1837d91f731784380fcb40488ac80f0fa0200000000000017a914eb7af990b1a30518bf5001a9cd44f101ab180e7e870000000000000000018ba64e300200000000000000ffffffff6a47304402207a84361dedad66a0183fb18b2b6a20df66aaf8691464ff15e47905e77e759cf102205254e5d7217b58afdd61382cf8cef4a0dfc87b8b567fa349a7a831e5325391cf01210285d70911132d1e59a18944fde6e37462e895d4b52f3cabed1396328292c3ab1c 901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd +Passphrase: -Redeem fee: 0.000334 DCR (0.00100300 DCR/kB) +Redeem fee: 0.00035 DCR (0.00100575 DCR/kB) -Redeem transaction (53c2e8bafb8fe36d54bbb1884141a39ea4da83db30bdf3c98ef420cdb332b0e7): -000000000118d94f38b8532bfe78bda0d0848a7965bdfbe6e88476896f01318717bc7e1aa50100000000ffffffff01885ef5050000000000001976a9149551ab760ba64b7e573f54d34c53506676e8145888ace6dabb590000000001ffffffffffffffff00000000ffffffffe0483045022100a1a3b37a67f3ed5d6445a0312e825299b54d91a09e0d1b59b5c0a8baa7c0642102201a0d53e9efe7db8dc47210b446fde6425be82761252ff0ebe620efc183788d86012103395a4a3c8c96ef5e5af6fd80ae42486b5d3d860bf3b41dafc415354de8c7ad80203e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16514c5163a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a9149ee19833332a04d2be97b5c99c970191221c070c6704e6dabb59b17576a914b0ec0640c89cf803b8fdbd6e0183c354f71748c46888ac +Redeem transaction (e4d8e8a3e00935c44e38d5e839045d1cb6f42593dc8df784014e306c571fd67f): +010000000129c8e79c6a1050c04950fa59d0ac4c4cd32e6334b280f9c2c8555a4a80b815560100000000ffffffff01c867fa020000000000001976a914363dc8adb0786bf38b10916a56d4c690640c1eac88ac59cc315d0000000001000000000000000000000000ffffffffef47304402205781a15053e967653b755cb31b4583ee8fbe23933e28e827a30196b7464c66f7022021287de9db57aaa7c7f800e16c33aae23bc5f9e1f52cc118b4d8207529d3938d0121028e1d1ad6e9bd99cdba8407e7ecde9ce66ff3b1c7dc01814e50f94ac69a9be9c420901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd514c616382012088c02091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a914d00355ba3824bf8361e4d6e17d9583cc4aef1c07670459cc315db17576a914eb1b8b80600edcaebe186cbcbd028ae77cafd51f6888ac Publish redeem transaction? [y/N] y -Published redeem transaction (53c2e8bafb8fe36d54bbb1884141a39ea4da83db30bdf3c98ef420cdb332b0e7) +Published redeem transaction (e4d8e8a3e00935c44e38d5e839045d1cb6f42593dc8df784014e306c571fd67f) ``` Now that A has withdrawn from the Decred contract and revealed the secret, B @@ -365,22 +366,22 @@ redeeming transaction. _Party B runs:_ ``` -$ dcratomicswap --testnet extractsecret 000000000118d94f38b8532bfe78bda0d0848a7965bdfbe6e88476896f01318717bc7e1aa50100000000ffffffff01885ef5050000000000001976a9149551ab760ba64b7e573f54d34c53506676e8145888ace6dabb590000000001ffffffffffffffff00000000ffffffffe0483045022100a1a3b37a67f3ed5d6445a0312e825299b54d91a09e0d1b59b5c0a8baa7c0642102201a0d53e9efe7db8dc47210b446fde6425be82761252ff0ebe620efc183788d86012103395a4a3c8c96ef5e5af6fd80ae42486b5d3d860bf3b41dafc415354de8c7ad80203e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16514c5163a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a9149ee19833332a04d2be97b5c99c970191221c070c6704e6dabb59b17576a914b0ec0640c89cf803b8fdbd6e0183c354f71748c46888ac 29c36b8dd380e0426bdc1d834e74a630bfd5d111 -Secret: 3e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16 +$ ./dcratomicswap --testnet extractsecret 010000000129c8e79c6a1050c04950fa59d0ac4c4cd32e6334b280f9c2c8555a4a80b815560100000000ffffffff01c867fa020000000000001976a914363dc8adb0786bf38b10916a56d4c690640c1eac88ac59cc315d0000000001000000000000000000000000ffffffffef47304402205781a15053e967653b755cb31b4583ee8fbe23933e28e827a30196b7464c66f7022021287de9db57aaa7c7f800e16c33aae23bc5f9e1f52cc118b4d8207529d3938d0121028e1d1ad6e9bd99cdba8407e7ecde9ce66ff3b1c7dc01814e50f94ac69a9be9c420901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd514c616382012088c02091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a914d00355ba3824bf8361e4d6e17d9583cc4aef1c07670459cc315db17576a914eb1b8b80600edcaebe186cbcbd028ae77cafd51f6888ac 91ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd2 +Secret: 901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd ``` With the secret known, B may redeem from A's Bitcoin contract. _Party B runs:_ ``` -$ btcatomicswap --testnet --rpcuser=user --rpcpass=pass redeem 63a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a914ebcf822c4a2cdb5f6a6b9c4a59b74d66461da5816704d728bd59b17576a91406fb26221375b1cbe2c17c14f1bc2510b9f8f8ff6888ac 010000000267864c7145e43c84d13b514518cfdc7ca5cf2b04764ed2672caa9c8f6338a3e3010000006b483045022100901602e523f25e9659951d186eec7e8b9df9d194e8013fb6d7a05e4eafdbb61602207b66e0179a42c54d4fcfca2b1ccd89d56253cc83724593187713f6befb37866201210288ef714849ce7735b64ed886d056b80d0a384ca299090f684820d31e7682825afeffffff3ac58ce49bcef3d047ea80281659a78cd7ef8537ca2bfce336abdce41450d2d7000000006b483045022100bd1246fc18d26a9cc85c14fb60655da2f2e845af906504b8ba3acbb1b0ebf08202201ec2cd5a0c94e9e6b971ec3198be0ff57e91115342cd98ccece98d8b18294d86012103406e35c37b3b85481db7b7f7807315720dd6486c25e4f3af93d5d5f21e743881feffffff0248957e01000000001976a914c1925e7398d325820bba18726c387e9d80047ef588ac00e1f5050000000017a9142d913627b881255c417787cc255ccad9a33ce48d8700000000 3e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16 -Redeem fee: 0.00000314 BTC (0.00001016 BTC/kB) +$ ./btcatomicswap --testnet --rpcuser=user --rpcpass=AtomicSwap1234 redeem 6382012088a82091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a9143641b9cac269f3f85b7c521f563dfc5eb49228a96704ba1b335db17576a914685ec9625a6084b9a287d7023857534a54e089516888ac 020000000001018e4a97368348a4561c5644a4263232d7c6d251489ea055631a04ab60f00afe7b0000000017160014f4e813007dd822942bc84a593e29ba81fa9b818cfeffffff02905f01000000000017a91490f97392e65b9395a55b574b1b448e155380ea4d876a2600000000000017a91498cf0bc7b56953b3cfb7b3c7270bff8c09247d4c870247304402205d10647e2eff1898d94adbb89a5e0aee15f1e1bea56a047e114ef5b8cb6a8dc202203240bf57659d75bdf5e446b1a71371a4747b3a7ecc532e9cd3a8306a473492a7012102b8a75060633a360d13a17e01e2f3c0e25e8e905806485cdcc097bf58b18bada900000000 901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd +Redeem fee: 0.0000033 BTC (0.00001019 BTC/kB) -Redeem transaction (c49e6fd0057b601dbb8856ad7b3fcb45df626696772f6901482b08df0333e5a0): -000000000188fee037e8275f7d1e8686886a12131933f481b48902859791d6f1df01496f3401000000e0483045022100f43430384ca5ecfc9ca31dd074d223836cef4801b3644c651c3a30d80fbf63b8022017dae9e7ec6f3f5ee0e0b60d146963ba85d9b31003d7f60852126f2a35492759012103b10e3690bcaf0eae7098ec794666963803bcec5acfbe6a112bc8cdc93797f002203e0b064c97247732a3b345ce7b2a835d928623cb2871c26db4c2539a38e61a16514c5163a61429c36b8dd380e0426bdc1d834e74a630bfd5d1118876a914ebcf822c4a2cdb5f6a6b9c4a59b74d66461da5816704d728bd59b17576a91406fb26221375b1cbe2c17c14f1bc2510b9f8f8ff6888acffffffff01c6dff505000000001976a914e1fce397007bad3ce051f0b1c3c7587f016cd76a88acd728bd59 +Redeem transaction (ba5818e498abacb99dd57493412d69722fe2dfc324af0d9ad1c28c120f4536d5): +0200000001b57d1ce0411777f1e6560056ed8af2d61ced0d365d61fa530fcf57eb8db1479e00000000ef473044022002cba28f2f9803abbbbcbb71790ed3290d999c6845c2f9a391eb0a82ac30483e02202314afc132e2a4847b106a725bd5f5d8e11a6eaedf97ac57b2ad97922fbcb65101210223c6fe322a154ea5246d7c588e42e212ef6c15ad9a2cc204bf9b3fcb97e6026820901c0c51c24d129265f25fc7af367a52a7906ce93d8105372c338232a49062fd514c616382012088a82091ab5f9e63c000fa3a0f761d10267437229631cc3c50ba3861aea3172f8dedd28876a9143641b9cac269f3f85b7c521f563dfc5eb49228a96704ba1b335db17576a914685ec9625a6084b9a287d7023857534a54e089516888acffffffff01465e0100000000001976a914a75882cf5daebe1652665d338d03691cedfede7288acba1b335d Publish redeem transaction? [y/N] y -Published redeem transaction (c49e6fd0057b601dbb8856ad7b3fcb45df626696772f6901482b08df0333e5a0) +Published redeem transaction ("ba5818e498abacb99dd57493412d69722fe2dfc324af0d9ad1c28c120f4536d5") ``` The cross-chain atomic swap is now completed and successful. This example was @@ -389,10 +390,10 @@ here are the four transactions involved: | Description | Transaction | | - | - | -| Bitcoin contract created by A | [346f4901dff1d69197850289b481f4331913126a8886861e7d5f27e837e0fe88](https://www.blocktrail.com/tBTC/tx/346f4901dff1d69197850289b481f4331913126a8886861e7d5f27e837e0fe88) | -| Decred contract created by B | [a51a7ebc178731016f897684e8e6fbbd65798a84d0a0bd78fe2b53b8384fd918](https://testnet.decred.org/tx/a51a7ebc178731016f897684e8e6fbbd65798a84d0a0bd78fe2b53b8384fd918) | -| A's Decred redemption | [53c2e8bafb8fe36d54bbb1884141a39ea4da83db30bdf3c98ef420cdb332b0e7](https://testnet.decred.org/tx/53c2e8bafb8fe36d54bbb1884141a39ea4da83db30bdf3c98ef420cdb332b0e7) | -| B's Bitcoin redemption | [c49e6fd0057b601dbb8856ad7b3fcb45df626696772f6901482b08df0333e5a0](https://www.blocktrail.com/tBTC/tx/c49e6fd0057b601dbb8856ad7b3fcb45df626696772f6901482b08df0333e5a0) | +| Bitcoin contract created by A | [9e47b18deb57cf0f53fa615d360ded1cd6f28aed560056e6f1771741e01c7db5](https://www.blockstream.info/testnet/tx/9e47b18deb57cf0f53fa615d360ded1cd6f28aed560056e6f1771741e01c7db5) | +| Decred contract created by B | [5615b8804a5a55c8c2f980b234632ed34c4cacd059fa5049c050106a9ce7c829](https://testnet.decred.org/tx/5615b8804a5a55c8c2f980b234632ed34c4cacd059fa5049c050106a9ce7c829) | +| A's Decred redemption | [e4d8e8a3e00935c44e38d5e839045d1cb6f42593dc8df784014e306c571fd67f](https://testnet.decred.org/tx/e4d8e8a3e00935c44e38d5e839045d1cb6f42593dc8df784014e306c571fd67f) | +| B's Bitcoin redemption | [ba5818e498abacb99dd57493412d69722fe2dfc324af0d9ad1c28c120f4536d5](https://www.blockstream.info/testnet/tx/c49e6fd0057b601dbb8856ad7b3fcb45df626696772f6901482b08df0333e5a0) | If at any point either party attempts to fraud (e.g. creating an invalid contract, not revealing the secret and refunding, etc.) both parties have the @@ -420,10 +421,10 @@ links to the four raw transactions published in the example: | Description | Link to raw transaction | | - | - | -| Bitcoin contract created by A | https://test-insight.bitpay.com/api/rawtx/346f4901dff1d69197850289b481f4331913126a8886861e7d5f27e837e0fe88 | -| Decred contract created by B | https://testnet.decred.org/api/rawtx/a51a7ebc178731016f897684e8e6fbbd65798a84d0a0bd78fe2b53b8384fd918 | -| A's Decred redemption | https://testnet.decred.org/api/rawtx/53c2e8bafb8fe36d54bbb1884141a39ea4da83db30bdf3c98ef420cdb332b0e7 | -| B's Bitcoin redemption | https://test-insight.bitpay.com/api/rawtx/c49e6fd0057b601dbb8856ad7b3fcb45df626696772f6901482b08df0333e5a0 | +| Bitcoin contract created by A | https://test-insight.bitpay.com/api/rawtx/9e47b18deb57cf0f53fa615d360ded1cd6f28aed560056e6f1771741e01c7db5 | +| Decred contract created by B | https://testnet.decred.org/api/tx/decoded/5615b8804a5a55c8c2f980b234632ed34c4cacd059fa5049c050106a9ce7c829?indent=true | +| A's Decred redemption | https://testnet.decred.org/api/tx/decoded/e4d8e8a3e00935c44e38d5e839045d1cb6f42593dc8df784014e306c571fd67f?indent=true | +| B's Bitcoin redemption | https://test-insight.bitpay.com/api/rawtx/ba5818e498abacb99dd57493412d69722fe2dfc324af0d9ad1c28c120f4536d5 | ## First mainnet DCR-LTC atomic swap diff --git a/cmd/btcatomicswap/btcatomicswap b/cmd/btcatomicswap/btcatomicswap new file mode 100755 index 0000000..39cabf9 Binary files /dev/null and b/cmd/btcatomicswap/btcatomicswap differ diff --git a/cmd/dcratomicswap/dcratomicswap b/cmd/dcratomicswap/dcratomicswap new file mode 100755 index 0000000..6bac5be Binary files /dev/null and b/cmd/dcratomicswap/dcratomicswap differ