This article was translated from Japanese with AI. Read the original (日本語) · Report a translation issue

In the wake of the Coldcard seed generation vulnerability, Bitcoin users have become increasingly interested in generating seeds from manually produced entropy (random data), such as dice rolls.

Generating the seed phrase is only the very first step in creating a wallet, but if something goes wrong here, there's no fixing it later. As with this incident, you end up rushing to move your funds to a different wallet before the problem bites, and if you're unlucky, you might not make it in time. Against a problem like Coldcard's, the measures we can take are

  • Setting a passphrase as strong as the seed phrase itself
  • Generating the seed phrase from natural entropy instead of relying on software-based randomness, which may harbor serious vulnerabilities

and that's about it (of course, every hardware wallet maker is working hard to make its seed generation less prone to weaknesses). In self-custody, getting the start right is everything.

In this article, I'll revisit how to generate a random seed phrase using dice or playing cards, as a practical guide. Each method takes less than an hour, so I encourage you to try it yourself some weekend, like a little science project.

💡
Note that the methods introduced here can produce seed phrases good enough for real use. If you plan to actually use the seed phrase you generate, pay attention to your surroundings while generating it, and make sure that neither the seed phrase nor your dice rolls are visible to other people or within range of any camera.

I also walk through the process in a video, so be sure to watch it.

How a seed phrase is created from entropy

A Bitcoin seed phrase is 128 bits (12 words) or 256 bits (24 words) of entropy, encoded as English words so that people can easily copy it down. The detailed specification is published as BIP-39.

bips/bip-0039.mediawiki at master · bitcoin/bips
Bitcoin Improvement Proposals. Contribute to bitcoin/bips development by creating an account on GitHub.

BIP-39, now supported by almost every wallet, was proposed around 2013 by SatoshiLabs (the developer of Trezor). Before that, the standard way to back up a Bitcoin wallet was to copy your Bitcoin Core wallet file to a USB drive or similar, which had serious problems in terms of both security and storage. Being able to save a wallet as a simple string of words was a major innovation in keeping people from easily losing their bitcoin.

In BIP-39, each word corresponds to 11 bits of data

A BIP-39 mnemonic (seed phrase) represents a bit string (binary data) by choosing words from a list of 2,048 words, each word corresponding to a particular bit sequence. Concretely, it looks something like the diagram below:

BIP39 encodes 11 bits of data per word.

So, to put it very simply, if you convert each of the 12 or 24 words into binary according to its position in the word list, you can recover the entropy that the seed phrase represents. Since this entropy is what the wallet is built from, the seed phrase can be used for recovery.

bips/bip-0039/english.txt at master · bitcoin/bips
Bitcoin Improvement Proposals. Contribute to bitcoin/bips development by creating an account on GitHub.

The numbers next to the words in the word list on the GitHub page are line numbers in the file, but the actual data values start at 0, so they are off by one from those numbers.

Only the last word contains a checksum, which narrows down the options

Sharp readers may already have noticed something. 11 bits × 12 words = 132 bits, which doesn't match the explanation that 12 words represent 128 bits. And 11 bits × 24 words = 264 bits, again a bit more than 256 bits. This difference is called the checksum: a built-in mechanism for detecting when the first 11 words haven't been written down correctly.

For example, with 12 words, the first 7 bits of the 12th word are random data and the last 4 bits are the checksum. With 24 words, the checksum is 8 bits.

The length of the checksum depends on the length of the seed phrase, but it is contained in the last word.

It exists to guard against mistakes when copying the words down. If the checksum doesn't match, your wallet will most likely warn you.

Also, with 24 words, the last word contains only 3 bits of entropy, and the checksum is derived by calculation, so there are only 8 possible candidates for the 24th word. This will become important later.

💡
Unfortunately, calculating the checksum involves a hash computation, so doing it by hand isn't realistic. That means you'll need help from something like a hardware wallet, though how much you rely on that help can vary. I'll cover this later as well.

All you need is random data to make a seed phrase

From all this, you can probably picture how, as long as you have random binary data, you can generate a seed phrase by mapping it in order onto the BIP-39 word list.

The easiest way to picture generating random binary data is probably a coin toss. Decide that heads = 1 and tails = 0, don't fix which side is up when the coin rests on your thumb, and make each toss a proper one that spins many times in the air, and you can generate a seed phrase.

But tossing a coin 256 times sounds like a recipe for a sore thumb, so I'll introduce two methods using handy items you probably have around: dice and playing cards.

Is a seed phrase you generate yourself really secure?

Before that, let me convince you that this exercise is safe. If you've read the earlier article below, feel free to skip this part.

サイコロによる乱数生成はどれくらい安全なのか?24単語のシードフレーズが選べる理由
サイコロで生成するシードフレーズはどこまで安全なのか?偏りの影響、24単語との関係、ハードウェアウォレットが生成するシードとの比較まで分かりやすく解説します。

I often see people worry: "Generating a seed with dice or playing cards sounds flimsy. If the dice aren't precise, won't that produce a weak seed?" Rest assured. As long as you use reasonably ordinary dice or cards and generate 24 words' worth of entropy, there's no problem at all.

Mathematically, a trial that yields one of N outcomes with equal probability contains log2(N) bits of information. Plugging in some simple examples, you can see that getting 256 bits of entropy takes 256 coin tosses, or 99–100 rolls of a die.

Aim for 256 bits of entropy with dice and you'll be quite safe

So what about a shoddy die? Since aiming for 256 bits is very safe, let's assume we roll it 100 times, the same as an ideal die.

Even a die that only ever shows 1, 2 or 3 yields 158 bits of entropy over 100 rolls

With 100 rolls you get 158 bits, which is stronger entropy than an ideal 12-word seed phrase.

When the probability distribution itself is skewed, there's a calculation called Shannon entropy. For example, for a die that shows 1 with 60% probability and 2 and 3 with 20% probability each, it works out as follows:

Even an outrageously biased die yields 137 bits of entropy over 100 rolls

That's 137 bits per 100 rolls, once again more entropy than a 12-word seed phrase. So even a ridiculous die like this one would be fine.

That said, deliberately using a weak entropy source is a bad idea, so at least use a normal die. And for safety, generate 24 words unless you have a very good reason not to.

💡
Seed phrases come in 12 words (128 bits) and 24 words (256 bits), but in fact the keys used for Bitcoin addresses only provide 128 bits of security. The reason 24 words support 256 bits of entropy anyway is as a safeguard in case "the random numbers were biased and there was less entropy than expected." So if you care enough about randomness to generate your own seed, always generate 24 words.
💡
This strays a little from the point of this article, but some argue that random data properly generated by a machine is higher quality than random data generated by humans, even with dice, and that humans may end up producing weak seed phrases by adding their own creative touches like the ones above. Indeed, if you could gather a large amount of independent entropy from as many different sources as possible, you'd be less affected by weaknesses in any individual source, which would be ideal.

On the other hand, machines can have weak random number generation due to design or software problems, and for ordinary users they are an entropy source that's harder to verify than dice. In fact, this Coldcard incident was a case where that theoretical threat became real.

You can see this tradeoff reflected as a difference in philosophy across various products. For example, hardware wallets that offer dice-based seed generation as a feature tend to be niche devices aimed at advanced users.

As a further aside, the earlier article below introduces von Neumann's algorithm as "a way to get true random numbers from a biased die," so take a look if you're interested.

紙とペンでシャミアの秘密分散法を使いシードフレーズを分割する:Codex32
コアなビットコイナーは秘密鍵の管理にうるさかったり、一家言ある人が多いというイメージはありませんか?少なくとも自分の印象ではWeb3系の人たちよりよほど秘密鍵の生成や管理に関心がある気がします。 ビットコイナーの一部の間ではマルチシグによって自身のコールドストレージのセキュリティを強化する人も見られるようになりました。しかし通常のシードフレーズとは異なり、複数のシードフレーズとスクリプト文のデータなどを用意し別々の場所で安全に保管するのが煩雑なのも間違いありません。 他にはシャミアの秘密分散法という知名度の高い手法を使って1つのシードフレーズを複数の「シェア」に分割し、それらのシェアを使ってn-of-mのマルチシグを擬似的に再現することも考えられます。実際には1つのシードフレーズを復元するので狭義のマルチシグトランザクションにはなりませんが、比較的シンプルな手法で(ビットコイン以外のブロックチェーン系のウォレットで)人気があります。 例えば友人や親戚にシェアを1つ預けてソーシャルリカバリーできるようなウォレットの多くはこのスキームになっています。数人に結託して裏切られないように注

If you're now convinced that dice can generate a sufficiently random seed phrase, let's get right into how to do it.

Generating a seed phrase with dice is the standard approach

There are many conceivable ways to generate a seed from dice, but they mainly fall into two approaches.

Entering each die roll directly into a hardware wallet one by one and letting it generate the seed phrase

Entering die rolls directly into a hardware wallet

This method works with devices such as Coldcard, SeedSigner and Krux that offer a feature for entering dice rolls into the hardware wallet. You roll the die and enter each result into the hardware wallet as you go. What's nice about this method is that you can roll as many times as you like, so if you're nervous, you can roll 200 times. (Rolling too few times is risky, so always roll at least 100 times.)

Inside the hardware wallet, the dice rolls appear to be treated as a single continuous string of text, which is run through a hash function called SHA256 to shape it into 256 bits that are then used as the entropy. Finally, an 8-bit checksum is added and the result is converted into a seed phrase.

Although the result ends up as 256 bits, the advantage is that you can start by generating more entropy than that, anticipating that the dice entropy might be weak.

The advantage: if you roll the dice extra times, that extra randomness genuinely counts toward the underlying entropy

The downside, on the other hand, is that it's hard for a human to verify that the SHA256 calculation was done correctly, so you'll want a verification step, such as generating the seed the same way on a different wallet (you can also generate a seed you don't intend to use and check it with something like a web-based tool).

💡
Realistically, I'd think a Bitcoin wallet would only get SHA256 wrong if the wallet were malicious, but it's nice to be able to guard even against malice.

Generating the first 23 words by hand and choosing the last word from the candidates a hardware wallet suggests

If, on the other hand, you prefer something you can verify at a glance, you can determine the words directly from dice rolls using a method called Diceware. There are many variations in the details, but any of the ones introduced here will generate a random seed.

Several methods for generating a seed phrase manually from dice are published online; I've linked three guides below. Blockstream Jade's guide requires 16-sided and 8-sided dice, items probably only board game enthusiasts own, but it's a well-made guide. BitBox's guide combines five dice and one coin. The binary → BIP39 word list I created includes comments on how to do it with an ordinary six-sided die.

Create a recovery phrase using dice
Get help for the Blockstream app, Jade, Satellite, Liquid Network, and Explorer API. Guides, how-tos, and troubleshooting.

Under "View our downloadable guide" you can view a PDF explaining how to generate the first 23 words

Roll your own Bitcoin seed
Learn how to create your own random Bitcoin hardware wallet seed with these easy step-by-step instructions.

Open "BitBox02 Diceware instructions" and "BitBox02 Diceware lookup table" as well

Binary bits to BIP39 words (English)
Binary bits to BIP39 words (English). GitHub Gist: instantly share code, notes, and snippets.

Each roll of a six-sided die determines 1–2 bits, which you then look up in the list to convert into words

Basically, you convert dice rolls or similar into a bit string and determine the words one after another. Once you've determined 23 words, the last word can't be determined by hand, so you'll use the "restore/import" menu of a hardware wallet or similar.

If you use a hardware wallet such as BitBox, Jade or SeedSigner that suggests the 24th word once you've entered 23 words in its "restore" menu, you'll pick the 24th word from a list. Every word that appears in this list passes the checksum, so again, choose the 24th word with dice, a coin toss, rolling a pencil or the like.

And with that, your 24-word seed phrase is complete. You should be able to confirm that the first 23 words you chose are indeed being used. You now have a seed phrase that doesn't depend on any hardware or software.

You can also generate a seed phrase with playing cards

Most people probably have either dice or a deck of cards at home, and you can generate a seed phrase with playing cards too. It's a lesser-known method, but there's a repository published as Seed Picker Solitaire, and the exchange Bull Bitcoin even sells a deck of playing cards as merchandise:

GitHub - jimbojw/seed-picker-solitaire: Generate a BIP39 seed phrase offline using an ordinary deck of playing cards.
Generate a BIP39 seed phrase offline using an ordinary deck of playing cards. - jimbojw/seed-picker-solitaire

Please refer to the links above for detailed instructions, but in brief:

  1. Shuffle the cards thoroughly (at least 7 times; a riffle shuffle or a pile shuffle is preferable. See the GitHub link for details)
  2. Turn over the first two cards. If they're the same suit, start over from step 1
  3. Open the lookup table for the first card. The second card determines the corresponding word (in some cases there's no word, and you start over)
  4. Return the cards to the deck and go back to step 1

You repeat this 23 or more times, then have a hardware wallet or similar present candidates for the 24th word, as described earlier.

I feel the card-based lookup tables for BIP39 words are easier to read than the ones that convert from bit strings. It's purely a matter of taste, but I still feel more at ease with dice. (There does seem to be plenty of research on card shuffling, so if you're interested, it might be fun to look into it.)

Generating a seed phrase without relying on machines is easy; the rest is a question of how you weigh the tradeoffs

As we've seen in this article, it's easy to use dice or playing cards to generate entropy that doesn't rely on machines or software, and to create a seed phrase from it. Those well versed in computer science might also be able to add some other source of entropy (for example, generating 256 bits of entropy on a PC and XORing it with the 256 bits you generated yourself). Adding another entropy source never reduces entropy.

What remains is a question of tradeoffs: do you choose machine-generated entropy, which is strong in theory but may be weak depending on the implementation, or entropy you generated yourself? Some people may use both as separate wallets to spread the risk, or, within a single multisig, use a different entropy generation method for each key to diversify risk.

Either way, I hope you'll try generating random numbers as a hands-on exercise in the technology behind Bitcoin; it makes a great weekend activity. Opinions may differ on whether it's best practice, but I hope you now understand that it's more secure than relying on human intuition.