Sicurezza Bitcoin: quanto è difficile craccare un seed BIP39 a 12 parole Bitcoin security: how hard is it to crack a 12-word BIP39 seed

Quanto è difficile hackerare Bitcoin? Worst case scenario: un milione di GPU, energia a 4 centesimi al kWh, hardware al limite teorico. Servono dieci milioni di anni per craccare un seed BIP39, anche con i computer quantistici. How hard is it to hack Bitcoin? Worst case scenario: one million GPUs, electricity at 4 cents per kWh, hardware at the theoretical limit. Ten million years to crack a BIP39 seed, even with quantum computers.

Dieci milioni di anni.

Questo è il tempo atteso prima che un attaccante con risorse da superpotenza inciampi nel primo wallet Bitcoin già usato. Non è una stima cauta, è un ragionamento per ordini di grandezza, nel worst case scenario che analizza la resistenza dei wallet Bitcoin ad attacchi brute force sulla seed phrase a 12 parole.

Perché conviene attaccare il seed, non la chiave privata

Il riflesso, davanti a un wallet Bitcoin, è pensare alle chiavi private a 256 bit come al bersaglio dell’attacco. Da un punto di vista puramente matematico è invece la scelta peggiore: un cacciatore di collisioni razionale itera sulle combinazioni di 12 parole e ignora completamente lo spazio delle chiavi grezze. Il motivo si riduce a un concetto solo, la densità dei bersagli.

Lo spazio delle chiavi private a 256 bit contiene 22561.15×10772^{256} \approx 1.15 \times 10^{77} combinazioni. Per un confronto, basti pensare che gli atomi nell’universo osservabile sono nell’ordine dei 108010^{80}

Lo spazio dei seed BIP39 a 12 parole, al netto del checksum, contiene invece 21283.4×10382^{128} \approx 3.4 \times 10^{38} combinazioni. Lo spazio a 128 bit è esattamente 3.4×10383.4 \times 10^{38} volte più piccolo di quello a 256 bit. Trentanove ordini di grandezza di vantaggio probabilistico per chi attacca il seed invece della chiave, gratis.

Vero è che calcolare un indirizzo pubblico a partire da una chiave privata costa pochissimo, mentre iterare sui seed costa caro: lo standard BIP39 impone 2048 round di PBKDF2 su HMAC-SHA512 prima ancora di toccare la curva ellittica, e quei round sono lì apposta per rallentare l’attacco. Anche assumendo però che l’hardware riesca a testare chiavi private centomila volte più velocemente dei seed, il conto è cinque ordini di grandezza contro trentanove. Questa obiezione avrebbe senso solo nello scenario in cui ogni wallet avesse 21282^{128} indirizzi usati. Non è il caso.

Quanti wallet al secondo riesce a sfornare l’hardware

Per pesare correttamente l’attacco serve sapere quanto è veloce, in pratica, generare un wallet completo. Per produrre un singolo wallet e il suo primo indirizzo il processore deve macinare in sequenza:

  1. BIP39 (seed): 2048 iterazioni di HMAC-SHA512.
  2. BIP32/BIP44 (derivation path): 4 o 5 derivazioni gerarchiche, ciascuna con moltiplicazioni scalari e addizioni di punti sulla curva ellittica secp256k1, più ulteriori passaggi di HMAC-SHA512.
  3. Indirizzo: un giro di SHA-256 seguito da RIPEMD-160.

Lavorando in parallelo estremo, una GPU enterprise (NVIDIA H100, H200, Blackwell B100/B200) con codice CUDA scritto a regola d’arte ha un limite superiore plausibile nel migliore dei casi attorno a 10710^7 wallet al secondo. Numero generoso, e proprio per quello va tenuto come riferimento del worst case.

Facciamo due conti

Come dati di partenza abbiamo:

  • Spazio di ricerca: N=21281038N = 2^{128} \approx 10^{38} Seed.
  • Secondi in un anno 107\approx 10^7.

Ragionando per ordini di grandezza, mettiamoci nella posizione più sfavorevole in assoluto:

  • Gpu usate: 1 milione, ognuna con vita infinita, spinte al limite teorico di 10710^7 wallet al secondo: 106×107=1013 wallet/s.10^6 \times 10^7 = 10^{13} \text{ wallet/s.}.
  • Dieci wallet a testa moltiplicati per dieci miliardi di persone: T=10×1010=1011T = 10 \times 10^{10} = 10^{11} wallet usati

Questo significa che l’attaccante è in grado di generare 1013×107=1020 wallet/anno.10^{13} \times 10^7 = 10^{20} \text{ wallet/anno.}

Considerando i bersagli come uniformemente distribuiti nello spazio dei seed, il numero atteso di tentativi prima di trovarne uno (valore atteso della distribuzione geometrica) è E[tentativi]=NT=10381011=1027E[\text{tentativi}] = \frac{N}{T} = \frac{10^{38}}{10^{11}} = 10^{27}.

Da cui si ottiene che il tempo atteso per il primo hit è 10271020=107 anni.\frac{10^{27}}{10^{20}} = 10^{7} \text{ anni.}

Dieci milioni di anni per trovare un singolo wallet già usato, assumendo il miglior hardware ipotizzabile, un parco GPU che nessuna entità al mondo possiede oggi, e una flotta interamente dedicata a questo task per tutta la sua vita utile.

Analizzando i risultati, Una H100 SXM ha un TDP di 700 W. Un milione di queste schede consuma, di solo silicio:

106×700 W=7×108 W=700 MW.10^6 \times 700 \text{ W} = 7 \times 10^8 \text{ W} = 700 \text{ MW.}

Aggiungendo raffreddamento, alimentazione e infrastruttura, possiamo stimare un consumo di 1 GW. Wnergia annua: 1 GW×8760 h=8.76 TWh.1 \text{ GW} \times 8760 \text{ h} = 8.76 \text{ TWh.}. Più o meno metà del consumo elettrico annuo dell’Islanda intera, solo per la farm.

Tariffa industriale bassa, sempre scegliendo il caso favorevole all’attaccante, mettiamo 4cent. Costo elettrico annuo: 8.76×109 kWh×4¢=3.5×1088.76 \times 10^9 \text{ kWh} \times 4¢ = 3.5 \times 10^8 dollari.

Circa 350 milioni di dollari l’anno di bolletta. Ogni anno, per tutto il tempo dell’attacco. L’energia totale spesa, in joule, si piazza intorno ai 3×10233 \times 10^{23}, all’incirca 500 volte il consumo energetico totale dell’umanità in un anno. Tutto questo per un wallet, che potrebbe anche essere usato ma vuoto.

E i computer quantistici?

Ogni volta che si parla di sicurezza crittografica salta fuori il quantum panic, quindi conviene chiudere anche quel fronte. L’algoritmo di Grover offre uno speedup quadratico sulla ricerca non strutturata, e questo significa che sullo spazio dei seed BIP39 a 128 bit la sicurezza effettiva crolla a

2641.8×1019 operazioni quantistiche.2^{64} \approx 1.8 \times 10^{19} \text{ operazioni quantistiche.}

Sulla carta è un crollo violento. In pratica conta meno di quanto si pensi. Anche assumendo un computer quantistico ipotetico che sostenga 10910^9 operazioni utili al secondo (ordini di grandezza sopra qualsiasi hardware reale), Grover richiederebbe ancora circa 570 anni di esecuzione continua per un singolo seed. E quel 10910^9 è una stima fantascientifica, l’hardware attuale è lontanissimo dal sostenere coerenza, fidelity e correzione d’errore necessarie a far girare Grover su problemi di questa scala, e sarà così per svariati anni a venire.

Shor è un discorso a parte, e attacca le chiavi pubbliche esposte sulla blockchain, non i seed. Va affrontato separatamente, ma sui wallet che non hanno mai speso non si applica. Per ora, e per parecchio tempo, il quantum non sposta il muro.

La seed phrase non è a rischio

Worst case totale a favore dell’attaccante, hardware al limite teorico, energia a tariffa industriale minima e popolazione di wallet sovrastimata: il tempo atteso resta dieci milioni di anni, e il costo viaggia nei quadrilioni di dollari. Le ottimizzazioni realistiche che si possono immaginare spostano la soglia di uno o due ordini di grandezza al massimo, e non basta.

L’unica superficie d’attacco che resta sul tavolo è quella umana. Foto al foglio di backup, screenshot del seed, password manager bucati, phishing, supply chain compromessa, social engineering. È lì che un attaccante razionale investe tempo e capitale, perché il lato matematico è chiuso e quello umano notoriamente no.

Ten million years.

That’s the expected time before an attacker with superpower-grade resources stumbles upon the first already-used Bitcoin wallet. This isn’t a conservative estimate; it’s a worst-case, order-of-magnitude projection that examines the resistance of Bitcoin wallets to brute force attacks against the 12-word seed phrase.

Why attacking the seed is better than attacking the private key

The immediate instinct when looking at a Bitcoin wallet is to target the 256-bit private keys of the attack. From a purely mathematical standpoint that’s instead the worst possible choice: a rational collision hunter iterates over the 12-word combinations and completely ignores the raw key space. The reason boils down to a single concept, target density.

The 256-bit private key space contains 22561.15×10772^{256} \approx 1.15 \times 10^{77} combinations. For comparison, the atoms in the observable universe are on the order of 108010^{80}.

The BIP39 12-word seed space, excluding the checksum, instead contains 21283.4×10382^{128} \approx 3.4 \times 10^{38} combinations. The 128-bit space is exactly 3.4×10383.4 \times 10^{38} times smaller than the 256-bit one. That’s a free, 39-order-of-magnitude probabilistic advantage for anyone attacking the seed instead of the key.

True, computing a public address starting from a private key is dirt cheap, while iterating over seeds is expensive: the BIP39 standard mandates 2048 rounds of PBKDF2 over HMAC-SHA512 before you even touch the elliptic curve, and those rounds are there precisely to slow down the attack. Even assuming that hardware can test private keys a hundred thousand times faster than seeds, the tradeoff is five orders of magnitude in computational cost versus thirty-nine in target density. This objection would make sense only in a scenario where every wallet had 21282^{128} used addresses. It doesn’t.

How many wallets per second can hardware actually produce

To weigh the attack correctly you need to know how fast, in practice, a complete wallet can be generated. To produce a single wallet and its first address the processor has to grind through, in sequence:

  1. BIP39 (seed): 2048 iterations of HMAC-SHA512.
  2. BIP32/BIP44 (derivation path): 4 or 5 hierarchical derivations, each with scalar multiplications and point additions on the secp256k1 elliptic curve, plus further HMAC-SHA512 passes.
  3. Address: one round of SHA-256 followed by RIPEMD-160.

Working in extreme parallel, an enterprise GPU (NVIDIA H100, H200, Blackwell B100/B200) with CUDA code written by the book has a plausible upper bound, in the best case, around 10710^7 wallets per second. This is a generous estimate, making it the perfect worst-case benchmark.

Let’s do the math

As starting data we have:

  • Search space: N=21281038N = 2^{128} \approx 10^{38} seeds.
  • Seconds in a year 107\approx 10^7.

Reasoning by orders of magnitude, let’s put ourselves in the most unfavorable position possible:

  • GPUs in use: one million, each with infinite lifetime, pushed to the theoretical limit of 10710^7 wallets per second: 106×107=1013 wallets/s.10^6 \times 10^7 = 10^{13} \text{ wallets/s.}
  • Ten wallets per person across a population of ten billion: T=10×1010=1011T = 10 \times 10^{10} = 10^{11} used wallets.

This means the attacker can generate 1013×107=1020 wallets/year.10^{13} \times 10^7 = 10^{20} \text{ wallets/year.}

Considering the targets as uniformly distributed in the seed space, the expected number of attempts before finding one (expected value of the geometric distribution) is E[attempts]=NT=10381011=1027E[\text{attempts}] = \frac{N}{T} = \frac{10^{38}}{10^{11}} = 10^{27}.

From which we get that the expected time to the first hit is 10271020=107 years.\frac{10^{27}}{10^{20}} = 10^{7} \text{ years.}

Ten million years to find a single already-used wallet, assuming the best hardware imaginable, a GPU fleet that no entity in the world owns today, and an operation entirely dedicated to this task for its whole useful life.

Looking at what these numbers mean in practice, an H100 SXM has a TDP of 700 W. One million of those cards consume, in silicon alone:

106×700 W=7×108 W=700 MW.10^6 \times 700 \text{ W} = 7 \times 10^8 \text{ W} = 700 \text{ MW.}

Adding cooling, power delivery and infrastructure, the realistic facility load is around 1 GW. Annual energy: 1 GW×8760 h=8.76 TWh.1 \text{ GW} \times 8760 \text{ h} = 8.76 \text{ TWh.}. Roughly half the annual electricity consumption of Iceland in its entirety, only for the farm.

Assuming a rock-bottom industrial electricity rate of 4¢/kWh4¢/kWh to give the attacker every possible advantage: annual electricity cost: 8.76×109 kWh×4¢=3.5×1088.76 \times 10^9 \text{ kWh} \times 4¢ = 3.5 \times 10^8 dollars.

Around 350 million dollars a year of electricity bills. Every year, for the entire duration of the attack. The total energy spent, in joules, comes in around 3×10233 \times 10^{23}, roughly 500 times the total energy consumption of humanity in one year. All of this for one wallet, which might even turn out to be used but empty.

What about quantum computers?

Whenever cryptographic security is discussed, quantum panic inevitably follows. Let’s shut that down, too. Grover’s algorithm offers a quadratic speedup on unstructured search, which means that on the 128-bit BIP39 seed space the effective security collapses to

2641.8×1019 quantum operations.2^{64} \approx 1.8 \times 10^{19} \text{ quantum operations.}

On paper, this looks like a catastrophic collapse. In practice, it’s practically irrelevant. Even assuming a hypothetical quantum computer sustaining 10910^9 useful operations per second (orders of magnitude above any real hardware), Grover would still take around 570 years of continuous execution for a single seed. And that 10910^9 is a science-fiction estimate: current hardware is nowhere near sustaining the coherence, fidelity and error correction needed to run Grover on problems at this scale, and it will stay that way for several years to come.

Shor is a separate story, and attacks public keys exposed on the blockchain, not seeds. It deserves its own treatment, but on wallets that have never spent it doesn’t apply. For now, and for quite a long time, quantum doesn’t move the wall.

The seed phrase isn’t at risk

Total worst case in the attacker’s favor, hardware at the theoretical ceiling, electricity at the minimum industrial tariff, an inflated wallet population: the expected time stays at ten million years, and the cost run into the quadrillions of dollars. The realistic optimizations one can imagine shift the threshold by one or two orders of magnitude at most, and it’s not enough.

The only attack surface that’s left on the table is the human one. Photos of the backup sheet, screenshots of the seed, compromised password managers, phishing, supply chain attacks, social engineering. That’s where a rational attacker invests time and capital, because the math is bulletproof, and human nature famously isn’t.


Note: this article was automatically translated from Italian by AI.