Dear devs,

I was sitting on this draft of Tripwire while working on SHRINCS but given the 
newfound urgency, I'm posting it now to get the ball rolling. 


```
  BIP: ?
  Title: ECDLP Tripwire: Trigger for cryptanalytic breakthroughs
  Authors: conduition <[email protected]>
  Status: Draft
  Type: Specification
  Assigned: ?
  License: CC0-1.0 OR MIT
```

# Abstract

This document specifies *Tripwire,* a consensus deployment mechanism which can 
be used to activate dependent BIPs once a break in the cryptographic 
assumptions underpinning elliptic curve digital signature algorithm (ECDSA) and 
BIP-340 Schnorr signatures is detected, or agreed upon.

Tripwire is a one-way trigger which can be used to enforce new consensus rules. 
This BIP defines two conditions under which Tripwire activates: BIP-9, and 
Tripwire Spends. We stop short of defining any actual changes to consensus 
rules; This is left open for other BIPs which may predicate new rules on 
Tripwire activation.

# Motivation

As technology and cryptanalytic techniques improve over time, Bitcoin may 
someday face a situation where the signature schemes we depend upon for 
authenticating UTXO ownership (ECDSA and BIP-340) are weakened or outright 
broken. The cryptographic assumptions these schemes utilize - namely the 
elliptic curve discrete log problem (ECDLP) on secp256k1 - may someday come 
into question.

It would be beneficial to Bitcoin's long-term utility that we prepare for such 
an event, but even more important is that Bitcoin nodes maintain consensus on 
whether such an event has or has not happened, so that time-sensitive consensus 
rules predicated on such a question - such as disabling newly-broken 
cryptography - can be fully defined. This BIP aims to fulfill this role.

# Specification

## Notation

In this specification, we operate only on bytes and UTF8 strings.

The `||` operator denotes concatenation of bytes.

The `lift_x(x)` function returns the even-parity point `P` on the secp256k1 
curve for the X-coordinate is `x`.

## Constants

The point `G` is the secp256k1 base point.
```py
x(G) = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
y(G) = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
```

The point `H` is the "nothing-up-my-sleeve" (NUMS) point defined by BIP-341.
```py
H = lift_x(0x50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0)
```

The X-coordinate of `H` is derived by the SHA256 hash of the uncompressed DER 
encoding of `G`.
```py
H == lift_x(sha256(0x04 || x(G) || y(G)))
```

Encoding `H` as a compressed secp256k1 public key, we have

```py
NUMS_KEY = 0x0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0
```

## Tripwire Address

The Tripwire Address uses a segwit version 1 (P2TR) script pubkey with a 
witness program `x(H) == NUMS_KEY[1:33]`.

```py
tripwire_p2tr_spk = 0x5120 || x(H)
                  = 0x5120 || NUMS_KEY[1:33]
                  = 
0x512050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0
```

Encoded as a P2TR address using bech32m format defined in BIP-350, with a human 
readable prefix `hrp`, we acquire the second Tripwire Address.[^bech32]

```py
tripwire_p2tr_addr = bech32.encode(hrp, witver=1, witprog=x(H))
```

For Bitcoin mainnet we have `hrp = "bc"`, so the P2TR mainnet Tripwire Address 
is

```py
tripwire_p2tr_addr == 
"bc1p2zffkaxp5py4fdutfdsrt6t6tcrc5ks09rkfd428hlhf4n5q8tqqwv7ahk"
```

### Validation

See [`nums.rs`](./nums.rs) for a Rust program which reproduces this address 
using the Rust Bitcoin library[^rust_bitcoin].

# Activation

Tripwire has two activation conditions. We describe them each below.

## BIP-9

Tripwire can be activated by miners, using BIP-9 with an extended timeout.

| BIP-9 Parameter | Value |
|:-:|:-:|
| `name` | ECDLP Tripwire |
| `bit` | TODO |
| `starttime` | TODO |
| `timeout` | `starttime` + 20 years |

The long timeout is intended to allow Tripwire plenty of time to activate 
in-advance of a cryptanalytic breakthrough, in the event the community receives 
early warning (e.g. efficient attacks on smaller curves[^toy_curves]) and can 
agree a break in ECDLP is inevitable.

## Tripwire Spends

Tripwire activates on a blockchain once any **valid** transaction spends an 
output previously sent to the [Tripwire Address](#tripwire-address). Such a 
transaction is called a *Tripwire Activation Transaction*. A block which 
includes this transaction is called the *Tripwire Activation Block.*

The ordering of the first Tripwire Activation Block within a blockchain carries 
special consensus meaning. When processing a block containing a valid Tripwire 
Activation TX, nodes identify that block as a Tripwire Activation Block, and 
must apply any new rules predicated on Tripwire *to all descendent blocks 
**after** the first Tripwire Activation Block.*

We stress that any new rules predicated on Tripwire **do not apply** to the 
Tripwire Activation Block.

### Edgecases

- Subsequent Tripwire Activation Transactions after the first have no special 
effect.
- Special handling may be needed in implementations to account for 
reorganizations to new chains which do not include a Tripwire Activation Block.

# Rationale

## FAQ

> Why don't Tripwire rules apply to the Tripwire Activation Block?

Node implementations may execute processing of transactions in parallel, so 
Tripwire activates strictly *after* the Tripwire Activation Block avoid 
situations where certain rules apply to *some* transactions in a block, but not 
others.

If Tripwire-dependent rules applied to the *whole Tripwire Activation Block*, 
then implementations would need to perform a "look-ahead" inside every new 
block before full validation, to determine which rules to apply ahead of time. 
Further: the Tripwire-dependent rules may invalidate the Tripwire Spend 
Transaction itself.

We free ourselves of these complexities by making Tripwire-dependent rules 
activate *after* the activation block.

Note that if a Tripwire Spend Transaction is published, miners already have a 
degree of choice as to whether to include this transaction in their template or 
not, and can decide its ordering inside the block template. So we reason that 
excepting the activation block from the new rules gives no new or unfair 
advantage to its miner.

> Why don't you use a proof of a weaker curve?

Tripwire could also be designed to activate upon publication of a discrete-log 
break proof on a weaker (smaller) elliptic curve, possibly one which is 
structurally similar to secp256k1. The aim of this would be to serve as an 
early-warning ("canary") mechanism, enforcing new rules before any concrete 
risk to ECDSA and BIP340 arrives.[^toy_curves]

We reject this approach. The Tripwire Spend activation mechanism is not 
intended to be a predictive tool or give early warning of a break in secp256k1. 
It is intended to ensure that, once the assumptions underlying ECDSA and 
Schnorr **are provably broken,** new consensus rules must be enforceable by 
anyone with the capacity to produce such a proof. Using a weaker curve's ECDLP 
as an activation trigger would not firmly prove anything about the (lack of) 
hardness of ECDLP on secp256k1 and so would not satisfy our design needs. It is 
also unknowable whether a weaker curve's ECDLP would be broken meaningfully 
earlier than that of secp256k1, and so the degree of any "early warning" 
advantage that the Bitcoin community would receive is unpredictable.

Successful attacks on weaker curves' ECDLPs may be used in a non-consensus 
capacity, to catalyze community consensus on whether and when to trigger 
Tripwire through the BIP-9 activation mechanism.

> Why not use any `OP_SHA256 OP_CHECKSIG` spend as the trigger?

Another way to demonstrate an attack on secp256k1 would be to ask someone to 
spend a coin committing to a simple two-opcode script, `OP_SHA256 OP_CHECKSIG`. 
A satisfying witness would need to be `<signature> <preimage>`, where 
`sha256(preimage)` is a valid Schnorr public key which `signature` verifies 
against. The folklore idea is that an ECDLP adversary can pick their own 
nothing-up-my-sleeve point by sampling a preimage, and then break ECDLP to 
forge a signature on it and spend the coin.

However, this challenge *demonstrates a different fact from the ECDLP.* It 
demonstrates that the adversary was able to find a `preimage` such that they 
know a valid `signature` (or private key) for the Schnorr public key `P = 
sha256(preimage)`. It *does not demonstrate the adversary can break ECDLP,* 
which implies the ability to factor an arbitrary point given by the security 
game into its discrete logarithm. Breaking ECDLP means one can spend a 
`OP_SHA256 OP_CHECKSIG` script, but the converse does not hold.

The key distinction is that `OP_SHA256 OP_CHECKSIG` allows the adversary to 
specify their own target point to attack, and it is unknown whether this gives 
the adversary an advantage.

For Tripwire, we opt instead for a fixed, transparently-chosen target point, 
which adheres more faithfully to the formal ECDLP security notion. If an 
adversary can forge a signature on `NUMS_KEY`, they are likely able to do so 
for any arbitrary key.

> Why not randomize the NUMS point?

The NUMS point in Tripwire is a fixed constant. One could alternatively 
engineer the system to randomize the NUMS point deterministically on a 
per-block basis, e.g. by deriving the Tripwire Address from a hash of the prior 
(or n-th) block.

We forgo this design, in favor of a simpler, static address. This makes 
Tripwire activation very obvious and indisputable, and keeps the consensus 
implementation clean.

> Why use only Schnorr and not ECDSA?

The Schnorr signature scheme provably reduces to ECDLP under the random oracle 
model. This means an entity capable of forging Schnorr signatures must be able 
to either break the ECDLP on secp256k1, or break the hash function (SHA256) 
used to bind signatures to messages. No such similar proof exists for ECDSA.

Thus for the purposes of formally demonstrating a break in ECDLP, a Schnorr 
signature from a fixed nothing-up-my-sleeve point provides the firmest 
evidence. Any cooperative entity capable of breaking ECDLP can produce a valid 
ECDSA or Schnorr signature from the NUMS point, so there is no need to monitor 
both algorithms in Tripwire.

# Copyright

This document and related code is licensed under either the CC0-1.0 or MIT 
license, at your option.

# Discussions

- https://groups.google.com/g/bitcoindev/c/aWYtPLVPZ3U/
- https://groups.google.com/g/bitcoindev/c/p8AVEmAtWdA
- https://groups.google.com/g/bitcoindev/c/d7o74e-teNo/
- https://delvingbitcoin.org/t/qcap-a-bitcoin-native-quantum-canary-alert/2498

[^bech32]: The `bech32.encode` function is defined in [the BIP350 reference 
code](https://github.com/sipa/bech32/blob/7a7d7ab158db7078a333384e0e918c90dbc42917/ref/python/segwit_addr.py#L131-L137),
 also available 
[here](https://github.com/bitcoin/bips/blob/02bebeb5ef53dc21a52d5706c6b4c17b6af6c1cc/bip-0352/bech32m.py#L129-L135).
[^rust_bitcoin]: https://github.com/rust-bitcoin/rust-bitcoin
[^toy_curves]: https://arxiv.org/pdf/2508.14011
[^multi_target]: 
https://github.com/conduition/tripwire-bip/blob/main/tripwire.md




regards,
conduition

-- 
You received this message because you are subscribed to the Google Groups 
"Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/bitcoindev/TFovB6Dw5oivezJm_SNCtkVmMVA_sQTLcqg_sFgAaBTJNT4_e-i06PVcfN1FfXrK0RJSQHAbQq-MfnoqdWQ2Ax3Rf7FiTzGAaMWVrETw240%3D%40proton.me.

Attachment: publickey - [email protected] - 0x474891AD.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

  • [bitcoindev] Tripwire BI... 'conduition' via Bitcoin Development Mailing List

Reply via email to