Custom mnemonic for Ledger Nano S

Example of Generating Mnemonic Phrase

  • You need to choose how many words your mnemonic will contain. The numbers you can choose from can be looked up in BIP-39 standard. Let’s say for our example we chose 24 words.
  • Pick 23 words randomly from this list: English wordlist. You need to note the index (0-based) of each word in that list and the binary representation of the index. The binary representation should contain exactly 11 bits. Let’s say you randomly picked the following 23 words from the list:
+----------+-------+-----------------+
| Word | Index | Index in Binary |
+----------+-------+-----------------+
| access | 10 | 00000001010 |
| practice | 1355 | 10101001011 |
| able | 2 | 00000000010 |
| about | 3 | 00000000011 |
| acid | 15 | 00000001111 |
| absent | 5 | 00000000101 |
| above | 4 | 00000000100 |
| abstract | 7 | 00000000111 |
| act | 19 | 00000010011 |
| abuse | 9 | 00000001001 |
| absorb | 6 | 00000000110 |
| accident | 11 | 00000001011 |
| term | 1787 | 11011111011 |
| accuse | 13 | 00000001101 |
| achieve | 14 | 00000001110 |
| machine | 1068 | 10000101100 |
| acoustic | 16 | 00000010000 |
| acquire | 17 | 00000010001 |
| across | 18 | 00000010010 |
| abandon | 0 | 00000000000 |
| fix | 704 | 01011000000 |
| actor | 21 | 00000010101 |
| actress | 22 | 00000010110 |
+----------+-------+-----------------+
  • Concat the binary indexes and pad them with 3 random bits of your choice. The total number of bits should be 264. Then calculate sha256 hash of this binary data. You can use shasum command in MacOS:
> echo '0000000101010101001011000000000100000000001100000001111000000001010000000010000000000111000000100110000000100100000000110000000010111101111101100000001101000000011101000010110000000010000000000100010000001001000000000000010110000000000001010100000010110010' | shasum --01 --algorithm 256a6c77eaaa8bbc4251928a2d408e601082f3c42d5702289fd2d325d9459719bbc
  • The sha256 hash for this example is a6c77eaaa8bbc4251928a2d408e601082f3c42d5702289fd2d325d9459719bbc. We need to take 8 first bits of this hash which is 10100110 and append them to the 3 random bits from the previous step and use it as an index to look up the 24th word from the word list. For our example the index is 678 (01010100110 in binary) and the corresponding word is feel.
  • The resulting mnemonic that will pass the checksum validation thus is:
+----------+
| Word |
+----------+
| access |
| practice |
| able |
| about |
| acid |
| absent |
| above |
| abstract |
| act |
| abuse |
| absorb |
| accident |
| term |
| accuse |
| achieve |
| machine |
| acoustic |
| acquire |
| across |
| abandon |
| fix |
| actor |
| actress |
| feel |
+----------+

--

--

--

Creator of https://github.com/blockchain-etl, Co-founder of https://d5.ai and https://nansen.ai, Google Cloud GDE, AWS Certified Solutions Architect

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What am I doing right now?

25 Linux commands you need to learn now!

What are Dictionary Data?

Dart Extension Methods

Introducing the MATTR Platform

SnowPark -The Scala developer experience on Snowflake Data Cloud

Spotting The Most Optimum Framework For Your Network Application

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Evgeny Medvedev

Evgeny Medvedev

Creator of https://github.com/blockchain-etl, Co-founder of https://d5.ai and https://nansen.ai, Google Cloud GDE, AWS Certified Solutions Architect

More from Medium

Equalizer Brings Gas Efficient Flash Loans to Instadapp Users

hyper cloud beta is a go! 🚀

MaticFund.app bot to use AI to automatically invest

Uniswap Clone — Instantly launch your Decentralized Exchange like Uniswap