Skip to content

Instantly share code, notes, and snippets.

@mslipper
Last active November 15, 2018 21:53
Show Gist options
  • Save mslipper/627d2141eb18b51014da4faf4795eeb0 to your computer and use it in GitHub Desktop.
Save mslipper/627d2141eb18b51014da4faf4795eeb0 to your computer and use it in GitHub Desktop.
Stack Description
OP_TRUE
0xfeedface
0x0363e177...5e09c943
Start
0xfeedface
0x0363e177...5e09c943
OP_IF pops OP_TRUE off the stack. This is used to determine whether we're redeeming the HTLC or attempting to recover funds after a timeout.
0x3684d458...14877709
0x0363e177...5e09c943
OP_SHA256 pops the preimage off the stack and places its SHA256 hash onto the top of the stack.
0x0363e177...5e09c943 OP_EQUALVERIFY pops the hash off the stack and compares it to the digest inside the transaction. OP_EQUALVERIFY allows transaction execution to continue since the digests are equal.
0x0363e177...5e09c943
0x0363e177...5e09c943
OP_DUP duplicates the top item on the stack, which in this case is the seller's public key.
0xfa88b8dd...7be47a33
0xfa88b8dd...7be47a33
0x0363e177...5e09c943
OP_HASH160 hashes the top stack item and places the hash onto the top of the stack. <seller pubkey hash> is also placed onto the top of the stack.
0x0363e177...5e09c943 OP_EQUALVERIFY (after OP_ENDIF) verifies the equality of the public key hashes. This is done to make sure that only the correct party can execute each branch of the OP_IF statement.
OP_TRUE OP_CHECKSIG verifies that the transaction signature matches the provided public key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment