Understanding Mnemonic keys and how they are generated on the Algorand blockchain

Blockchain technology is gaining ground as an emerging technology that will shape how societies interact across borders. One of the key underpinnings of blockchain is its cryptographic keys which makes it difficult for a third-party to gain access to blockchain assets owned by an individual. Securing blockchain assets, as well as signing transactions, are performed using a user’s private keys. Private keys, alongside public keys, are generated when accounts are created on the blockchain. This gives users their passwords and public addresses to authenticate transactions on the blockchain.

However, there is a drawback with the usability of private keys by non-tech-savvy users. They are hard to memorize for most people. The Algorand blockchain, for instance, creates public and private keys for each account that is created on the chain. Private keys are alphanumeric characters that the user is required to save for life. Losing them is equivalent to losing access to your account. This scares many new blockchain users and can be a barrier to user adoption. To make private keys user friendly, the Algorand blockchain supports the use of a Mnemonic phrase which performs the same function as private keys.  Mnemonic phrases are a human-readable version of the private keys. The user can sign transactions and recover lost accounts using part of their mnemonic phrase. Mnemonic or seed phrases can range from 12 - 25 words depending on the blockchain ecosystem you are dealing with. Any app can generate its mnemonic phrase for security purposes.

The Algorand blockchain supports mnemonic keys and is generated during the account sign up. It is a 25-word pattern that best represents the private key and performs the same functions as the private keys. They are easily readable and easy to memorise as well. On the Algorand blockchain chain, mnemonic keys are generated by converting the user's private key string to an 11-bit integer to the bip-0039 English word list where the integer value maps to the word in the bip-0039 English word list with position same as the integer value. To illustrate, if an integer value is 2, it will map to the 2nd word on the bip-0039 English word list. This process of transforming the private keys to 11-bit integer and mapping it to bip-0039 English word list will generate 24-word mnemic keys. The bip-0039 English word is made up of about 2048 random words in an array and can also be termed as seed phrase.

You realise that this process gives 24 words instead of 25 words as contained in the Algorand mnemonic phrase. To generate the 25th word, The Algorand documentation states that…

A checksum is added by taking the first two bytes of the hash of the private key and converting them to 11-bit integers and then to their corresponding word in the word list. This word is added to the end of the 24 words to create a 25-word mnemonic.

See the diagram below for an understanding of the process

Source


checksum is a way of verifying the data sequence for error and also validating data integrity. In this case, the Algorand backend code will take the first 2 bits of the hashed private keys and map it to the bip-0039 English word list to generate a word out of the user's private key. You then concatenate the 24 words generated earlier with the 25th word. Following this process, your 25-word mnemonic phrase is generated.

They (mnemonic phrases) are useful in signing into your account, recovering your account where you can’t find the private keys. Some blockchain wallets allow users to sign transactions using their mnemonic phrases. They perform the same function as the private keys and must be securely stored, preferably offline!