4

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

1 Answer 1

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.

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.