decred/atomicswap

What if A doesn't reveal contract after redeeming the transaction?

pranay01 opened this issue · 6 comments

In the example given in the README, once A has redeemed - he need to publish the redemption transaction so that B can extract secret and redeem her contract. What if A doesn't publish the redemption transaction? I am guessing that B then can't redeem her contract. What is the recourse for B in this scenario?

B can watch the blockchain associated with A in order to extract the secret themselves. That is the entire point of tying the withdrawal to a shared hash. In order for A to redeem they must reveal the secret. The act of revealing that secret allows B to redeem.

So, you mean that the transaction is only effected only when it is published on the blockchain. I was thinking that publishing is sharing of the transaction through some private channel. If the transaction is easily obtainable from blockchain, what is the need for a side channel (to share text messages) as mentioned in the README? Is it only to share the initial addresses of the parties?

It's an optimization for the case when the parties are cooperating, as will be the case in the vast majority of instances. Rather than having to wait for the transaction in question to show up on the other chain, it reveals the secret immediately which allows the counterparty to more quickly initiate their redemption.

Also, the current tooling does not automatically watch the blockchain for the other transaction, which means you, as the user need to do so manually. That is what the Discovering raw transactions section describes.

Got it. So this can work even without a side channel, right?

jrick commented

The side channel is required to send the contract for auditing. The transaction that pays into the contract uses a P2SH output script and without the actual contract itself (which isn't publicly revealed until the contract tx is redeemed or refunded) it would be impossible to determine whether the P2SH payment is correct.

jrick commented

Please reopen or join us on one of our chat rooms (https://decred.org/community/) if you have any more questions regarding this.