<p>Note that the <code>revocationpubkey</code> is derived <a href="https://github.com/lightning/bolts/blob/master/03-transactions.md#revocationpubkey-derivation" rel="nofollow noreferrer">https://github.com/lightning/bolts/blob/master/03-transactions.md#revocationpubkey-derivation</a></p>

CC BY-SA 4.0
2022-02-24T04:37:18.993Z
2022-02-24T04:37:18.993Z
Chaojie Wang
<p>blockchain.com has a "show scripts" link.</p>

<p>Here's a mainnet LN transaction:
<a href="https://www.blockchain.com/btc/tx/2facfe9147121b64761bef31c3808f43f92311349dbba01217bb666f0bd9b83c?show_adv=true" rel="nofollow noreferrer">https://www.blockchain.com/btc/tx/2facfe9147121b64761bef31c3808f43f92311349dbba01217bb666f0bd9b83c?show_adv=true</a></p>

<p>From this channel:
<a href="https://1ml.com/channel/586011110465142785" rel="nofollow noreferrer">https://1ml.com/channel/586011110465142785</a></p>

CC BY-SA 4.0
2018-08-10T08:56:15.607Z
mmm but those scripts don't match the template I posted in my question
knocte
CC BY-SA 4.0
2018-08-10T07:45:06.827Z
2018-08-10T07:45:06.827Z
dtkav
<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>

CC BY-SA 4.0
2019-04-03T02:54:46.743Z
2019-04-03T02:54:46.743Z
ogw_yuya
<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>

<lightning-network><script><ln-closing-channels><blockchain-explorer>
Lightning close-channel transaction example?
knocte
# Lightning close-channel transaction example?

(Asked by: username_0 on 2018-05-04)

From [this article](https://blog.chainside.net/understanding-payment-channels-4ab018be79d4), 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

**Tags:** lightning-network, script, ln-closing-channels, blockchain-explorer


---

## 3 answers

### Answer by username_3 on 2019-04-03. Score: 5 | Accepted answer

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](https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md#to_local-output)

```
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](https://api.blockcypher.com/v1/btc/test3/txs/4f8d776c85b1fc15c1125e7043a9aee70e33f0793b472823e3946a8de075bec4)

Rawdata:

```
6321026644cb387614f66421d14da3596c21cffa239011416c9adf3f351ee8551a9fc767029000b27521029654f80732769d7c435a184a3559f12178315526c53bbf003349390811c7590a68ac

```

Decoded by [here](http://chainquery.com/bitcoin-api/decodescript)

```
{
    "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
}

```


---

### Answer by username_1 on 2022-02-24. Score: 0

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


---

### Answer by username_2 on 2018-08-10. Score: 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>

> **Comments:**
> **username_0**: mmm but those scripts don't match the template I posted in my question  

---

