4

From this article, I can understand that a punishment-based bidirectional payment channel (the type used by Lightning) would contain roughly this bitcoin script as one of the outputs:

OP_IF
“+7 days” OP_CHECKSEQUENCEVERIFY OP_DROP
<Bob pubkey> OP_CHECKSIG
OP_ELSE
OP_SHA256 <sha256(Bob secret)> OP_EQUALVERIFY
<Alice pubkey> OP_CHECKSIG
OP_ENDIF

I guess there are some block explorers that let you visualize the real script being used in a transaction, so can anyone point me to a real LN transaction (in mainnet) that follows the template above?

Thanks

3 Answers 3

5

The actual script implemented on Lightning Network is a little bit different from what you quoted. This is the script below and the specification is here

OP_IF
    # Penalty transaction
    <revocationpubkey>
OP_ELSE
    `to_self_delay`
    OP_CSV
    OP_DROP
    <local_delayedpubkey>
OP_ENDIF
OP_CHECKSIG

I've created that transaction on Testnet as the following,

Txid: 4f8d776c85b1fc15c1125e7043a9aee70e33f0793b472823e3946a8de075bec4

Rawdata:

6321026644cb387614f66421d14da3596c21cffa239011416c9adf3f351ee8551a9fc767029000b27521029654f80732769d7c435a184a3559f12178315526c53bbf003349390811c7590a68ac

Decoded by here

{
    "result": {
        "asm": "OP_IF 026644cb387614f66421d14da3596c21cffa239011416c9adf3f351ee8551a9fc7 OP_ELSE 144 OP_CHECKSEQUENCEVERIFY OP_DROP 029654f80732769d7c435a184a3559f12178315526c53bbf003349390811c7590a OP_ENDIF OP_CHECKSIG",
        "type": "nonstandard",
        "p2sh": "35M7MGVGd3ajyiTMvriUiyUM3H2cT5sgb4"
    },
    "error": null,
    "id": null
}
0
0

blockchain.com has a "show scripts" link.

Here's a mainnet LN transaction: https://www.blockchain.com/btc/tx/2facfe9147121b64761bef31c3808f43f92311349dbba01217bb666f0bd9b83c?show_adv=true

From this channel: https://1ml.com/channel/586011110465142785

1
  • 3
    mmm but those scripts don't match the template I posted in my question
    – knocte
    Commented Aug 10, 2018 at 8:56
0

Note that the revocationpubkey is derived https://github.com/lightning/bolts/blob/master/03-transactions.md#revocationpubkey-derivation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.