Bob writes a transaction that pays into some kind of escrow (TxA). Before announcing the transaction (or taking some other irreversible action, like a reveal) Bob asks Alice to sign a locked refund of that transaction (TxB). Alice signs the locked refund, and then Bob announces the escrow payment (or begins the non-reversible action).
Before the escrow payment confirms, however, Alice announces a (or one of the many other permissible mutations). This changes the TXID. Alice may also have some helpful miners that have agreed to mine the mutant, though this isn't essential.
If TxA' gets mined instead of TxA then TxB will be invalid and so no refund exists.
I think iddo made a mistake in his his write up in presuming the TxA is privately communicated to Bob. That is not the case: Bob must wait until he sees TxA arrive the broadcast channel before revealing B (simultaneously with cashing Alices $1 bet) to start the game.
In the protocol here, you could refuse to reveal until TxA is confirmed.
Correct, and thats what the protocol requires (though I think iddo's variant does not).
But if Bob broadcasts TxA without a refund already existing, Alice can just walk away and leave bob stuck at that point. "HaHa"
No the protocol is that it happens in this sequence: 0. player A gives player B A2=H(A1), 1. $2 TxB bet broadcast, 2. $1 TxA play broadcast, 3. player B cashes TxA simultaneously revealing B1, 4. player A if she won (a+b<=2 && a xor b) can now cash TxB which relies on revealing A1, 5. player A if she lost should still reveal A1 to Bob so he can cancel early without waiting for the time lock.
Refer to
https://bitcointalk.org/index.php?topic=277048.20There is no extortion attack. Mutating TxA or TxB also does not allow any reneging, nor extortion beyond the normal race or 51% attacks that apply to all bitcoin transactions.
I know this fair bet is a long running problem which have not quite worked because in most variants the loser has to do some thing active to admit he lost, and so he can hostile abort. But I think I have all eventualities covered via the pay conditional 2x first trick as it reverses the burden so only the winner has to do something active. Take a look tell me if you see a flaw.
Alice and Bob need to connect to the network using ToR if they are doing 0-commitment games or using some other mechanism to be assured that the other player is not controlling their network or racing them to gain an edge. (eg maintain connections to a sufficiently large number of large miners to see if they received the transaction).
Note with the introduction of LOCK(txid) I described earlier in this thread I believe you could make this game such that even a successful race/network attack can not take your bet without starting the game, because it would make the bet transactions atomic with each other. But they could still play normally, but try to abort if they lost by network attack (as described above - try to ensure only you get the payment).
mutant version of TxA, TxA' which is TxA but it has the S value in the ECDSA signature replaced by S - secp256k1_order
quibble you mean n-s; s-n would be negative, and ECDSA signature verification is defined to verify r and s are in [1,n-1]. (And n-s works because r=[-kG]x = [kG]x ie the x coordinate is the same for k and -k because of the x-axis symmetry of elliptic curves, and s = k^-1(H(m)+rd) where d is the private scalar from Q=dG, and (-k)^-1 = -k^-1, so hence swapping s for -s, -s = n-s.
Adam