lightning-dev

OP_Expire and Coinbase-Like Behavior: Making HTLCs Safer by Letting Transactions Expire Safely

OP_Expire and Coinbase-Like Behavior: Making HTLCs Safer by Letting Transactions Expire Safely

Original Postby ZmnSCPxj

Posted on: November 7, 2023 11:11 UTC

In a recent discourse, the functionality of Hash Time-Locked Contracts (HTLCs) within a blockchain context was elucidated with a specific example involving participants named Bob and Carol.

The discussion highlighted that prior to a pre-defined block number, block 100 in this instance, only the recipient of the HTLC, which is Carol, has the ability to execute an HTLC-success transaction. This exclusivity is due to the timelock feature inherent to the HTLC, which prevents Bob from initiating an HTLC-timeout transaction before the specified block is mined.

Furthermore, it's emphasized that the commitment transaction associated with the HTLC is secure against alterations by Bob alone because it necessitates signatures from both parties involved, Bob and Carol. Given that Carol would not assist in an action that would jeopardize her own interests, such as an attack on the contract, she remains protected against any adversarial moves by Bob as long as she can complete the HTLC-success transaction before block 100.

However, once the blockchain reaches block 100, the scenario shifts. At this juncture, an OP_EXPIRE operation comes into effect, indicating that the window for Carol to claim the funds has closed. Beyond this point, she no longer has the capability to access the funds through the HTLC mechanism, illustrating the critical timing aspect of these contracts within the blockchain framework.