{"id":19303792,"url":"https://github.com/web3w/hd-address-cli","last_synced_at":"2025-04-22T11:32:10.961Z","repository":{"id":57261986,"uuid":"284632026","full_name":"web3w/hd-address-cli","owner":"web3w","description":"Hd Wallet deterministic address generation and recovery tool(HD钱包地址生成，恢复工具)","archived":false,"fork":false,"pushed_at":"2023-11-28T05:41:48.000Z","size":165,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T17:44:55.492Z","etag":null,"topics":["btc","btc-hdwallet","cli","ethereum-hdwallet","hd-address-cli","hd-path","mnemonic","trx-hdwallet"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/web3w.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-03T07:23:56.000Z","updated_at":"2023-10-16T07:39:23.000Z","dependencies_parsed_at":"2023-11-28T06:40:43.254Z","dependency_job_id":null,"html_url":"https://github.com/web3w/hd-address-cli","commit_stats":{"total_commits":25,"total_committers":4,"mean_commits":6.25,"dds":0.4,"last_synced_commit":"18a2fba60a450093855c92b483af3d96fefe8daf"},"previous_names":["gisvr/hd-address-cli"],"tags_count":3,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3w%2Fhd-address-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3w%2Fhd-address-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3w%2Fhd-address-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web3w%2Fhd-address-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web3w","download_url":"https://codeload.github.com/web3w/hd-address-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250232214,"owners_count":21396595,"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":["btc","btc-hdwallet","cli","ethereum-hdwallet","hd-address-cli","hd-path","mnemonic","trx-hdwallet"],"created_at":"2024-11-09T23:27:34.443Z","updated_at":"2025-04-22T11:32:09.125Z","avatar_url":"https://github.com/web3w.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hd-address-cli\n\n[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/miguelmota/ethereum-hdwallet/master/LICENSE)   [![NPM version](https://img.shields.io/npm/v/hd-address-cli?style=flat-square)](https://www.npmjs.com/package/hd-address-cli)\n \u003eHd Wallet deterministic address generation and recovery tool(HD钱包地址生成，恢复工具)\n \n## Install\n```bash\n    $ npm install hd-address-cli -g\n    $ yarn global add hd-address-cli\n```\n##  Introduction\n[HD Wallet coin type list (bip44)]( https://github.com/satoshilabs/slips/blob/master/slip-0044.md)  \nm / purpose' / coin_type' / account' / change / address_index\n```js\n                                                        / -- index 0 -\u003e address\n                coinType 0(btc) -- account 0 -- change 0  \n              /                                         \\ -- index 1 -\u003e address\nroot -- BIP44 \n              \\\n                coinType 60(eth) -- account 0 -- change 1 -- index 0 -\u003e address\n                          \n```\n## API\n[API Use Case](./API.md)\n```js\n const HDWallet = require('hd-address-cli')\n // CIL methods\n  HDWallet.cli.generateMnemonic({lang: \"CN\"}) //随机生成中文助记词\n  HDWallet.cli.generateSeed()  //随机生成种子\n  HDWallet.cli.generateBase58() //随机生成base58秘钥\n  HDWallet.cli.generateAddress(option) //批量产生地址 eg. {mnemonic: \"aa\", coin: \"BTC\",columns: \"pri,path\",index:1}\n // create HD Wallet methods\n  HDWallet.fromMnemonic(mnemonic) // 根据助记词创建默认的BTC钱包\n  HDWallet.fromSeed(seed,\"TRX\") // 根据seed 创建 TRX钱包\n  let hdWallet =HDWallet.fromBase58(base58,\"ETH\") // 根据Base58创建ETH钱包\n // HD Wallet methods\n  hdWallet.derive(`m/0'/0/1`).getAddress()  //根据hdpath生成对应coin的地址\n  hdWallet.derive(`m/0'/0/1`).getPublicKey() //根据hdpath生成对应coin的公钥\n  hdWallet.derive(`m/0'/0/1`).getPrivateKey() //根据hdpath生成对应coin的私钥\n  hdWallet.derive(`m/0'/0/1`).hdpath() // 获取完整hd path\n  hdWallet.derive(`m/0'/0/1`).getAll()\n```\n## CLI\n### Interactive CLI\n \u003e $ hd_cli\n![image](https://user-images.githubusercontent.com/23111262/90519313-72798080-e19a-11ea-93b7-203745879841.png)\n\nrice range hybrid gather civil broccoli innocent pipe pottery worry hub crisp\n### Helper\n```bash\n$ hd_cli -h\n \nUsage: hd_cli \u003ccmd\u003e [args]\n\nCommands: //子命令: 用来生成根密钥\n  hd_cli mnemonic [strength,lang]  Generate random mnemonic //随机生成助记词: 可选参数强度和语言。[low,mid15,mid18,high]\n  hd_cli seed [strength]           Generate random seed //随机生成种子，\n  hd_cli base58 [strength]         Generate random base58 //随机生成base58密钥\n\nOptions:\n  -c, --coin      coin name (e.g.\n                  BTC,BCH,LTC,ETH,TRX,BTC_TEST,BCH_TEST,LTC_TEST)\n                                            [string] [required] [default: \"BTC\"] //指定生成coin的地址，默认BTC\n  -i, --index     Account Index (e.g. 6)                                [number] //HD wallet 规范中账户index\n  -l, --columns   Columns to display (e.g. pub,pri,path)                [string] //控制显示的表的列\n  -r, --range     Account Index Range (e.g 1-100)     [string] [default: \"1-10\"] //按照index 范围生成地址。和index只能选择一个\n  -m, --mnemonic  Mnemonic                                              [string] //传入的助记词，和seed和base58只能选择一个\n  -s, --seed      Seed in hex format                                    [string] //传入 种子\n  -b, --base58    Base58 format                                         [string] //传入 base58\n  -p, --path      You can specify account and change path (e.g. 'm/20'/0/')    \n                                           [string]  [default: 'm/1'/0/']//可以指定 account和change部分\n  -v, --version   Show version number                                  [boolean]\n  -h, --help      Show help                                            [boolean]\n\nExamples:\n  hd_cli -c \"BTC\" -m \"tag volcano eight thank tide\" -l pri\n\n``` \n\n### Use Case\n\n1. Generate mnemonic:(随机生成多种语言，不同强度的助记词)\n```bash\n   $ hd_cli mnemonic\n   $ hd_cli mnemonic -l CN -s mid15\n   $ hd_cli mnemonic -l JA -s mid18\n   $ hd_cli mnemonic -l EN -s high\n```\n\n2. Generate seed and base58:(随机生成seed和base58)\n```bash\n   $ hd_cli base58\n   $ hd_cli seed -s mid15 \n```\n\n3. Display the address at a particular account index:（显示指定的index的地址)\n\n```bash\n$ hd_cli -m \"tag volcano eight thank tide danger coast health above argue embrace heavy\" -i 4\n    ┌─────────┬──────────────────────────────────────┬───────┬───────┐\n    │ (index) │               address                │ coin  │ index │\n    ├─────────┼──────────────────────────────────────┼───────┼───────┤\n    │    0    │ '19d4qTx2Lzkq5nuBYqwMn3swQGbe8GMEB3' │ 'BTC' │   4   │\n    └─────────┴──────────────────────────────────────┴───────┴───────┘\n```\n\n4. Display the account address derived from a range of ETH account indexes:（显示ETH帐户索引派生的帐户地址)\n\n```bash\n$ hd_cli -c \"ETH\" -m \"tag volcano eight thank tide danger coast health above argue embrace heavy\" -r 5-10\n    ┌─────────┬──────────────────────────────────────────────┬───────┬───────┐\n    │ (index) │                   address                    │ coin  │ index │\n    ├─────────┼──────────────────────────────────────────────┼───────┼───────┤\n    │    0    │ '0x8c7f1ecea37e0e417dd0bcfA04b9126bCd519E2D' │ 'ETH' │   5   │\n    │    1    │ '0x4518EDBE22288D2A353a77dBA10726aC06109aa8' │ 'ETH' │   6   │\n    │    2    │ '0x6cA7296E2a9A72060513F282a43557C10bB447FC' │ 'ETH' │   7   │\n    │    3    │ '0xB39D5530A5Df35e3A110d2c00Daf9d7bbBa1A502' │ 'ETH' │   8   │\n    │    4    │ '0x20648Aece94410F2E3A8f9dF59d7b29Dd7Cbf825' │ 'ETH' │   9   │\n    │    5    │ '0xffA71a7face390cfD8fA71b1Dd04F77eaFAa5C6c' │ 'ETH' │  10   │\n    └─────────┴──────────────────────────────────────────────┴───────┴───────┘\n```\n\n5. Display the private keys of Trx accounts:（显示Trx帐户的私钥)\n\n```bash\n$ hd_cli -c \"TRX\" -m \"tag volcano eight thank tide danger coast health above argue embrace heavy\" -r 5-10 -l pri\n    ┌─────────┬──────────────────────────────────────┬────────────────────────────────────────────────────────────────────┬───────┬───────┐\n    │ (index) │               address                │                                pri                                 │ coin  │ index │\n    ├─────────┼──────────────────────────────────────┼────────────────────────────────────────────────────────────────────┼───────┼───────┤\n    │    0    │ 'TFKPFK8rQXG75hKjvPcLuMU7duRD5Z3JX1' │ 'acfc5662fbac8aea7bf3eeb9c6ee8a2c188fbe76336b2bc83444734827afec0a' │ 'TRX' │   5   │\n    │    1    │ 'TE8Gnnot8sDcyytxYsuwFuU4owq94zRg4x' │ 'e2e4cc77e0fed2d4a764f796342ccc22241aa9f5b90f5b39bb4080ee5462a910' │ 'TRX' │   6   │\n    │    2    │ 'TY4H5iAnwJLVNAjUgGz4cd4h4cbT8LbsSS' │ '2f36c469e0d8579a1ab4fa9f927db274f21b8be2fc558f8a9fe2701765b954ec' │ 'TRX' │   7   │\n    │    3    │ 'TQuhbGn3Ex7zQCLWhDJw8k9aDPBJ2rZ7Sn' │ '055e71ac0d4b89c7fc1f5b53291578389e690d37bbf09a2e0b8f4f4c76e947e9' │ 'TRX' │   8   │\n    │    4    │ 'THb6YEqbpQwg84wL3EyEXP5zmp9YUxrcyS' │ 'c837155977f9489f9b23d510b4622529abf2191bc9d67cc2f27127dcb432ced1' │ 'TRX' │   9   │\n    │    5    │ 'TCVVDB1MsiQXJHE1z72eykKWTK3wuL6Jr3' │ '0f5f852bf11b369d09b1755eff426ea4f89cf42b89e8f9a01987558dee713aa2' │ 'TRX' │  10   │\n    └─────────┴──────────────────────────────────────┴────────────────────────────────────────────────────────────────────┴───────┴───────┘\n\n```\n\n6. Display the HD path of the account:(显示地址对应的HD路径)\n\n```bash\n$ hd_cli -c ETH -m \"tag volcano eight thank tide danger coast health above argue embrace heavy\" -i 3 -l path\n    ┌─────────┬──────────────────────────────────────────────┬────────────────────┬───────┬───────┐\n    │ (index) │                   address                    │        path        │ coin  │ index │\n    ├─────────┼──────────────────────────────────────────────┼────────────────────┼───────┼───────┤\n    │    0    │ '0x5A9C156ba5297a573986BE25C468c01284E93512' │ \"m/44'/60'/1'/0/3\" │ 'ETH' │   3   │\n    └─────────┴──────────────────────────────────────────────┴────────────────────┴───────┴───────┘\n\n```\n\n7. Use a custom HD path:(用户自定义HD path)\n\n```bash\n$ hd_cli -c ETH -m \"tag volcano eight thank tide danger coast health above argue embrace heavy\" -p \"m/20'/0/\" -l path,pri -r 0-3\n    ┌─────────┬──────────────────────────────────────────────┬─────────────────────┬────────────────────────────────────────────────────────────────────┬───────┬───────┐\n    │ (index) │                   address                    │        path         │                                pri                                 │ coin  │ index │\n    ├─────────┼──────────────────────────────────────────────┼─────────────────────┼────────────────────────────────────────────────────────────────────┼───────┼───────┤\n    │    0    │ '0xBa59F66B853f1ACB242bcC57ef188754Fc79434b' │ \"m/44'/60'/20'/0/0\" │ 'a4a7e3e62839dd97c5abfde41c635fa71a00dc5a69c5a0324c8759108701329d' │ 'ETH' │   0   │\n    │    1    │ '0xbf4cFeb783b913c0eD1710f00e9AE1844D597c86' │ \"m/44'/60'/20'/0/1\" │ '93221ffcd3dea9816ec7b6f69f34ab5f7dc1bd3d0be19a3da395d929bdea8238' │ 'ETH' │   1   │\n    │    2    │ '0x62b6ffac78674392e0c30eC042636E22907FbCD2' │ \"m/44'/60'/20'/0/2\" │ '8fc1b1839cd9e5901f534bf22a385c9b78907aa3e417399e140e10f9c0231b38' │ 'ETH' │   2   │\n    │    3    │ '0xce8bf9293cF5C4e9EcB50Aa8F9E42adF568ae356' │ \"m/44'/60'/20'/0/3\" │ '93b1302f88019cfd120f83677274447ae76112be7e31b6aee59928fbb9a12584' │ 'ETH' │   3   │\n    └─────────┴──────────────────────────────────────────────┴─────────────────────┴────────────────────────────────────────────────────────────────────┴───────┴───────┘\n```\n8. Display multiple columns:(显示多列内容)\n\n```bash\n$ hd_cli -m \"tag volcano eight thank tide danger coast health above argue embrace heavy\" -l \"pri,path\" -r 0-2\n\n    ┌─────────┬──────────────────────────────────────┬───────────────────┬────────────────────────────────────────────────────────────────────┬───────┬───────┐\n    │ (index) │               address                │       path        │                                pri                                 │ coin  │ index │\n    ├─────────┼──────────────────────────────────────┼───────────────────┼────────────────────────────────────────────────────────────────────┼───────┼───────┤\n    │    0    │ '1LKrREbJ6RVckGMFVCxsXSLWrrvG8U7owQ' │ \"m/44'/0'/1'/0/0\" │ '4923e84b81af6edc3203587eed7075c89563e83bf44b2496a1b0fb8579a0584b' │ 'BTC' │   0   │\n    │    1    │ '19vd1joP63XzfxSLyA9XMF6ArbhRYwvues' │ \"m/44'/0'/1'/0/1\" │ 'ab81bfbd4741d69dc6f867556dd022c97bd11baeb02e2bdc33011b69a4c1909b' │ 'BTC' │   1   │\n    │    2    │ '14G5AvVQmauXP6idrS9pGx2TT27xgo9MY1' │ \"m/44'/0'/1'/0/2\" │ '44c3bc65f21661f8fdeb37e49826e78a0c10a2c5b8864bb293e41826cad87e32' │ 'BTC' │   2   │\n    └─────────┴──────────────────────────────────────┴───────────────────┴────────────────────────────────────────────────────────────────────┴───────┴───────┘\n\n```\n\n9. Pipe mnemonic or base58:(管道的方式导入助记词或base58)\n\n```bash\n$ echo \"tag volcano eight thank tide danger coast health above argue embrace heavy\"  | hd_cli -c BTC -i 1\n$ echo xprv9s21ZrQH143K4LNZvyv81JjVubcS891ij8CCEA4Bax159a4btLcz1qaHPRm2yr3bWawDX7B8gzAP6rVwY3BorBeWMYcsehtCzkMXA7nJB3g | hd_cli -b -c ETH\n\n    ┌─────────┬──────────────────────────────────────┬───────┬───────┐\n    │ (index) │               address                │ coin  │ index │\n    ├─────────┼──────────────────────────────────────┼───────┼───────┤\n    │    0    │ '1LKrREbJ6RVckGMFVCxsXSLWrrvG8U7owQ' │ 'BTC' │   0   │\n    └─────────┴──────────────────────────────────────┴───────┴───────┘\n\n```\n\n### Recommended Usage\n\u003e  Secret does not stay at history after cli is turned off (如下操作，密钥不会保存在操作历史中)\n```shell script\n    //1.Write the secret to env(将密钥写入环境变量)\n    mnemo=\"tag volcano eight thank tide danger coast health above argue embrace heavy\"\n    echo $mnemo\n    //2.View the operation history and delete it (查看操作历史删除包含密钥的历史记录)\n    history \n    history -d {history id}\n    history \n    //3. User secret (在 cli中使用变量)\n    echo $mnemo | hd_cli -m \n \n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb3w%2Fhd-address-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb3w%2Fhd-address-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb3w%2Fhd-address-cli/lists"}