<p>The Bitcoin software has always used OpenSSL's random number generator in some way to generate private keys. Originally, it just used OpenSSL's <code>EC_KEY_generate_key</code> function to generate a new key and OpenSSL would handle the RNG and object creation. Even now, Bitcoin Core still uses OpenSSL's RNG and mixes it's output with several other sources of randomness in order to generate private keys.</p>

CC BY-SA 4.0
2019-07-15T13:45:03.980Z
2019-07-15T13:45:03.980Z
Ava Chow
<p>I'm a newbie at this, but I have a question.</p>

<p>How did the original Bitcoin (Core) v0.1 program generate random private keys? I was hoping for the exact source code or at least a good description of the method used. </p>

<p>I understand (almost) any 32 byte integer will work as a private key. I assume they used a Windows based OS random generator CryptGenRandom() since it was released for Win XP initially, I think. </p>

<p>Thanks!</p>

<bitcoin-core><bitcoin-core-development>
Original Bitcoin (Core), how did it generate private key?
Newbie Monica
# Original Bitcoin (Core), how did it generate private key?

(Asked by: username_0 on 2019-07-15)

I'm a username_0 at this, but I have a question.

How did the original Bitcoin (Core) v0.1 program generate random private keys? I was hoping for the exact source code or at least a good description of the method used.

I understand (almost) any 32 byte integer will work as a private key. I assume they used a Windows based OS random generator CryptGenRandom() since it was released for Win XP initially, I think.

Thanks!

**Tags:** bitcoin-core, bitcoin-core-development


---

## 1 answers

### Answer by username_1 on 2019-07-15. Score: 2

The Bitcoin software has always used OpenSSL's random number generator in some way to generate private keys. Originally, it just used OpenSSL's `EC_KEY_generate_key` function to generate a new key and OpenSSL would handle the RNG and object creation. Even now, Bitcoin Core still uses OpenSSL's RNG and mixes it's output with several other sources of randomness in order to generate private keys.


---

