HTLCs using OP_CHECKSEQUENCEVERIFY/OP_LOCKTIMEVERIFY and revocation hashes.



Summary:

In an email from Rusty Russell on July 6, 2015, the commitment transaction of Lightning Network was explained. Each side maintains a commitment transaction with two outputs, one paying to self and the other paying to the other side. In order to generate hash time-locked contracts (HTLC) required for lightning to be a network, both commitment transactions get an additional output per HTLC. This output is spendable under four conditions. The last two failure modes are separate from each other because HTLCs have different lifetimes from commit transactions. It seems there are two options: if HTLC is resolved off-chain, then both parties agree which way the funds should go, and both the commitment and HTLC are expired simultaneously. If HTLC is resolved on-chain, then either party decides to go to the blockchain, publishing their side of the commitment, so both the commitment and HTLC are executed simultaneously. Therefore, the commit transaction might as well always revoked before or simultaneously with the HTLC. The conditions are just that the recipient knows the R value, sender sees HTLC has timed out, or the commit transaction has been revoked.


Updated on: 2023-05-18T00:22:58.840070+00:00