add wallet generation

This commit is contained in:
dethe 2024-07-23 00:23:14 +03:00
parent c6c489cdc0
commit b0e94d4ddb
4 changed files with 58 additions and 32 deletions

View file

@ -1,36 +1,27 @@
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
#
# If you need help with YAML syntax, here are some quick references for you:
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
# https://learnxinyminutes.com/docs/yaml/
#
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
# main settings
title: Monero Docs
# email: docs@getmonero.org
description: >- # this means to ignore newlines until "baseurl:"
description: >-
Official Monero Documentation
baseurl: "" # the subpath of your site, e.g. /blog
url: "https://docs.getmonero.org" # the base hostname & protocol for your site, e.g. http://example.com
baseurl: ""
url: "https://docs.getmonero.org"
twitter_username: monero
github_username: monero-project
# Build settings
# build settings
theme: just-the-docs
# just-the-docs settings
favicon_ico: "/assets/favicon-32x32.png"
search_enabled: true
show_sidebar: true
enable_copy_code_button: true
back_to_top: true
back_to_top_text: "Back to top"
footer_content: 'Copyright &copy; 2024, The Monero Project. Licensed under <a href="https://github.com/monero-project/monero-docs/blob/master/LICENSE.md">BSD 3-Clause "New" or "Revised" License</a>.'
gh_edit_link: true
gh_edit_link_text: "Edit this page on GitHub"
gh_edit_repository: "https://github.com/monero-project/monero-docs"
gh_edit_branch: "master"
gh_edit_view_mode: "tree"

View file

@ -0,0 +1,13 @@
---
layout: default
title: Cryptography In Monero
has_children: true
---
# Cryptography In Monero
<br/>
Monero employs various cryptographic algorithms for use, including [ed25519 (used in key manipulation)](https://ed25519.cr.yp.to/) and [Keccak256 (or SHA-3, also used in key manipulation)](https://keccak.team/keccak.html).
You can see the details of each use in the below table of contents.

View file

@ -0,0 +1,29 @@
---
layout: default
title: Key Manipulation
parent: 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)](https://github.com/monero-project/monero/tree/master/src/mnemonics) and appending an extra checksum word calculated from the previous 24 words. The checksum word is selected by calculating the [CRC32 checksum index](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) 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](https://github.com/monero-project/monero/blob/master/src/mnemonics/english.h#L52C47-L52C48) 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](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) 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](https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator)
- 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](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) of the concatenated string
- Take 24th modulo of the CRC32 output
- Choose the word based on the modulo output

View file

@ -2,11 +2,4 @@
layout: home
---
Welcome to the official documentation of Monero protocol. You can see the table of contents below.
<br>
# Table Of Contents
---
TODO
Welcome to the official documentation of Monero protocol. You can navigate to pages from the panel in the left.