Random Number Generator
A Random Number Generator (RNG) produces unpredictable numbers essential for cryptographic security in blockchain, such as generating private keys and nonces.
What Is a Random Number Generator?
A random number generator (RNG) produces values nobody can predict. In a wallet it supplies the entropy from which the seed, and with it every private key, is created. If that randomness can be guessed or repeated, someone else can recompute the keys, whatever else the device does right.
There are two kinds. A true random number generator (TRNG) measures a physical process such as electronic noise in a chip. A pseudo-random generator stretches a starting value into a long sequence with an algorithm; it is fit for cryptography only if the algorithm was designed for that and the starting value is itself unpredictable. Devices usually combine both, and many mix several sources so that a fault in one does not ruin the result.
Hardware wallets typically take entropy from a TRNG in the secure element or the microcontroller. Because a user cannot inspect a chip's output, some wallets let you add your own entropy with dice rolls, and open-source firmware lets others review how the sources are combined.
Failures have cost money. In 2013 a flaw in Android's random number generator made some Bitcoin wallet apps reuse a signature nonce, which exposed private keys. Signatures need unpredictable nonces too, which is why modern wallets derive the nonce deterministically from the key and the message.
Real-World Examples
Example 1: Setting up a Keystone 3 Pro, a user chooses the dice-roll option and rolls dice to create the seed, so that it does not depend only on the device's chip.
Example 2: Researchers find that a wallet app seeded its generator with too little entropy. Every recovery phrase it created falls into a range small enough to search, and the affected wallets are emptied.
Frequently Asked Questions
Should I add dice rolls when creating my seed?
It is an option, not a requirement. Because a user cannot inspect a chip's output, some wallets let you add your own entropy with dice rolls, so the seed does not depend only on the device's generator. Open-source firmware offers a different kind of check: others can review how the entropy sources are combined.
What happens if a wallet's random number generator is weak?
If its output can be guessed or repeated, someone else can recompute the seed and every private key, whatever else the device does right. A generator seeded with too little entropy produces recovery phrases in a range small enough to search, and wallets created with it can be emptied.
Why do signatures also need unpredictable numbers?
Each signature uses a nonce, and a reused nonce can expose the private key. In 2013 a flaw in Android's random number generator made some Bitcoin wallet apps reuse a signature nonce, which exposed private keys. Modern wallets avoid this by deriving the nonce deterministically from the key and the message.
Ready to Choose a Secure Wallet?
Use our tools to find the right hardware wallet for your needs.