Securely generate 24-word Mnemonic using Dice

Securely generate 24-word Mnemonic using Dice

>**Disclaimer:** This is for education purposes only. This is quite advanced for the average user. If you are to going to protect funds with a mnemonic generated using this method, use only a verified copy of tails and do all processes in a completely secure offline environment.

Let me begin by saying there is nothing to suggest that the RNG used in popular software/hardware wallets is flawed. The generation process uses TRNG’s certified from 3rd parties which should satisfy the large majority of users. However, if you are the type that trusts no one and you want to verify your BIP39 Mnemonic is truly random or you just want to find out how it works, then you must generate it yourself.

The process itself is straightforward, The BIP39 dictionary contains 2048 words, each of these words represents 11 binary bits (0 or 1). A 24-word Mnemonic consists of 23 Words and a Checksum word. To create our own mnemonic we start by generating 256 bits of random binary then calculating the rest of the checksum. There is many ways to randomly generate the binary, but specifically for this tutorial we use six-sided dice. (If you have another means of generating the 256-bits, such as coin flips, then jump straight to step 10)

The entire process will be done only using tools built-in to tails. All base converisons will be done in the linux terminal using the [‘bc’]( or Basic Calculator command. Calculating the checksum will use python standard library.

**Tools needed:**

– Set of Casino Grade Six-Sided Dice
– BIP39 Wordlist (**MUST BE NUMBERED 0-2047**)
– USB stick w/[Tails](×900/749fc4d5610595d5143320e3203f658c/tails.png) Linux Distro


#Create BIP39 Mnemonic with Dice#

– **Step 1** – Download Tails onto a USB stick. Follow instructions on the tails website. You can validate tails using the extension or manually. Boot from the live USB, be sure to turn network connection to “offline” before starting tails. (click the + sign and it is one of the few options) [**IMAGE**](

– **Step 2** – Open the built-in text editor: [**IMAGE**](

– **Step 3** – Roll your 99 dice rolls recording each roll in the text editor with no spaces between the numbers.[**IMAGE**](

– **Step 4** – You can check the number of rolls input by going to document statistics. Click the 3 bars to the right of the “Save” button. It will be under “Tools”. Make sure there is no additional spaces. [**IMAGE**](

– **Step 5** – Convert the dicerolls into base6. To do this simply turn all the 6’s into 0’s. You can use “Find and Replace” function of the text editor to achieve this. [**IMAGE**]( [IMAGE](

– **Step 6** – Open the terminal [**IMAGE**](

– **Step 7** – Convert the base6 string into binary. We use “bc” or basic calculator which is a built-in command line function. We are converting into base2 from base6. (replace [diceRolls] with your 99-digit base6 string) [**IMAGE**](

echo “obase=2;ibase=6;[diceRolls]” | bc

– **Step 8** – Paste the binary output into a new tab in the text editor. (to copy/paste in the terminal you need to hold ctrl+shift c to copy or ctrl+shift v to paste) [**IMAGE**](

– **Step 9** – Remove the backslashes and extra spaces from the binary string. It should be a solid string of 0’s and 1’s with no extra spaces at the end. [**IMAGE**](

– **Step 10:** – Check the length of the binary string using document statistics. In order to calculate a checksum the binary string must be exactly 256 characters. If the resulting binary is less then 256 characters, then add zeroes to the start of the string until it is 256 characters. This is called padding. [**IMAGE**]( [**IMAGE**](

– **Step 11:** – Convert the 256-bit binary into a hex value using the terminal. (replace [binary] with your 256-bit binary) [**IMAGE**](

echo “obase=16;ibase=2;[binary]” | bc

– **Step 12:** – To generate the checksum we need to write a small python program using the python standard library. Open a new tab in the text editor and save it as “” in the Documents folder. Once it is saved copy the below text to the file or copy it directly from the screenshot. Replace the Pink “hex_val” with your own hex value and save the file. [**IMAGE**](

import hashlib
import binascii

hex_val = “” # <– Enter your hex value here
bin_data = binascii.a2b_hex(hex_val)
sha256hash = hashlib.sha256(bin_data).hexdigest()


– **Step 13:** -Change directory to Documents using the command “`cd Documents“` then run by using the command “`python3“`. The output will be a long hex value. The first 2 characters will be the checksum. [**IMAGE**](

– **Step 14:** – Convert the 2 hex characters into binary using the terminal. The hex input for bc MUST BE capitalized or the result will be 0. In the above example the first 2 characters from are 9c. So we use 9C as the input for base conversion. “`echo “obase=2;ibase=16;[hex]” | bc“` (replace [hex] with the first 2 characters given back from Make sure to capitalize any letters). If the result is less then 8 bits, add zeroes to the start. Example: 2C would equal “101100” in binary which is only 6-bits. In this case add 2 zeroes to the start to make “00101100”, [**IMAGE**](

– **Step 15:** – Add the 8-bits of binary from the previous step to the existing binary string from step 10. Check to make sure the resulting binary is exactly 264 characters using document statistics. [**IMAGE**](

– **Step 16** – Split the 264-bit binary into equal 11-bit chunks. There should be exactly 24 groups of 11 bits. [**IMAGE**](

– **Step 17** – Convert each group of binary into a decimal number using the terminal. Record each number next to the corresponding binary. Do this for all 24 binary strings. (press the up arrow to access previous commands) [**IMAGE**](

– **Step 18** – Look up the numbers in the BIP39 wordlist. Make sure the wordlist in zero-indexed meaning it begins with 0 and ends with 2047. This is your 24-word seed which can be used with any BIP39 compatible wallet.
Take care to properly wipe the USB device after use. [**IMAGE**](

Picture Album –

View Reddit by McgillbyView Source

Leave a Comment

Your email address will not be published. Required fields are marked *