2.6 KiB
layout | title | parent |
---|---|---|
default | Key Manipulation | Cryptography In Monero |
Key Manipulation
Monero uses four keys for managing a wallet: private view key, public view key, private spend key, public spend key. View keys are used for viewing receive transactions and constructing public addresses meanwhile spend keys are used for viewing receive/send transactions and constructing transactions.
Generating A Wallet And Deriving Keys Of It
Monero wallets are generated by selecting 24 cryptographically secure random words from the wordlists (each has exactly 1626 words) and appending an extra checksum word calculated from the previous 24 words. The checksum word is selected by calculating the CRC32 checksum index of a string that is made by concatenating the first prefix_length
ed characters of each selected word.
For example, lets assume that our 24 random words are:
lush bagpipe stacking mice imitate village gang efficient strained different together vain puck roped pancakes shocking liar moisture memoir sorry syndrome kettle swept dehydrate
As English wordlist's prefix length is 3, we are concatenating only the first 3 letters of each word which get us this:
lusbagstamicimivilganeffstrdiftogvaipucroppansholiamoimemsorsynketswedeh
And calculating the CRC32 Checksum of this gives us the decimal number 2248614488
. Then we can take the modulo of it to choose the checksum word in our mnemonic. 2248614488 % 24
gives us 8 and 8th index of our mnemonic (don't forget that indexes start at 0) is strained
so we choose this word as a checksum word. Which then gives us the final mnemonic that we can store: lush bagpipe stacking mice imitate village gang efficient strained different together vain puck roped pancakes shocking liar moisture memoir sorry syndrome kettle swept dehydrate strained
So to summarize, the steps are like this:
- Choose 24 random words from the wordlist securely
- Concatenate every first
prefix_length
characters of each word into a single string (For example,prefix_length
is 3 for English and 4 for German) - Calculate CRC32 Checksum of the concatenated string
- Take 24th modulo of the CRC32 output
- Choose the word based on the modulo output