decred / atomicswap

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

btcatomicswap auditcontract from output address (redeem address) #81

Closed konceptzer0 closed 6 years ago

konceptzer0 commented 6 years ago

The btcatomicswap utility takes in a contract and contract transaction as the arguments in a format of long hexstrings.

Example: btcatomicswap --testnet auditcontract 6382012088a820dca04d3bb2332d9441964798c846d00d892d8d7dcf8a0cd02ede232dcf12a0298876a9141205a71bca338c827ab7e983fa877d0df4ea068e670423b8065bb17576a914d4cad03b36abd5e2e890dce6d7902abba06d28dc6888ac 020000000001019f3388b5ab5853b0c456e0da1391f5f5c476495e9d4f58c31f760481f52e8f1e0000000017160014504058af6af2ead87d4e347f51ec09263f7f2bfbfeffffff02a08601000000000017a914c1adc9411f7b87353459b2f2b4d2c5fcccb4528e878850f6000000000017a914c7068e75c1e873181d66e538ad5e9b779294be748702473044022024c94c68e6a8bb35bfa74a1563e148bfb751dc52d7cde2853c67d6b82e26aa79022068ee09f68d36ca53507a85fa0ab4b7067db60a5839bc2996a089e23d3bfce1b90121028e7966a869b77aa7da4254779317ce8a4ac5c824c605fea2aec0aaa814e8250b00000000

For an automation of atomicswaps we are implementing we'd like to be able to perform an audit given a simple output address, that we can find in a confirmed contract transaction via block explorer.

Example: btcatomicswap --testnet auditcontract 2N1y1Jh5pv7uY5atXYpvV4quqLZuFkjJ37C

jrick commented 6 years ago

Sorry, but we're not going to make external calls to a block explorer from these tools. They will only integrate with your wallet. Your suggestion also leaves an ambiguity as there can be many transactions that all pay to the same contract address.

jrick commented 6 years ago

In addition, the address alone, even with a specific transaction paying to the contract, is not capable of being audited. The address is P2SH and auditing the contract requires the actual nested script. The address does not contain this script, it only contains a hash.

konceptzer0 commented 6 years ago

Okay. How would I go about making sure that what I audited with this tool matches a mined transaction on the blockchain?

jrick commented 6 years ago

That responsibility is on you. You pick where the data comes from (your own full node would be the most secure) and simply feed it to the tool to check.