Implement atomic swaps on Bitcoin using scripts for initiate, redeem, refund, and instant refund operations
Create transaction
Set script conditions
OP_SHA256
consumes the secret and produces its hash (proves knowledge of preimage)OP_EQUALVERIFY
is critical — it fails immediately if the hashes don’t matchOP_CHECKSEQUENCEVERIFY
verifies that enough time has passed (relative to when UTXO was created).OP_DROP
is needed to remove it.OP_CHECKSIGADD
:It consumes three stack elements:OP_NUMEQUAL
with 2 ensures both signatures must be validOP_CHECKSIGADD
operation provides efficient multi-signature verification using Tapscript’s enhanced capabilities.