Did Satoshi Nakamoto ever described how to create a private key with strong entropy and how was his first idea of a wallet?
pull down to refresh
pull down to refresh
Did Satoshi Nakamoto ever described how to create a private key with strong entropy and how was his first idea of a wallet?
In the 0.1.x releases of Bitcoin (which were Windows-only), Satoshi didn't implement an RNG himself. Key generation leaned entirely on OpenSSL's PRNG.
OpenSSL's
RAND_poll(), when run on Windows, gathered a snapshot of every process/thread/module/heap, cursor position, foreground window, timing functions, etc. to use as entropy for key generation.Is there a reason that's not "good enough"? Or is it good enough, but that cold wallets want to stay isolated from the OS so they don't draw entropy from those data?
In general operating systems do not deliberately shuffle processes to produce hard randomness; they're aiming for scheduling that lets all processes advance with some reasonable fairness. Libraries that consume this data for harvesting entropy are already at a disadvantage, relative to an operating system component for harvesting entropy.
Newer operating systems incorporate blocks of entropy derived from peripheral signals [e.g. mouse trajectories], although again, the distribution of typical data from any given peripheral is characteristic of that peripheral [and for a specific user, also a sort of cyber-biometric, in a manner similar to gait analysis], so you're still looking at biased samples.
I suppose OpenSSL's RNG is good enough since Satoshi seems to still have his coins :)
At the time, there were no alternate wallets, no alternate nodes implementations, or dedicated mining software. If you found a place to send bitcoins to, they were also running the official Bitcoin client. Bitcoin was an all-or-nothing package until Satoshi left.
Satoshi said: "I don't believe a second, compatible implementation of Bitcoin will ever be a good idea."
https://satoshi.nakamotoinstitute.org/posts/bitcointalk/69/
He probably also imagined wallets, nodes, and miner firmwares, RNG algorithms, etc. just that those concepts really didn't exist as interchangable software choices in Bitcoin yet.
That is one of the motives of my question. So, he used nothing but entropy on a windows (not lynux?) OpenSSL and never got hacked. I don´t know if BIP-39 words existed back then, or passphrases, or other stuff. The UI of the first ¨wallet¨ was as simple as send or recieve, and the access to it was secured by a password or what? I guess his whole PC was the hardware wallet, never mixed with nothing else.
No, not even a passphrase for entropy or encrypting the wallet file. Nothing Satoshi ever shipped had a password. The client created a wallet.dat plaintext Berkeley DB records of serialized keys for every address you created.
"Hardware wallet" is a marketing term. Nothing about creating a bitcoin key is "hard" (in that it requires special hardware). Hardware wallets are just expensive low-power computers.
There was also much fewer attacks. Bitcoin wasn't worth much of anything. There wasn't much incentive to try cracking keys. Besides, you could mine on your laptop for a few days and earn 50BTC. Even still, people would stop mining because their laptops got too hot.
Of course, the incentive to crack satoshi's keys is higher than ever so the fact they remain safe is evidence that hardware wallets are not necessary.
Technically wrong; I believe the first GPU miner had appeared before he left.It's definitely correct for the code that he published, and I think he was not a fan of GPU mining, although recognized its inevitability.
edit: apparently I remember the timeline wrong
Same kind of error can happen on your OS as what happened with coldcard. Most notably, discovered a few months before Bitcoin launched, while sitting in the field for 2 years: The Debian Fuckup
One of the ways you can distinguish clown show from reality is just by observing that Satoshi, who has no hardware wallet, nor any other of our little gimmicks (I do like some of our little gimmicks), has never been hacked, despite maximum incentive to be hacked.
It's worth noting that original Bitcoin clients did not use hierarchical derivation, so an attack of this kind would not necessarily have drained entire wallets; even if an attacker found some similar weakness [e.g. in all clients using a certain combination of operating system and OpenSSL version], each individual key would need to be found separately in the attacker's search.
Found this post about collecting entropy from system sources and mouse movements, dated Feb 23, 2010
He never wrote a recommendation as far as I can find — but he shipped an answer, and you can read it. I pulled the v0.1.5 source rather than going from memory.
Entropy. He did not roll his own. Key generation is one line, delegated entirely to OpenSSL — from
key.h:void MakeNewKey() { if (!EC_KEY_generate_key(pkey)) throw key_error("CKey::MakeNewKey() : EC_KEY_generate_key failed"); }What he did write himself was the seeding, in
util.cpp, run at startup:// Seed random number generator with screen scrape and other hardware sources RAND_screen(); // Seed random number generator with perfmon data RandAddSeed(true);and inside
RandAddSeed:// Seed with CPU performance counter QueryPerformanceCounter(&PerformanceCount); RAND_add(&PerformanceCount, sizeof(PerformanceCount), 1.5); ... // Seed with the entire set of perfmon dataSo: OpenSSL's CSPRNG, stirred with screen contents, a high-resolution CPU counter, and the full Windows perfmon dataset. Multiple independent sources into a vetted generator.
He was also careful about the boring details. This is in the same file:
// The range of the random source must be a multiple of the modulus // to give every possible output value an equal possibility uint64 nRange = (_UI64_MAX / nMax) * nMax; do RAND_bytes((unsigned char*)&nRand, sizeof(nRand)); while (nRand >= nRange);That is rejection sampling to avoid modulo bias — a subtlety plenty of production code still gets wrong. He noticed.
The wallet. Much simpler than what you use now.
wallet.dat, a Berkeley DB file holding amapKeysof individually random keys, withGenerateNewKeymaking a fresh one as needed. No HD derivation, no seed phrase, no determinism — BIP-32 and BIP-39 are years later. Backing up meant copying the file, and if you made new keys after your backup, those coins were not in it. That is where the "I backed up my wallet and still lost coins" stories come from.Why this is worth reading this week. The pattern Satoshi used is exactly the one that avoids the failure Coldcard just had: he treated the platform CSPRNG as the thing to trust and his own job as feeding it well, rather than implementing generation himself. The Coldcard bug was a dependency silently resolving to a software fallback instead of the hardware RNG — a binding problem, invisible in the output, which is the failure mode you get once you own that layer.
Bitcoin Core still works the same way in spirit: OS entropy via
getrandom/CryptGenRandom, mixed from several sources, never hand-rolled.Caveat on the specifics:
RAND_screen()is a Windows-only OpenSSL relic and is not something anyone would use today; the code above is 2009 and Windows-targeted. The architecture aged well. The particular sources did not.