Skip to content

Commit

Permalink
[BIP-0349] Add Re-Keying explanation to OP_INTERNALKEY
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRubin authored Dec 21, 2024
1 parent 2caa8e2 commit 337f559
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bip-0349.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ Note: The internal key must be the X coordinate of a point on the SECP256K1
curve, so any such hash must be checked and modified until it is such an X
coordinate. This will typically take approximately 2 attempts.

### Re-Keying with Merkle Root Preservation

Consider a program such `CTV <X> CSFS <S+1> CLTV`. Such fragments are useful for LN-Symmetry applications.

Such a program would be embedded within a Taproot script path, such as `TR(X, {CTV <X> CSFS <S+1> CLTV})`.

Were the internal key to be updated from `X` to `Y`, the resulting program would be: `TR(Y, {CTV <X> CSFS <S+1> CLTV})`.

The key in the leaf and the key-path would be mismatched. Were `OP_INTERNALKEY` to be used,
the leaf would automatically re-key.
E.g., `TR(X, {CTV OP_INTERNALKEY CSFS <S+1> CLTV})` is equivalent to `TR(X, {CTV <X> CSFS <S+1> CLTV})`
and `TR(Y, {CTV OP_INTERNALKEY CSFS <S+1> CLTV})` is equivalent to `TR(Y, {CTV <Y> CSFS <S+1> CLTV})`.

While this particular example is contrived, the general technique of using `OP_INTERNALKEY`
as updatable across an entire script tree is a helpful covenant primitive when it is desirable to
invalidate signatures from prior states. For example, the theoretical `OP_TAPLEAFUPDATEVERIFY` opcode
modifies the internal key directly to remove or add a participant, and `OP_INTERNALKEY` would ensure
that the tweaked key is used from all script paths where desired.

## Reference Implementation

A reference implementation is provided here:
Expand Down

0 comments on commit 337f559

Please sign in to comment.