<p>c-lightning doesn't store old versions of the commitment transaction, exactly in order to avoid accidentally cheating. If you compiled with <code>DEVELOPER=1</code> you can however call <code>lightning-cli dev-sign-last-tx {peer-id}</code> and it'll spit out the fully signed commitment transaction (that's why <code>dev-*</code> commands are dangerous and should not be used if you don't know exactly what you're doing, which is the case here).</p>
<p>Once you have the signed commitment, just perform some other action that creates a new commitment (feerate adjustment, send or forward a payment) and then send the now invalidated commitment transaction you got from <code>dev-sign-last-tx</code> to the network using <code>bitcoin-cli sendrawtransaction</code> and confirm it by generating a block. Both nodes should see the unilateral close and identify it as a cheat transaction. The cheating node will give up, since there's nothing it can do, and the cheated node can punish the cheater by claiming all the funds.</p>

CC BY-SA 4.0
2020-07-07T18:00:50.213Z
2020-07-07T18:00:50.213Z
cdecker
<p>I want to understand how cheat lightning network using c-lightning.
I understand that if a participant of che channel send not last commitment transaction, it means that he tries to cheat. I'd like to replicate this scenario.</p>
<p>I tried to dump commitments, and I found these informations.</p>
<pre><code>    $ ./hsmtool dumpcommitments 022f495a897360fdd287f7a823302479e62856e47727c0c8c9688faf45f4a92aac 1 2 
/tmp/l1-regtest/regtest/hsm_secret mypass
    shaseed: 14d384a3757ea8c750d1325997ed7c0761b1cf2a8845ae0aaf5b6c783bcbe8ef
    commit secret #0: 9d202a2c4df2792d4d77583b969d407dc0b31e9ff38bb9121932ac55e536202e
    commit point #0: 039f4232478aa0629637ba2d8fd9808bd3d06342b5fbc67699d2f09bc1a9c844ad
    commit secret #1: 8cf246e819e78d34ce331f897652909bdc7104b6eac173a4180be1bbcfc46f37
    commit point #1: 03cacc020bcc3a322c41854a3b0337643b5e9b10af79f96ba14ccf4637cd56ba8f
</code></pre>
<p>Where can I find the first transaction in order to try to cheat?
Because I want to understand how penalties work and i'd like to decode all commitments transaction</p>

<lightning-network><core-lightning><ln-commitment-transaction>
Cheat Lightning network (c-lightning)
monkeyUser
# Cheat Lightning network (c-lightning)

(Asked by: username_0 on 2020-07-07)

I want to understand how cheat lightning network using c-lightning.
I understand that if a participant of che channel send not last commitment transaction, it means that he tries to cheat. I'd like to replicate this scenario.

I tried to dump commitments, and I found these informations.

```
    $ ./hsmtool dumpcommitments 022f495a897360fdd287f7a823302479e62856e47727c0c8c9688faf45f4a92aac 1 2 
/tmp/l1-regtest/regtest/hsm_secret mypass
    shaseed: 14d384a3757ea8c750d1325997ed7c0761b1cf2a8845ae0aaf5b6c783bcbe8ef
    commit secret #0: 9d202a2c4df2792d4d77583b969d407dc0b31e9ff38bb9121932ac55e536202e
    commit point #0: 039f4232478aa0629637ba2d8fd9808bd3d06342b5fbc67699d2f09bc1a9c844ad
    commit secret #1: 8cf246e819e78d34ce331f897652909bdc7104b6eac173a4180be1bbcfc46f37
    commit point #1: 03cacc020bcc3a322c41854a3b0337643b5e9b10af79f96ba14ccf4637cd56ba8f

```

Where can I find the first transaction in order to try to cheat?
Because I want to understand how penalties work and i'd like to decode all commitments transaction

**Tags:** lightning-network, core-lightning, ln-commitment-transaction


---

## 1 answers

### Answer by username_1 on 2020-07-07. Score: 3

c-lightning doesn't store old versions of the commitment transaction, exactly in order to avoid accidentally cheating. If you compiled with `DEVELOPER=1` you can however call `lightning-cli dev-sign-last-tx {peer-id}` and it'll spit out the fully signed commitment transaction (that's why `dev-*` commands are dangerous and should not be used if you don't know exactly what you're doing, which is the case here).

Once you have the signed commitment, just perform some other action that creates a new commitment (feerate adjustment, send or forward a payment) and then send the now invalidated commitment transaction you got from `dev-sign-last-tx` to the network using `bitcoin-cli sendrawtransaction` and confirm it by generating a block. Both nodes should see the unilateral close and identify it as a cheat transaction. The cheating node will give up, since there's nothing it can do, and the cheated node can punish the cheater by claiming all the funds.


---

