Subject: Re: [bitcoindev] Trivial QC signatures with clean upgrade path

From: Antoine Riard <[email-masked]>
Date: Tue, 17 Dec 2024 19:29:17 -0800 (PST)

Hi all,

In my understanding, whatever the recent advances in error code
corrections to get universal quantum computer in the real-world,
there is still big unknowns if all the scalability challenges can
be solved as the number of physical qubits is going up, whatever
the underlying information support (e.g the spin of an electron).

All the efforts by many well-funded research team all over
the world at building QC might just end up on discovering new
law of physics rending intractable the realization of QC...

On the other hand, given the slowness of any consensus upgrade
in bitcoin this is definitely an area of concern to keep an
eye on it in the situation where QC would become practical
enough to break the DL problem.

I think Tadge's idea of introducing a PoQC, assuming it's
feasible, can be brilliant to enhance all the "pubkey"
exposed coins. For all the old coins (e.g P2PK more than
10 years ago), there could be a soft-fork introduces to
restrain the spend to some "seal" PoQC, of which the spend
would trigger the key-path spend knock-out of all "pubkey-exposed"
coins starting at the next block (or at spend height + N).

This soft-fork could require the unseal spend of a PoQC
to have an inflated weight of 4 MB to make the validity
transition easy. The new "seal" PoQC could be made consensus
mandatory for old pubkeys types and user opted-in for newer
ones like P2TR (i.e the PQ2TR). Spending a _single_ mandatory
or opted-in "sealed" pubkey would trigger the key-path spend
desactivation for all the affected UTXOs. While this would
be sacrifying one UTXO to save many of them, I think it would
minimizes expectations magical coordination of the community
when we see a real QC attacker in the wild to rollout a soft-fork.

I'm not sure if we can come up with a post-quantum scheme to
unlock pubkeys exposed through key-path, like any post-quantum
scheme would have to assume some secret proof of knowledge, though
once the DL is broken what information is remaining to the "legit"
coins owners to prove their know a speicifc scalar before the
PoQC "seal" has been reached ...? A Shor-efficient QC would break
the secrecy currently affordness by the hardness of factorization.

A client-side option could start to anchor the hash of EC secret
key as an ordering to solve the double-spend problem towards a
future QC attacker...even if we don't know yet how to make this
proof valid yet within future post-quantum secure scheme.

I don't think we should go for now on one post-quantum scheme like
Sphincs, while its cryptanalytic assumptions are easier to understand,
it's not like CRYSTALS or FALCON have also been successfully vetted
by the NIST. A user could script-path commit to a a number of "reserved"
OP_SUCCESS leafs, and then they can become valid either when the PoQC
is unsealed by a QC attacker or by a soft-fork ulterior to the PoQC
soft-fork. The on-chain fee cost of uncertainty on the most robust
post-quantum scheme is burden by the user, rather than picking up one
scheme as the only one (...there is little available litterature on the
post-quantum Grover's algorithm to break hash functions).

Additionally, I don't think pre-signed smarts contracts will be
condemned to close down, as long as a parallel post-quantum state
is counter-signed all along the classical state. There is no
guarantee ahead that the new signature scheme will have a consensus
validity (e.g SPHINCS or CRYSTALS signatures becoming valid), but
at least the parallel state, quantum or classic will be ordered by
on-chain spend of the UTXO.

While this is an open question in the QC field how much time it would
take to break a public key DL, and if it's going to be in average inferior
to 600 seconds, I think looking for any solution where the PoW is 
accelerated
will condemn us to a never-ending race, as QC latency is improving. We 
should
rather design consensus rules to yield a new block every 10 min, 
indifferently
of access to a classic or quantum computer and with only the quantity of 
energy
as a distinction factor.

So to make a digest, in my view I think the main problems are the following:
- (a) can we come up with a practical PoQC scheme that can be implemented 
as full-node consensus rules ?
- (b) what is socially acceptable to do with the QC-exposed old "pubkeys" 
coins that their users will never touch again ?
- (c) what are the client-side opted-in post-quantum hooks that could be 
implemented _now_ ?

Ideally, we can solve (a) to make the (c) hooks automatically blessed with
consensus meaning, and that way minimizing community coordination when it's
time to upgrade to post-quantum cryptography. I don't think there is a good
answer for (b) assuming no future magic post-quantum scheme to prove a 
knowledge
before a time T, other than anticipating the QC problem _now_ to minimize 
the
numbers of potentially affected coins in the future.

Best,
Antoine
ots hash: 9238d0a7ce681f0dc944b28745d379b41cd2491d
Le mardi 17 décembre 2024 à 05:42:33 UTC, conduition a écrit :

> Hey all, and thank you for this great idea Matt. It rhymes a little with my 
> DASK idea 
> <https://conduition.io/cryptography/quantum-hbs/#Upgrading-Bitcoin> but I 
> actually like yours a lot better, as it provides a cleaner upgrade path for 
> soft-fork compatibility than DASK.
>
> However, I suggest we use one of the more succinct Winternitz one-time 
> signature algorithms instead of committing to SPHINCS right away. This 
> gives us the option of using the WOTS key as a certification layer for some 
> pubkey from a future signature algorithm, which may or may not even exist 
> yet.
>
> Not only does this give researchers more time to find better algorithms, 
> it also makes devs' lives easier, and makes the transition to a PQ world 
> more incremental than a head-first dive committing to SPHINCS. WOTS is very 
> simple: it'd be easy to standardize and easy for wallets to implement and 
> derive. Its signatures can be as small as 1 kilobyte. Even if we do end up 
> choosing SPHINCS as the 2nd-layer whose pubkey we certify, the time/space 
> overhead added by one WOTS signature is negligible in comparison. Once the 
> WOTS pubkey is standardized, we can take our time choosing and 
> standardizing the probably-much-more-complicated 2nd layer signing 
> algorithm.
>
> This certification layer idea is straight from SPHINCS' own whitepaper. 
> This is how SPHINCS authors created its many-time property without blowing 
> up the runtime.
>
> ----------
>
> Tadge, your PoQC idea is neat but it relies on at least one "good guy" QC 
> willing to produce the proof. A self-interested QC would never willingly 
> crack a pubkey which it knows would activate a soft-fork against its own 
> interest. Any publicly-advertised PoQC honeypot addresses able to gather 
> large donations would be obvious, and a rational QC would ignore them. I 
> suppose users could sprinkle some hidden honeypot addresses around the 
> network and hope the QC bites one of them, but I don't think that's 
> practical - The QC would probably prioritize addresses with large balances 
> like Satoshi's wallets. I'm not sure if I have any better ideas though, 
> besides the also-risky option of relying on the community to act in unison, 
> triggering activation manually if/when a QC appears to be coming soon to a 
> blockchain near us. So a PoQC might be a good additional trigger, but we 
> also need to be able to manually activate the post-quantum upgrade in case 
> the PoQC is unavailable.
>
> ----------
>
> Another fun aspect of QC's we haven't discussed yet is BIP32. Whatever 
> pubkey we hide in the OP_SUCCESS tap leaf, it needs to be derived via 
> quantum-secure means. So there can be no unhardened BIP32 anywhere in the 
> derivation chain of the PQ-secret-key, or else xpubs can be sold to a QC 
> for profit, even if the PQ soft fork upgrade is activated on time.
>
> It seems like whatever upgrade path we go with, it will mean the end of 
> BIP32 xpubs as we know them. A 3rd party won't be able to derive my 
> post-quantum P2TR address from a regular xpub alone without also knowing 
> the OP_SUCCESS script's tap leaf hash, which by necessity must be 
> completely independent of the xpub. Sounds like we may need a new standard 
> for that too. Perhaps some kind of 'wrapper' which embeds a regular BIP32 
> xpub, plus the tap leaf hash of the OP_SUCCESS script? That'd be enough for 
> an untrusted 3rd party to derive a standard set of P2TR addresses with the 
> attached PQ fallback leaf script hash.
>
> A second wacky idea which modifies (bastardizes) BIP32 instead of 
> replacing it: Replace the xpub's chain code with the OP_SUCCESS script's 
> tap leaf hash before distributing. You could derive the PQ keypair from the 
> parent xpriv, to maintain the integrity of BIP32's chained derivation, so 
> in a it would be like inserting a little modification into BIP32's hardened 
> derivation logic. Software which doesn't have PQ-fallback support will 
> derive the standard P2TR addresses we all use today. Software which *does* have 
> PQ-fallback support will derive the same child taproot internal keys, but 
> tweaked with a PQ-fallback script leaf. I imagine this might make 
> compatibility very complicated though, so i'm not sure if this is a smart 
> choice - throwing this out there in case it inspires better ideas but i 
> wouldn't advocate for it myself.
>
> -c
>
> On Monday, December 16, 2024 at 5:22:44 PM UTC-5 Tadge Dryja wrote:
>
>> Hi everyone
>>  (disclosure: I'm highly skeptical QCs will break secp256k1 in my 
>> lifetime, but who knows)
>>
>> IMHO the activation dilemma is the trickiest part of Bitcoin dealing with 
>> QCs.  On the one hand, you want a very long term plan, many years ahead of 
>> time, so that everyone has time to migrate and not get their coins stolen 
>> or destroyed.  But the further out a QC is, the less likely it seems it 
>> will ever occur, and thus the less reason there is to write software to 
>> deal with a theoretical, far off problem. (And that's not even getting into 
>> the fact that nobody's in charge of Bitcoin so there's no long term roadmap 
>> anyway.)
>>
>> The ability to have a PQ fallback key with zero or very low on-chain cost 
>> helps a lot with this, whichever activation path ends up happening.  
>> Picking something and committing to it in wallets today, before any kind of 
>> activation, is a bit scary since the PQ pubkey does become an exposed 
>> private key.  But I think there is a pretty good way to do it with a 
>> consensus level proof of quantum computer.
>>
>> On Monday, December 16, 2024 at 7:35:47 AM UTC-5 Anthony Towns wrote:
>>
>>
>>
>> - Disabling key path taproot spends via soft-fork is extremely 
>> confiscatory -- for the consensus cleanup, we worry about even the 
>> possibility of destroying funds due to transaction patterns never 
>> seen on the network; here, shutting down key path spends would be 
>> knowingly destroying an enormous range of utxos. 
>>
>>
>> This is true, but faced with a QC you're in trouble either way: either 
>> the coins are destroyed, or the first (non-nice) entity to get a QC steals 
>> them.  We can hope that if the QC ever does arrive there will be enough 
>> warning and coordination that there won't be *too* many of these utxos at 
>> that point.
>>
>> But there are still a lot of lost coins where nobody knows the private 
>> keys anymore and in those cases, the lead time doesn't matter. The original 
>> owners who lost the keys would probably prefer those coins to be destroyed 
>> rather than stolen.  But of course there's no way for them to reliably 
>> express that preference since they can no longer sign.
>>
>> An on-chain proof of quantum computer (PoQC I guess :) ) would be a way 
>> to reduce the damage of activation forks.  One way to build it: Create a 
>> NUMS point pubkey - something like described in BIP341.  Send some coins to 
>> that address, then watch if it gets spent.  Providing a preimage of the 
>> x-coordinate of a point, as well as a valid signature from that point means 
>> that either the hash function is broken or (what we're assuming here) the 
>> one-wayness of the EC base point multiplication has been broken.  Nodes can 
>> then have code which watches for such a proof and changes consensus rules 
>> based on it.
>>
>> This can be useful for the activation, or persistence of a confiscatory 
>> restriction of key path spends.  For example:
>>
>> Say people worry about an immanent QC.  They estimate it will be built in 
>> 5-8 years.  They write software which contains a temporary fork, which 
>> activates in 3 years and *de*activates in 8 years.  This fork disables 
>> almost all key path spends (as well as ECDSA signatures).  The only key 
>> path spends allowed are from the NUMS utxos, and if any NUMS utxo is spent, 
>> then the EC prohibition locks in to become permanent instead of reverting 3 
>> years after initial enforcement.
>>
>> In this case the soft fork is only (permanently) confiscatory if the QC 
>> provably exists and would have (presumably, sooner or later) confiscated 
>> all those coins anyway.  It also could also allow people to enable PQ 
>> signatures and disable EC signatures a bit sooner than they otherwise would 
>> have, since the cost of being wrong about a QC is lessened -- losing EC 
>> operations would be painful, but even more so if it turns out the nearly 
>> finished QC never quite gets there.
>>
>> An opt-in, non-confiscatory fork could also use this mechanism.  A new 
>> P2TR output type (PQ2TR?) could be used which is explicitly not 
>> key-spendable post-PoQC, but the older P2TR, P2WPKH, etc output types are 
>> still EC spendable (better move em quick).
>>
>> It can also work the other way: The new PQ output type can work just like 
>> P2TR, except that one opcode (the OP_PQCHECKSIG) becomes an OP_FAIL until 
>> the PoQC.  Given PoQC, it's OP_SUCCESS.  That way we don't have to have a 
>> consensus level definition the actual PQ signature algorithm yet; we've 
>> just put a placeholder PQ signature opcode in, and an activation method.  A 
>> later soft fork can then define the signature algo.  You'd want to define 
>> it pretty soon after, since wallets committing to PQ pubkeys for schemes 
>> that end up not getting implemented doesn't help.  But it does allow 
>> wallets to do something soon for people who are worried and want to be 
>> "quantum safe".
>>
>> -Tadge
>>
>>
>>
>>

-- 
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-masked].
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/2c9a1ffa-8e7b-4de3-b176-e5b24f3bac9fn%40googlegroups.com.