-
Notifications
You must be signed in to change notification settings - Fork 5.8k
BIP442: OP_PAIRCOMMIT #1699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
BIP442: OP_PAIRCOMMIT #1699
Conversation
murchandamus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This document has a few formatting issues, please make sure that the preamble matches the BIP 2 requirements and take a look at the rich diff to see whether it looks the way you intend.
Please note that the BIPs repository also accepts markdown files.
|
Switched back to markdown. Header now in BIP-2 format. |
8f11758 to
f3f7f91
Compare
|
The original create date of OP_PAIRCOMMIT is 2024-03-15 this is the latest revision based on feedback from Anthony Towns. |
|
Added a discussion link to the PR description. |
|
According to BIP 2:
|
|
Has this proposal been sent to the mailing list? |
Proposed to the mailing list, waiting for feedback. |
59249d9 to
dfb0670
Compare
dfb0670 to
92ffeb8
Compare
murchandamus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see this proposal to get more review from other covenant researchers before it moves forward.
2dfe8fd to
bbf8c49
Compare
|
It looks like we gonna have to amend the Special thanks to: @JeremyRubin @Ademan @bigspider edit: |
4df2a5d to
43259a7
Compare
acc0554 to
c49bc72
Compare
|
I think I've changed my mind a bit. We were talking about computing a merkle tree for The implication of this is that where a function can be decomposed into operations on smaller inputs, PAIRCOMMIT is massively more feasible to use than encoding things into a tap tree. |
Arithmetic and bitwise operations where inputs & outputs are small enough, can already be done in Script in cheaper ways. Merkle trees as lookup tables are only interesting for functions that are either extremely complex, or where preimages/images are larger than what Script can work with.
I think the only substantial difference is that in a Script where you need several lookups, you can do it with Merkle trees, while you can only do a single lookup with a precomputed taptree. |
Is this correct? Any suggestions? @Ademan @bigspider |
This is the main open question I believe. does it or does it not practically expand what we can already do? edit: (actually the above examples are wrong, because internally bitcoin script uses little endian, but should convey the point) |
Even u16,u16 is quite a bit larger than I think is practical as a lookup table, but the efficiency for repeated operations is constant, obviously. The lookup table is less efficient for small numbers of operations (a u8,u8 table is 16k vs 1 u8,u8 proof is 0.4k) but the merkle tree loses quickly when those operations are repeated.
Right, and the key point is these merkle trees and lookup tables rapidly become infeasible to compute as the input size grows, so multiple smaller lookups is significantly more useful. EDIT: But your point is well taken that for smaller operations they can already be better accomplished by lookup tables. |
Yeah for arbitrary 8 byte strings smolCAT seems infeasible to compute the table or merkle tree for. After a bit of conversation on IRC it could probably be feasible for arbitrary Bit shifts over 32 bit integers seems pretty feasible though, that's You can also separate positive and negative shifts, and maybe break it down into multiple rounds of shifts 1-3 or something (or 1k for a proof for a constant shift) [1]: afaik existing ASICs operate on block headers so couldn't help |
What you link to here reads very well. Skimming the current content of this PR, I would say the linked rework is more promising. |
|
This is more my words and my thought process, would it be okay to reference it as previous iteration or something? |
|
I’m happy to review again whatever is submitted here, but I don’t have the bandwidth to involve myself in the writing of the proposal. Please let me know when you have picked the version you want to submit. |
952597d to
3dbae36
Compare
1feffb9 to
24e4a09
Compare
|
I saw that you set this pull request to “ready for review”, but then pushed more changes. Do I take it right that you are ready for editor review, @moonsettler? |
|
Sorry I found some errors after. But yes, it is ready for review now. |
4c806c5 to
a7455a5
Compare
|
Small fix to the LN-Symmetry script example and rebased to latest. |
6a91484 to
9eedfb1
Compare
9704b04 to
191aac3
Compare
commit ae69991 Author: moonsettler <[email protected]> Date: Tue Sep 23 02:23:43 2025 +0200 Update references commit 6adcb4e Author: moonsettler <[email protected]> Date: Tue Sep 23 02:15:14 2025 +0200 General computation simplify wording commit 2f911cb Author: moonsettler <[email protected]> Date: Tue Sep 23 01:36:41 2025 +0200 Rework based on feedback from PR 1699
620462a to
5221a4e
Compare
| | Method | ChannelSc | UpdateSc | UpdateW | ForceC | Contest | Settle | | ||
| | :--------------- | --------: | -------: | ------: | ------: | ------: | :----: | | ||
| | APO-Annex | 8 WU | 113 WU | 100 WU | 1221 WU | 627 WU | SigOp | | ||
| | APO-Return | 8 WU | 113 WU | 66 WU | 1359 WU | 765 WU | SigOp | | ||
| | CTV+CSFS | 43 WU | 81 WU | 98 WU | 1394 WU | 765 WU | CTV | | ||
| | CTV+CSFS+IKEY | 10 WU | 48 WU | 98 WU | 1328 WU | 732 WU | CTV | | ||
| | CTV+CSFS+IKEY+PC | 11 WU | 49 WU | 131 WU | 1191 WU | 594 WU | CTV | | ||
| *ChannelSc: channel script, UpdateSc: update script, UpdateW: witness size for Force Close and Contest, ForceC: cost of unilateral close, Contest: additional cost to contest, Settle: signature or CTV required for settlement.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add TEMPLATEHASH+IKEY+CSFS comparisions?
| | Method | ChannelSc | UpdateSc | UpdateW | ForceC | Contest | Settle | | |
| | :--------------- | --------: | -------: | ------: | ------: | ------: | :----: | | |
| | APO-Annex | 8 WU | 113 WU | 100 WU | 1221 WU | 627 WU | SigOp | | |
| | APO-Return | 8 WU | 113 WU | 66 WU | 1359 WU | 765 WU | SigOp | | |
| | CTV+CSFS | 43 WU | 81 WU | 98 WU | 1394 WU | 765 WU | CTV | | |
| | CTV+CSFS+IKEY | 10 WU | 48 WU | 98 WU | 1328 WU | 732 WU | CTV | | |
| | CTV+CSFS+IKEY+PC | 11 WU | 49 WU | 131 WU | 1191 WU | 594 WU | CTV | | |
| *ChannelSc: channel script, UpdateSc: update script, UpdateW: witness size for Force Close and Contest, ForceC: cost of unilateral close, Contest: additional cost to contest, Settle: signature or CTV required for settlement.* | |
| | Method | ChannelSc | UpdateSc | UpdateW | ForceC | Contest | Settle | | |
| | :--------------- | --------: | -------: | ------: | ------: | ------: | :----: | | |
| | APO-Annex | 8 WU | 113 WU | 100 WU | 1221 WU | 627 WU | SigOp | | |
| | APO-Return | 8 WU | 113 WU | 66 WU | 1359 WU | 765 WU | SigOp | | |
| | CTV+CSFS | 43 WU | 81 WU | 98 WU | 1394 WU | 765 WU | HashEq | | |
| | CTV+CSFS+IKEY | 10 WU | 48 WU | 98 WU | 1328 WU | 732 WU | HashEq | | |
| | CTV+CSFS+IKEY+PC | 11 WU | 49 WU | 131 WU | 1191 WU | 594 WU | HashEq | | |
| | THIKCS-Annex | 10 WU | 49 WU | 100 WU | 1160 WU | 563 WU | HashEq | | |
| | THIKCS-Return | 10 WU | 49 WU | 66 WU | 1295 WU | 699 WU | HashEq | | |
| *ChannelSc: channel script, UpdateSc: update script, UpdateW: witness size for Force Close and Contest, ForceC: cost of unilateral close, Contest: additional cost to contest, Settle: signature or hash equality check required for settlement, THIKCS: TEMPLATEHASH+IKEY+CSFS.* |
OP_PAIRCOMMITis the newest member of the LNhance family of opcodes. It provides limited vector commitment functionality in tapscript.When evaluated, the
OP_PAIRCOMMITinstruction:Discussion: https://delvingbitcoin.org/t/op-paircommit-as-a-candidate-for-addition-to-lnhance/1216/12