-
Notifications
You must be signed in to change notification settings - Fork 2
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
RCP-250113A: Unify single-use seals #16
Comments
One possible downside of this proposal is forward compatibility in case different seal close methods will be developed in the future. I think we cannot exclude that new bitcoin TX output formats (or new protocols) may be developed and that they could require creating new close methods to have RGB work on them. This may be solved by having contracts commit to a set of supported close methods, which for now will be { The algorithm to identify the output in which commitment is found would become:
As proposed by @fedsten, one could also achieve more flexibility by committing to a more specific seal closing logic than just a set of commitment schemes, for instance:
These two approaches probably result in different levels of added complexity to the code, it's not entirely clear to me which one is better. |
The whole point of a proposal is to remove even the ability to have multiple commitment methods in RGB. This was preventing us from moving stable for the last two years. Strong concept NACK to allowing different seal closing methods in different contracts: it invalidates the whole value of seal unification. Anyway, different seal close methods are simply different and independent RGB protocols. Thus, if Bitcoin changes, a new protocols may be created. There is no backward compatibility issue since the contract commits to the protocol at creation time; once created new seal methods can't be added anyway. |
ACK - I think this is a clever solution for the opret/tapret dichotomy issue and it simplifies reasoning about possible attacks. Just throwing in some more (quite possibly unnecessary) ideas here: 1. Proving that taproot output doesn't contain any commitmentAccording to Constructing and spending Taproot outputs section of BIP341 wiki:
Not sure if this is implemented in practice, but if yes, it could be used to prove that a given taproot output doesn't contain any commitment and should therefore be skipped in the iteration. 2. Skipping OP_RETURNs of invalid sizei.e. if the OP_RETURN output script is not of size 34 (OP_RETURN OP_PUSH32 <32 bytes commitment>) we can also skip it, as it for sure cannot contain a valid commitment. This might be useful for some scritpless swap protocols swapping between assets that use OP_RETURN (such as Runes, Omni) and RGB assets. |
Yeah, basically one can always prove that a specific transaction output doesn't contain a valid DBP - in for both OP_RETURN and P2TR outputs. For OP_RETURN one just need to provide the source data (or, in case of length check, no data are needed). For P2TR, one can show that there is no script tree, or that it doesn't contain on level 2 any DBC script (this is already done using But I think such "proving no commitment is present" are useful for fallback seals, - but should not be used in the happy path, since they need consensus validation more complex with no benefit (giving fallback mechanism). |
Background
RGB since v0.7 (introduction of taproot-based commitment scheme called
tapret
, released in June 2022) allows two commitment schemes. The reason was the following:tapret
commitments save on transaction cost and privacy;opret
are needed for Lightning and hardware wallets.The immediate issue appeared: if we have two commitment schemes, nothing prevents from creating two distinct single-use seals under each of commitment schemes using the same UTXO. And with that a wallet gets blocked and have no choice other than to burn some assets (all assets under one of commitment schemes). Thus, we had to allow two, not one commitment and anchor per bitcoin witness transaction, so transaction may have both
tapret
andopret
commitments present.In autumn 2023 in Viareggio we also have found a vulnerability of simultaneous use of
tapret
andopret
in v0.10. So, before Viareggio 2023, in v0.9 and v0.10 we thought “well, we just need to prohibit a wallet to create different seal types”. But it was naive. The real problem is that an adversary can do an inflation attack, by creating two commitments in one transaction and never exposing them both: the first in taproot and the other in an op-Return output following taproot (since he can claim the first taproot do not have tapret, while it actually has).So the moment you have two commitment schemes you must assume they are both present in the same transaction. I spent three months fighting it, got v0.11 with HUGE complexity of dealing with different double commitment cases [1], - and we spent whole 2024 testing and debugging it.
In Lugano last Autumn we decided to make contracts monotonic on commitments, so we can be sure there are no inflation bugs possible. In v0.12 I have implemented it, and everything was fine (and much simpler) in the consensus layer (so each contract is either
opret
ortapret
), but it has stroke back in wallet:tapret
wallets need to work with bothopret
andtapret
contracts, and other types of wallets - just withopret
. Right now in v0.12 contracts commit to the seal type via generic constant parameter - which is a safety measure. It is impossible to put contracts of different seal types into the same wallet, preventing from completing tests and releasing v0.12.Motivation
Proposal
Unification means that from now on in v0.12 there will be not two commitment schemes (seal closiing methods), but a single one. Thus, neither contracts nor seal definitions commit to a closing method, and receiver doesn't need to provide one via invoice. Witness transaction will always have just a single anchor and commitment - and not two as before. This is a great simplification, since reduces attack surface by a lot, and simplifies a lot of code, business logic and workflows.
The single unified commitment scheme can be described as "look for the first explicit commitment in OP_RETURN output or assume tapret commitment in the first taproot output".
The algorithm details are the following:
opret
commitment to all the seals (remember seals definitions are commitment-agnostic). Stoptapret
commitment, and require proof. StopRationale
Unification of commitments results in:
opret
andtapret
), which would be never able to interact (basically two independent "RGB protocols");tapret
andopret
wallets, providing a single RGB wallet API;tapret
contracts);tapret
contracts).FAQ
opret
andtapret
schemes;Implementation
Tracking issue for the implementation in v0.12 is RGB-WG/rgb#275
Appendix
[1] The complexities of two commitment schemes
[2] Ideas tried alognside the idea of unification
The text was updated successfully, but these errors were encountered: