user2751: 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

user57658: 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
}


2751: <p>From <a href="https://blog.chainside.net/understanding-payment-channels-4ab018be79d4" rel="nofollow noreferrer">this article</a>, 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:</p>

<pre><code>OP_IF
“+7 days” OP_CHECKSEQUENCEVERIFY OP_DROP
&lt;Bob pubkey&gt; OP_CHECKSIG
OP_ELSE
OP_SHA256 &lt;sha256(Bob secret)&gt; OP_EQUALVERIFY
&lt;Alice pubkey&gt; OP_CHECKSIG
OP_ENDIF
</code></pre>

<p>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?</p>

<p>Thanks</p>
 57658: <p>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 <a href="https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md#to_local-output" rel="noreferrer">here</a></p>

<pre><code>OP_IF
    # Penalty transaction
    &lt;revocationpubkey&gt;
OP_ELSE
    `to_self_delay`
    OP_CSV
    OP_DROP
    &lt;local_delayedpubkey&gt;
OP_ENDIF
OP_CHECKSIG
</code></pre>

<p>I've created that transaction on Testnet as the following,</p>

<p>Txid:
<a href="https://api.blockcypher.com/v1/btc/test3/txs/4f8d776c85b1fc15c1125e7043a9aee70e33f0793b472823e3946a8de075bec4" rel="noreferrer">4f8d776c85b1fc15c1125e7043a9aee70e33f0793b472823e3946a8de075bec4</a></p>

<p>Rawdata:</p>

<pre><code>6321026644cb387614f66421d14da3596c21cffa239011416c9adf3f351ee8551a9fc767029000b27521029654f80732769d7c435a184a3559f12178315526c53bbf003349390811c7590a68ac
</code></pre>

<p>Decoded by <a href="http://chainquery.com/bitcoin-api/decodescript" rel="noreferrer">here</a></p>

<pre><code>{
    "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
}
</code></pre>
