delvingbitcoin

OP_PAIRCOMMIT as a candidate for addition to LNhance

OP_PAIRCOMMIT as a candidate for addition to LNhance

Original Postby ajtowns

Posted on: October 28, 2024 11:16 UTC

The discussion focuses on optimizing the use of SHA256 iterations for LN-Symmetry, highlighting that minimizing these iterations is not seen as crucial by some.

It is pointed out that the computational difference in hashing varying byte sizes is minor compared to the operations involved in checking signatures. A proposed method for constructing a hash involves a sequence of operations starting with balance and CTV hash inputs, followed by multiple SHA256 hashes and concatenations. This method accommodates a 7-byte balance commitment combined with a 32-byte CTV hash, yielding a preimage size of 55 bytes which fits within a single SHA256 block.

The concern raised revolves around LN-Symmetry in conjunction with CTV (CHECKTEMPLATEVERIFY), particularly regarding the potential for length redistribution attacks due to the fixed 32-byte template requirement of CTV. This stipulation could inadvertently facilitate upgradeability issues since CTV acts as a no-operation (NOP) for non-32-byte templates, a feature designed for future-proofing. To mitigate these concerns while still supporting the goal of minimal hashing and ensuring compatibility with potential CTV upgrades, an intricate method involving various operations is suggested. This method ensures that only specific preimage sizes are processed, thereby preventing the aforementioned length redistribution attacks.

Further, to accommodate the uncertain nature of future CTV upgradeability without compromising security, an elaborate construction is recommended. This includes a series of duplications, verifications, and conditional checks before finalizing the SHA256 hash. The suggestion also mentions a potential update to the BIP (Bitcoin Improvement Proposal) that could streamline this process by eliminating certain steps if a zero-byte hash results in a CTV error, indicating a more efficient approach to handling such cryptographic operations and maintaining system integrity amidst upgradeability considerations.