Damus
waxwing profile picture
waxwing
@waxwing
in the interests of saying something useful instead of idle musing:

We're all fretting about sourcing entropy for our master secrets (seed phrases if you prefer), but what about for the nonces we use when we sign?

Normal signing can use RFC6979 [1], also known as 'deterministic nonces': this trick means your wallet *doesn't need* to source any entropy/randomnes when it makes a signature; it creates a 'pseudorandom' value that is tied to the private key and the transaction you're signing; no one can figure it out, and you yourself can't screw up and accidentally use a low entropy, or repeated nonce. All good so far.

So the headline is, for most of us, nothing to worry about with nonces, ever. However there are 2 bad things: the first is very counterintuitive but worth explaining: a master secret can be a few bits short in entropy (say, 120 bits instead of 128 of pure randomness) and it's very unlikely to ever matter. But this is not true of nonces! If you sign say 100 times with a private key p, and you use nonces k that are just *a few bits less random than full 256 bits* you can leak your private key to a sophisticated mathematical attack. In this, you might think, 'well I don't use addresses so there'll never be 100 signatures on one key p' -- but, careful: if you use an HD wallet (and everyone does), then knowing the pubkey means knowing the relationship between all the private keys on the branch, so the attack can still work if the attacker knows the xpub. **None of this matters if you use RFC6979**.

Second bad thing: RFC6979 cannot be used in MuSig2 or DahLIAS. It is profoundly insecure. It can be used, of course, in traditional multisig.

[1] RFC written by thomas pornin back in 2013; outside of bitcoin it's not well known, as most people back in the day, outside of bitcoin, thought using bernstein curve25519 was the solid industry standard and bitcoin's secp256k1 ECDSA was weird flaky nonsense that 'didn't even have deterministic nonces'; true, it originally didn't until this standard arrived [2]; btw people like Greg Maxwell were actively reviewing with Pornin at the time. As I recall Greg didn't like it a huge amount because it is quite an obscure construction and not so easy to byte-for-byte implement correctly. But obviously the idea is not only sound, but absolutely vital.

[2] and true, ECDSA *is* weird flaky nonsense...
92❤️5❤️1👀1🖤1🤔1
Victus Bota · 2w
Alternative method for cold storage. The only cost is a USB stick. https://tails.net/about/index.en.html https://electrum.readthedocs.io/en/latest/coldstorage.html
Sjors · 2w
What's the impact on MuSig2 if *one* of two signers has bad entropy for their nonce? Assuming the signers are not adversaries.
waxwing · 2w
On reflection I guess "nothing to worry about, ever" was dumb language - what if your wallet *thinks* it uses rfc6979, but doesn't do it properly. Thankfully libsecp library has this built in.
lontivero · 2w
This is a disaster waiting to happen. Those in what I call "the cult" not only collect xpubs but also send derived private keys to untrusted servers also maintained by them. That will be the Coldcard incident, it is just a matter of time.
BITKARROT · 2w
Dan Boneh just gave a talk yest about post quantum sigs, paper due out in a week.
Chil S · 2w
The lower 1 bit bias was and is a sharp sword hanging over all nonce signatures. Signature harvest is toxic waste, an incident in the advent of such kind of AI and decent cheap GPU time to keys to happen seemingly out of the nowhere. Even when doing best practices. Never sign twice with the same k...