Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hashed Timelock Contract (HTLC) as proposed in lightning.network paper
OP_DEPTH 3 OP_EQUAL
OP_IF
OP_HASH160 <hash160(R)> OP_EQUALVERIFY
OP_0 2 <AlicePubkey1> <BobPubkey1> 2 OP_CHECKMULTISIG
OP_ELSE
OP_0 2 <AlicePubkey2> <BobPubkey2> 2 OP_CHECKMULTISIG
OP_END
OP_IF
OP_HASH160 <hash160(R)> OP_EQUALVERIFY
OP_0 2 <AlicePubkey1> <BobPubkey1>
OP_ELSE
OP_0 2 <AlicePubkey2> <BobPubkey2>
OP_END
2 OP_CHECKMULTISIG
@maraoz

This comment has been minimized.

Show comment
Hide comment
@maraoz

maraoz Jul 9, 2015

  • OP_DEPTH 3 OP_EQUAL is not needed as party spending the script can include a 0 or 1 in the scriptSig to choose to enter through if or else branch.
  • 2 OP_CHECKMULTISIG was factored out of the OP_IF
Owner

maraoz commented Jul 9, 2015

  • OP_DEPTH 3 OP_EQUAL is not needed as party spending the script can include a 0 or 1 in the scriptSig to choose to enter through if or else branch.
  • 2 OP_CHECKMULTISIG was factored out of the OP_IF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment