# OP\_PAIRCOMMIT as a candidate for addition to LNhance

**URL:** <https://delvingbitcoin.org/t/op-paircommit-as-a-candidate-for-addition-to-lnhance/1216>\
**Category:** Protocol Design\
**Created:** [October 25, 2024, 2:31pm UTC](https://delvingbitcoin.org/t/op-paircommit-as-a-candidate-for-addition-to-lnhance/1216 "2024-10-25T14:31:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![moonsettler](https://delvingbitcoin.org/user_avatar/delvingbitcoin.org/moonsettler/32/38_2.png) [@moonsettler](https://delvingbitcoin.org/u/moonsettler)\
**Post date:** [October 25, 2024, 2:38pm UTC](https://delvingbitcoin.org/t/op-paircommit-as-a-candidate-for-addition-to-lnhance/1216/2 "2024-10-25T14:38:12Z")

</div>

From the prelimiary spec, where PC fits in LN-Symmetry:

### Vector Commitments

`OP_PAIRCOMMIT` can be used to commit to a vector of stack elements in a way that is not vulnerable to various forms of witness malleability especially when used in conjunction with `OP_CHECKSIGFROMSTACK` and `OP_INTERNALKEY`, since SHA256 implicitly commits to size of the stack elements, making the script cleaner, and simpler. If `OP_CAT` was used naively, the contract could be easily broken since `OP_CHECKTEMPLATEVERIFY`is only defined for 32 byte parameters.

```plaintext
# S = 500000000
# IK -> A+B
<sig> <state-n-recovery-data> <state-n-hash> | CTV PC IK CSFSV <S+1> CLTV

```

before funding sign first state template:

```plaintext
# state-n-hash { nLockTime(S+n), out(contract, amount(A)+amount(B)) }
# settlement-n-hash { nSequence(2w), out(A, amount(A)), out(B, amount(B)) }
# state-n-recovery-data { settlement-n-hash or state-n-balance }

# contract for state n < m
IF
  <sig> <state-m-recovery-data> <state-m-hash> | CTV PC IK CSFSV <S+n+1> CLTV
ELSE
  <settlement-n-hash> CTV
ENDIF

```

---

_[View the full topic](https://delvingbitcoin.org/t/op-paircommit-as-a-candidate-for-addition-to-lnhance/1216)._
