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

OP_SHA256 #40

Closed jrick closed 6 years ago

jrick commented 6 years ago

Now that the new OP_SHA256 rules have been activated in Decred, all of the atomic swap tools should switch over to this more secure hash function. They are currently using OP_RIPEMD160 due to the sha256 opcode not having been available in the Decred scripting vm.

Before this can be completed, all of the txscript packages must be updated to recognize the OP_SHA256 version of the atomic swap contract:

@dasource @metalicjames heads up, I'll be creating some PRs for your projects for this change.

DesWurstes commented 6 years ago

TODO: After the required pull requests are merged, it needs dep ensure -update

devwarrior777 commented 6 years ago

Hi, Is it just the one vendor change in txscript/standard.go please? //gf:future-> // pops[1].opcode.value == OP_SHA256 && // pops[2].opcode.value == OP_DATA_32 && pops[1].opcode.value == OP_RIPEMD160 && pops[2].opcode.value == OP_DATA_20 && //<-gf ...

Thanks

jrick commented 6 years ago

The links in the issue description contain the diffs for the vendored changes. In addition to these changes, the atomicswap tools themselves must also be updated to create contract scripts using SHA256-hashed secrets.

metalicjames commented 6 years ago

@jrick Apologies for the delay, I must've missed the notification for your pull request into vtcd. Merged now.