Skip to content

Instantly share code, notes, and snippets.

@maraoz
Last active October 5, 2016 13:25
Show Gist options
  • Save maraoz/d781393c0bd5b9f70c1f to your computer and use it in GitHub Desktop.
Save maraoz/d781393c0bd5b9f70c1f to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment