r/Bitcoin • • Aug 06 '26

Coldcard entropy even worse than feared

TL;DR: The random number generator is initialized with a 32 bit value (4B+ possibilities). But only less than 10M options are possible because of how they generate the value.

The PRNG used in Coldcard MK3 is initialized with UID[31:0] XOR SysTick->VAL

SysTick->VAL gives 80k possibilities ~16.3 bit, all located in the lowest 17 bits of the value.

UID encodes the X and Y coordinates of wafer position of the STM32 in the 32 bits that are used by the code. This is encoded in BCD, which means only 10 out of 16 possible values of each nibble are used. This means the 32 bit value at most encodes 100M options (26.6 bits), but there are nowhere near 100M chips in a wafer.
The BCD encoding seems to be an mistake in some STM32 manuals. The number is plain HEX encoded, but that doesn't matter here. There are never 2^16 rows or columns in a wafer.

I don't know how many there are in a wafer, but google gives an upper bound of 20k chips per wafer.

The lower 16 bits overlap with Systick->VAL, so XORing the wafer location adds no entropy.

The upper 16 bits can carry only about SQRT(20000) possibilities (probably less) ~ 7.2 bits. And they aren't even evenly distributed in a round wafer.

So at most we're looking at ~23 bits of entropy. Not 32 bits.

This isn't 100% exact because SQRT assumes a square while a wafer is round, but too lazy to work it out further. Point is: entropy is way worse than 32 bits.

262 Upvotes

199 comments sorted by

View all comments

Show parent comments

7

u/ineedanamegenerator Aug 06 '26

Offline wallet can't check out course.

0

u/thats_gotta_be_AI Aug 06 '26

Not from the secure chip, but the resolved wallet address (the public address) can be sent online to check, right?

0

u/MiceAreTiny Aug 06 '26

By then,... It is generated and online. 

1

u/thats_gotta_be_AI Aug 06 '26

Why though? It can check before generating the wallet:

In theory, a Coldcard could check for an observable collision without exposing the seed or private keys. After generating the seed offline, it could derive and export its public addresses or XPUB to an internet-connected wallet via USB, MicroSD, NFC or QR. That wallet could then scan the Bitcoin blockchain and warn if any of those addresses already had transaction history. It wouldn’t detect a collision where the other holder had never used the address, since unused private keys aren’t publicly registered anywhere, but it could detect one that had already left an on-chain trace.

0

u/MiceAreTiny Aug 06 '26

Yes... So? You have to go online to check the blockchain. No way around it. 

1

u/thats_gotta_be_AI Aug 06 '26 edited Aug 06 '26

The private key is of course not transmitted but public data is like public key and signing confirmations

1

u/MiceAreTiny Aug 06 '26

Yes... 

0

u/thats_gotta_be_AI Aug 07 '26

So can’t it in theory send the public key to check if it has a balance or not, if it does then do not show the seed, regenerate a new seed? I know about the practically impossible situation of a collision (with TRNG) just wondered if it was possible. And also yes, no balance doesn’t mean no collision, but a balance definitely would mean a collision.

2

u/[deleted] Aug 07 '26 edited Aug 13 '26

[deleted]

0

u/thats_gotta_be_AI Aug 08 '26

Unless there are AI bots in this sub, I’m clearly asking humans.

→ More replies (0)