Dice-generated bitcoin private key

Equipment

Low-tech guide to generating a bitcoin private key seed - featuring less conventional use of the Coldcard hardware wallet.

The mnemonic seed phrase commonly used to represent bitcoin wallets usually consists of 24 words. How do we generate such a seed while placing minimal trust in any computer, even the Coldcard wallet itself?

The Coldcard has a mode for generating a seed using entropy from dice throws - but I didn't want to rely on that entropy processing, I wanted a more tactile way of generating it.

The 24 word phrase actually corresponds to 256 bits of entropy + an 8-bit checksum. Those 264 bits together mean that each of these 24 words correspond to 11 bits. Since the checksum is actually one byte of the SHA-256 hash of the rest of the bits, we cannot generate it by hand in a reasonable amount of time (see SHA-256 algorithm on Wikipedia). But that is where a Coldcard or similar tool comes in. When importing the words of a seed phrase it will prompt you on the last word to select one of 8 possible words, this will come in handy...

We can generate the first 256 bits using dice, in my case using two regular 6-sided dice to generate 2 bits at a time (that is 128 throws). Since 6 is not a power of 2 number, we fall back to even numbers (2,4,6) are 0 and odd numbers (1,3,5) are 1. It's important to decide beforehand on the ordering of the dice/bits to avoid inserting unconscious skewing of the random distribution. In my case I chose to have the red big dice correspond to the left bit and the small green dice correspond to the right bit. If you have identical dice, you can put them in a transparent box, shake them and then let them rest against one side, reading them in the same order every time.

Take a paper and designate 24 lines (here with 2 columns):

Paper with 24 lines

Write down ones and zeroes for each set of dice throws, 11 bits per line (only 3 bits for the 24th line), like so:

Binary line example

It makes the next step easier if you group the binary digits in groups of 3-4-4 as above. Since 11 is a prime number and I was using more than one dice, I let the overflowing digit from the last dice roll feed over to the next line. After completing this step you should end up with:

Binary paper example

Now we will use our knowledge of binary-hexadecimal interchangeability to convert from base 2 to base 16.

binhex
00000
00011
00102
00113
01004
01015
01106
01117
10008
10019
1010A
1011B
1100C
1101D
1110E
1111F

11 bits per word means the standardized word list contains 211 = 2048 words. One word on each line, sorted alphabetically and numbered hexadecimally gives us the following:

hexword
0x000abandon
0x001ability
0x002able
......
0x579quality
......
0x7FEzone
0x7FFzoo

Go here to download the full list, numbered in hex.

(Since we are starting from 0 instead of 1, the last line is numbered 0x7FF, which is 2048-1 => 2047).

The set of dice rolls producing "(0)101 0111 1001" for the first word maps to "5 7 9" in hex, corresponding to "quality":

Binary paper example

Up until now, the process only requires using pen, paper, dice and using a computer to scroll up and down to look up words. The 2048 word list could be printed out in case you are afraid that the computer has been compromised, but they wouldn't know the precise word you were scrolling to look up anyway.

Enter the 23 full words into the Coldcard seed import section, and then on the last screen select the word that corresponds to the 3 bits on the 24th line. If your 3 last bits were 101 for example, that would map to the 5th word. I'm not 100% sure of the ordering, but the 24th word includes both the last 3 bits of entropy and the 8-bit checksum, and the Coldcard only presents words corresponding to valid checksums. 3 bits gives us values from 0-7, which gives us 8 possible words.

Now you have a low-tech, human-generated mnemonic seed phrase. Treasure it and keep it secret!

Credits

Credits go to Arman the Parman for his DIY Bitcoin Private Key Project article. Differences from his original:

Also somewhat inspired by Crypto Guide in how to order identical dice to avoid unconscious skewing of the random distribution: https://youtu.be/j5nejoEGWFw

Standard used: Bitcoin Improvement Proposal number 39 - "Mnemonic code for generating deterministic keys" (original word list file)

PIN number

You can also use dice to generate a PIN number, first in binary, then converting it to decimal with similar pen & paper math as in Arman's article. For long PINs, beware of low entropy in the leftmost digits though.

What about base 6?

I played with the idea of using base 6 since we are using dice. That would be 0-5, 6 on the dice-face counts as 0. Numbering the word list in base 6 results in 0-13251, decimal 2048 is not divisible by 6. The first digit would be either 0 or 1, the second would be one of 0,1,2,3 and the last 3 digits would be full dice rolls, 0-5 - except if you are at the very end of the wordlist (1325?), then the rightmost digit is either 0 or 1. When we want a 0 or a 1 we could just fall back to even/odd numbers, but for the second digit in the 0-3 range one would just have to re-roll to get within range, other strategies like modulo would skew the distribution. Absolute best case you get something like 24 * 2.5 = 60 rolls with two dice, but statistically you will add a lot of re-rolls on top.