Skip to content

Instantly share code, notes, and snippets.

@maraoz maraoz/Original version
Last active Oct 5, 2016

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.

Copy link
Owner Author

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
@btcdrak

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.