{"id":19377432,"url":"https://github.com/chenzhitong/neomnemonic","last_synced_at":"2025-07-24T18:11:34.998Z","repository":{"id":115699293,"uuid":"239689411","full_name":"chenzhitong/NeoMnemonic","owner":"chenzhitong","description":"Neo 3 中的助记词生成算法","archived":false,"fork":false,"pushed_at":"2025-01-08T02:53:45.000Z","size":70,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T01:34:25.057Z","etag":null,"topics":["bip39","mnemonic","neo"],"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/chenzhitong.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-11T06:08:54.000Z","updated_at":"2025-01-08T02:53:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"85437fc9-5dd3-4570-b647-c4b5dcb59840","html_url":"https://github.com/chenzhitong/NeoMnemonic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenzhitong%2FNeoMnemonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenzhitong%2FNeoMnemonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenzhitong%2FNeoMnemonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenzhitong%2FNeoMnemonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenzhitong","download_url":"https://codeload.github.com/chenzhitong/NeoMnemonic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250469598,"owners_count":21435682,"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","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":["bip39","mnemonic","neo"],"created_at":"2024-11-10T08:49:32.143Z","updated_at":"2025-04-23T16:26:26.180Z","avatar_url":"https://github.com/chenzhitong.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NeoMnemonic\n\nNeo 3 中的助记词生成算法（按照比特币 BIP32 BIP39 BIP41 标准实现）。\n\n注：Neo3 助记词的衍生路径为 m/44'/888'/0'/0/0 因为币种不同（比特币币种为 0，Neo 币种为 888），同样的助记词，导入比特币钱包和导入 Neo 钱包会得到不同的私钥，这是正常现象。\n\n兼容钱包：\n\n- OneGate、https://iancoleman.io/bip39/ （在网址中手动指定派生路径 m/44'/888'/0'/0/0）\n- neon、Ledger\n\n## 示例\n\n生成助记词\n\n[BIP39 Wordlists](https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md)\n\n```csharp\nMnemonic.GenerateMnemonic();\n\nMnemonic.GenerateMnemonic(EntropyLength._128)\n\nMnemonic.GenerateMnemonic(EntropyLength._128, Mnemonic.Language.ChineseSimplified)\n```\n\n通过助记词和口令（可选）生成种子\n\n```csharp\nMnemonic.MnemonicToSeed(words);\n\nMnemonic.MnemonicToSeed(words, \"passphrase\");\n```\n\n\u003e 错误情况：\n\u003e\n\u003e 1、助记词单词数必须为 12 或 15 或 18 或 21 或 24\n\u003e\n\u003e 2、助记词必须为助记词列表中的单词\n\u003e\n\u003e 3、助记词校验不通过\n\n通过种子生成 neo 的私钥\n\n```\nMnemonic.SeedToWIF_1(seed); //兼容onegate\nMnemonic.SeedToWIF_2(seed); //兼容neon, neoline\n```\n\n## 兼容性问题\n\n为什么 OneGate 和 neon 的相同的助记词导入后地址不同？\n\nOneGate 引用的是 bip32/bip39 库\n\n- 按照 bip32 规范，masterkey 的 fingerprint 应该是 4 字节的 [0,0,0,0]\n- HMACSHA512算法的密钥为默认的 Bitcoin seed\n- 派生路径时用的曲线是 Secp256k1\n\nneon 使用了 Moonlight-io/asteroid-sdk-js 库\n\n- masterkey 的 fingerprint 是一个字节的 [46]，就是 '0' 的 ASCII 码\n- HMACSHA512 算法的密钥为了 Nist256p1 seed\n- 派生路径时用的曲线是 Secp256r1\n\n另外二者对BitInteger的实现略有不同，导致了最终同样 seed 生成的私钥不同。\n\n## 参考：\n\n[BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)\n\n[BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)\n\n[BIP43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki)\n\n[BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)\n\n[比特币源码学习-钱包标准(一)-BIP32/BIP44](https://blog.csdn.net/m0_37847176/article/details/82011876)\n\n[比特币源码学习-钱包标准（二）-BIP39](https://blog.csdn.net/m0_37847176/article/details/82177627)\n\n[助记词 - 廖雪峰的官方网站](https://www.liaoxuefeng.com/wiki/1207298049439968/1207320517404448)\n\n[理解开发HD 钱包涉及的 BIP32、BIP44、BIP39](https://learnblockchain.cn/2018/09/28/hdwallet/)\n\n[基于 BIP-32 和 BIP-39 规范生成 HD 钱包（分层确定性钱包）](https://stevenocean.github.io/2018/09/23/generate-hd-wallet-by-bip39.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenzhitong%2Fneomnemonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenzhitong%2Fneomnemonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenzhitong%2Fneomnemonic/lists"}