scriptsig – Can I show a double spend try with a signed tx with identical enter?


I’m designing an cross-chain atomic swap in a customized blockchain – Protoblock. I believe it may be carried out so long as Protoblock is aware of the best way to parse p2pkh bitcoin transactions. The important half is with the ability to “reverse” issues when it sees a double spend.

  • Alice has 1 Bitcoin
  • Bob has 100 Fantasybit
  • Alice will swap 1 BTC for Bobs 100 FB

Step1) Bob indicators a Protoblock “Swap” transaction(TX1a) that incorporates an unsigned bitcoin transaction(TX1b) that will need to have 1. a ScriptSig enter with p2pkh from Alice(bitcoin-address) and a couple of. a p2pkh output to Bob(bitcoin-address)

Step2) 100 FB of Bobs is locked for twenty-four hours or till…

Step3) a Protoblock transaction(TX2a) is seen that incorporates the signature for TX1b and TXID(TX1a)

Step4) 100 FB is transferred to Alice and is locked for twenty-four hours or till…

Step5) a Protoblock transaction(TX3a) is seen that incorporates a signed bitcoin transaction(TX2b) that has 1. the identical ScriptSig enter(s) with p2pkh from Alice(bitcoin-address) as TX1b and a couple of. an output that’s NOT a p2pkh output to bob(bitcoin-address)

Step6) 100 FB is distributed again to Bob, the identical state as earlier than Step1

The rationale for Step5 is that, a signed bitcoin transaction will not be sufficient to show that Bob acquired the bitcoin from Alice, as a result of Alice may simply signal the transaction, however not spend it to bitcoin, and simply double spend it.

Nevertheless, Bob will see that Alice spent the enter and can create TX3a that provides him again his 100 Fantasybit. Actually, anybody could be watching bitcoin and create TX3a as a service for Bob.

Query: is there a method that Alice can spend the identical inputs from TX1b, that might be undetectable with above algo?

Be aware: the bitcoin transaction with the outputs for the TX1b inputs, might be created by the pockets software program doing the atomic swap. So Alice will first need to ship her 1 Bitcoin to herself to verify its a easy p2pkh. Right here is the Protoblock code that creates the p2pkh outputs and bitcoin tx:–skillSale/blob/4e59f50b7555527046804418d6483b0df1933637/share/fantasybit-core/FantasyAgent.cpp#L444–skillSale/blob/4e59f50b7555527046804418d6483b0df1933637/share/fantasybit-core/FantasyAgent.cpp#L525

Supply hyperlink

Leave a reply