{"id":16153694,"url":"https://github.com/moneroexamples/mymonero-keys","last_synced_at":"2025-10-07T20:10:24.535Z","repository":{"id":70343585,"uuid":"46101562","full_name":"moneroexamples/mymonero-keys","owner":"moneroexamples","description":"Recovery of monero address and private view and spend keys using MyMonero's mnemonic seed","archived":false,"fork":false,"pushed_at":"2016-01-30T09:31:12.000Z","size":24,"stargazers_count":14,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T18:54:51.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moneroexamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-13T05:16:01.000Z","updated_at":"2023-10-13T19:34:58.000Z","dependencies_parsed_at":"2023-02-22T04:15:15.582Z","dependency_job_id":null,"html_url":"https://github.com/moneroexamples/mymonero-keys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/moneroexamples/mymonero-keys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moneroexamples%2Fmymonero-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moneroexamples%2Fmymonero-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moneroexamples%2Fmymonero-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moneroexamples%2Fmymonero-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moneroexamples","download_url":"https://codeload.github.com/moneroexamples/mymonero-keys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moneroexamples%2Fmymonero-keys/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278838434,"owners_count":26054720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T01:14:13.305Z","updated_at":"2025-10-07T20:10:24.520Z","avatar_url":"https://github.com/moneroexamples.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Recovery of monero address and private view and spend keys using MyMonero's mnemonic seed\n\nHow to recover address, private view and spend keys in C++ based on\n13 word mnemonic seed provided by [MyMonero](https://mymonero.com/).\n\n[MyMonero](https://mymonero.com/) uses 13 word mnemonic seed, which\ncant be used in the Monero's `simplewallet`. The reason is, that the `simplewallet`\nuses 25 word mnemonic seed, and also, generation of private view and spend keys\nby the `simplewallet` is different than that used by [MyMonero](https://mymonero.com/).\n\nMore information on the differences between the `simplewallet` and mymonero,\ncan be found:\n\n  - [Cryptnote Tests](http://xmrtests.llcoins.net/addresstests.html)\n  - [Why MyMonero key derivation is different than for the simplewallet (Mnemonic)](https://www.reddit.com/r/Monero/comments/3s80l2/why_mymonero_key_derivation_is_different_than_for/)\n\nThe example was prepared and tested on Xubuntu 15.10 x64 and Monero 0.9.\n\nInstruction for Monero 0.9 compilation and setup of Monero's header files and libraries are at:\n - [Compile Monero 0.9 on Ubuntu 15.10 and 14.04 x64](https://github.com/moneroexamples/compile-monero-09-on-ubuntu)\n\n\n## C++: main.cpp\n\n```c++\nint main(int ac, const char* av[]) {\n\n    // get command line options\n    xmreg::CmdLineOptions opts {ac, av};\n\n    auto help_opt = opts.get_option\u003cbool\u003e(\"help\");\n\n    // if help was chosen, display help text and finish\n    if (*help_opt)\n    {\n        return 0;\n    }\n\n    // default language for the mnemonic\n    // representation of the private spend key\n    string language {\"English\"};\n\n    // get 13 word mnemonic seed from MyMonero\n    auto mnemonic_opt = opts.get_option\u003cstring\u003e(\"mnemonic\");\n\n    // get the program command line options, or\n    // some default values for quick check\n    string mnemonic_str = mnemonic_opt\n                          ? *mnemonic_opt\n                          : \"slid otherwise jeers lurk swung tawny zodiac tusks twang cajun swagger peaches tawny\";\n\n    cout \u003c\u003c \"\\n\"\n         \u003c\u003c \"Mnemonic seed    : \" \u003c\u003c mnemonic_str \u003c\u003c endl;\n\n\n    // change the MyMonero 13 word mnemonic seed\n    // to its 16 byte hexadecimal version\n    xmreg::secret_key16 hexadecimal_seed;\n\n    // use modified words_to_bytes function.\n    xmreg::ElectrumWords::words_to_bytes(mnemonic_str, hexadecimal_seed, language);\n\n    cout \u003c\u003c \"\\n\"\n         \u003c\u003c \"Hexadecimal seed : \" \u003c\u003c hexadecimal_seed \u003c\u003c endl;\n\n\n    // take the 16 byte hexadecimal_seed, and\n    // and perform Keccak hash on it. It will\n    // produce 32 byte hash.\n    crypto::hash hash_of_seed;\n\n    cn_fast_hash(hexadecimal_seed.data, sizeof(hexadecimal_seed.data), hash_of_seed);\n\n    cout \u003c\u003c \"\\n\"\n         \u003c\u003c \"Hash of seed     : \" \u003c\u003c hash_of_seed\u003c\u003c endl;\n\n\n    // having the hashed seed, we can proceed\n    // with generation of private and public spend keys.\n    // the keccak hash of the seed is used as a seed\n    // to generate the spend keys.\n    crypto::public_key public_spend_key;\n    crypto::secret_key private_spend_key;\n\n    crypto::generate_keys(public_spend_key, private_spend_key,\n                          xmreg::get_key_from_hash\u003ccrypto::secret_key\u003e(hash_of_seed),\n                          true);\n\n    cout \u003c\u003c \"\\n\"\n         \u003c\u003c \"Private spend key: \" \u003c\u003c private_spend_key \u003c\u003c \"\\n\"\n         \u003c\u003c \"Public spend key : \" \u003c\u003c public_spend_key  \u003c\u003c endl;\n\n    // now we get private and public view keys.\n    // to do this, we keccak hash the hash_of_seed again\n    crypto::hash hash_of_hash;\n    cn_fast_hash(hash_of_seed.data, sizeof(hash_of_seed.data), hash_of_hash);\n\n    crypto::public_key public_view_key;\n    crypto::secret_key private_view_key;\n\n\n    crypto::generate_keys(public_view_key, private_view_key,\n                          xmreg::get_key_from_hash\u003ccrypto::secret_key\u003e(hash_of_hash),\n                          true);\n\n    cout \u003c\u003c \"\\n\"\n         \u003c\u003c \"Private view key : \" \u003c\u003c private_view_key \u003c\u003c \"\\n\"\n         \u003c\u003c \"Public view key  : \" \u003c\u003c public_view_key  \u003c\u003c endl;\n\n\n\n    // having all keys, we can get the corresponding monero address\n    cryptonote::account_public_address address {public_spend_key, public_view_key};\n\n\n    cout \u003c\u003c \"\\n\"\n         \u003c\u003c \"Monero address   : \" \u003c\u003c address \u003c\u003c endl;\n\n\n    cout \u003c\u003c \"\\nEnd of program.\" \u003c\u003c endl;\n\n    return 0;\n}\n```\n\n## Example 1\n\n```bash\n./mymonero  -m \"slid otherwise jeers lurk swung tawny zodiac tusks twang cajun swagger peaches tawny\"\n```\nResult:\n\n```bash\nMnemonic seed    : slid otherwise jeers lurk swung tawny zodiac tusks twang cajun swagger peaches tawny\n\nHexadecimal seed : \u003c5878efd0a6d45b0374b49c000da07cd2\u003e\n\nHash of seed     : \u003c6d23fe14606a0d5fe62d05a78c4b5b1cae2f38f9330e42e86a50286db16ad61e\u003e\n\nPrivate spend key: \u003c804f08b84507fb0610910d04ae517c07ae2f38f9330e42e86a50286db16ad60e\u003e\nPublic spend key : \u003cb54264728412c71bb62caca5b3cb57eb96a48a580c97a65257290243e3adf401\u003e\n\nPrivate view key : \u003cdbb024c981cf7dc797593713f5f426c3b1cad50542c0814d4786e12e768be504\u003e\nPublic view key  : \u003c75fc0c90732a3db632bc0a169328067fa3f4c52e80ae067aa60bae8c4ccd8711\u003e\n\nMonero address   : \u003c48VWHdLTEpE5dqa5VpAy5xgQWBHZARiGmEmojNLqD4ef1FAzkPxCe9JXUYwCShRR5XNMGnyusrnkmMWr2HMdfDRx2vsrG7c\u003e\n```\n\nThe private keys agree with those generated by MyMonero.\n\n## Example 2\n\n```bash\n./mymonero  -m \"nearby hover hiker renting giddy purged chrome paddles point tsunami hoax pledge point\"\n```\nResult:\n\n```bash\nMnemonic seed    : nearby hover hiker renting giddy purged chrome paddles point tsunami hoax pledge point\n\nHexadecimal seed : \u003cfbdf0efd70ff3c5a321e0f0969041948\u003e\n\nHash of seed     : \u003ca16321b78892ff31facf9070f33eb445e2510bfd0e45e86891264771de5884f4\u003e\n\nPrivate spend key: \u003cbef8b944fdc3eb086b9f0ee4e79aa30ce1510bfd0e45e86891264771de588404\u003e\nPublic spend key : \u003c39812cdb0d7f29bc8c70c319cb381b8f943b9a3fa35d40f59e93b63edd012605\u003e\n\nPrivate view key : \u003c8952f17e4378c74fcd99ed6c70e799db60a601edf2685407087cc8c06d4db808\u003e\nPublic view key  : \u003cfb227e0e28539fd6ca13fc7d5b2da19307665ae0d152eb87b1239a00c6c66b07\u003e\n\nMonero address   : \u003c43oVy226ybWYYA93SExWoLR1tznhhaXRqi5pLtYWhcM3212LriHRkLecvj6zoehqkLRbN9P18LDBGPhP9fHHY7Ar1qi9QDM\u003e\n```\nThe private keys agree with those generated by MyMonero.\n\n## Example 3\n\n```bash\n./mymonero  -m \"suddenly opus governing mystery divers obvious royal icon hefty nautical boxes among boxes\"\n```\nResult:\n\n```bash\nMnemonic seed    : suddenly opus governing mystery divers obvious royal icon hefty nautical boxes among boxes\n\nHexadecimal seed : \u003c852249bca4446e65501cc7f8338027ec\u003e\n\nHash of seed     : \u003c30c0dc774aef038b78079f2478cf89d14f2d75c0a02bda4c5dbb14ce2913b97c\u003e\n\nPrivate spend key: \u003cb5f423ed913983229cbdd9af61fa703f4f2d75c0a02bda4c5dbb14ce2913b90c\u003e\nPublic spend key : \u003c2c78b799c4d26a2dabb5ceaaff07efff9bd9ffc08cbc9b17634800019f3ca641\u003e\n\nPrivate view key : \u003c601e6488942149980d9cd50298ef7cdb623cc58e8045f70de994faaea0a97a0e\u003e\nPublic view key  : \u003c7e9d7fcf3e20a8a3a02f0d73dd676dcc80d0d45c7efdd7d9c783453df150cca3\u003e\n\nMonero address   : \u003c43JrWR7mQYh8e4gLAhVeXpjkj5b4RePpv4utgkFt7bpRBxP1t5J4wQKUNNiapRubXSbCwMLZDJ9CJdRjV1m26Kz3KRB4iFJ\u003e\n```\n\nThe private keys agree with those generated by MyMonero.\n\n## How can you help?\n\nConstructive criticism, code and website edits are always good. They can be made through github.\n\nSome Monero are also welcome:\n```\n48daf1rG3hE1Txapcsxh6WXNe9MLNKtu7W7tKTivtSoVLHErYzvdcpea2nSTgGkz66RFP4GKVAsTV14v6G3oddBTHfxP6tU\n```    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoneroexamples%2Fmymonero-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoneroexamples%2Fmymonero-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoneroexamples%2Fmymonero-keys/lists"}