该Go应用程序旨在使用确定性BIP-39助记符或任意种子字符串作为种子来生成以太坊钱包。
注意:此工具主要用于开发和测试!如果您正在寻找更安全、更完整的解决方案mainnet,请考虑使用ethereal和/或ethdo。
命令行参数
Usage: ethw <command>
Flags:
-h, --help Show context-sensitive help.
--log-level="fatal" Configure logging level ($LOG_LEVEL)
--log-format="text" Configure logging format ($LOG_FORMAT)
Commands:
wallet create <seed> ...
Create new Ethereum wallets
keystore create <wallets> ...
Manage Ethereum keystores
keystore list
List all wallets from the keystore
seed create
Create a new seed
version
Display the application version
Run "ethw <command> --help" for more information on a command.
使用示例
钱包生成
下面您可以看到使用wallet create子命令生成以太坊钱包的一些示例:
从种子生成以太坊钱包
确保指定seed参数:
$ ethw wallet create --output=table "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar"
您应该期望得到类似如下的输出:
+---+-------+--------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| # | ALIAS | ADDRESS | PRIVATE KEY | PUBLIC KEY |
+---+-------+--------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| 1 | | 0x8d86D515fbee6A364C96Cf60f3220826f13A64F3 | 1d0b0a3898ff359032970f9d831269020d78463d861b305f40b1a85bed5bcefe | 04119a43acba93317d89e4a1181cbcef1a8ac28fdee7bb0df785db2510534b4a001cff289a9b70eb8d962009490c64bc546aa1fc0c880a4d608275639cab07391c |
+---+-------+--------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
使用别名生成多个钱包
一次生成多个钱包并分配别名以提高可读性:
$ ethw wallet create --output=table "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar;alias=Hermione Granger" "seed=radar sibling empty knee dignity text remind curtain panda feel apology crouch;alias=Harry Potter"
输出表将显示别名:
+---+------------------+--------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| # | ALIAS | ADDRESS | PRIVATE KEY | PUBLIC KEY |
+---+------------------+--------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| 1 | Hermione Granger | 0x8d86D515fbee6A364C96Cf60f3220826f13A64F3 | 1d0b0a3898ff359032970f9d831269020d78463d861b305f40b1a85bed5bcefe | 04119a43acba93317d89e4a1181cbcef1a8ac28fdee7bb0df785db2510534b4a001cff289a9b70eb8d962009490c64bc546aa1fc0c880a4d608275639cab07391c |
| 2 | Harry Potter | 0x6f339aB74be047e3C5e5a784e2D4dDB5C161a034 | 130cf1653ae56b5278203d140509306fdf2f2a619ce54a64d54b688114339c8f | 04740ae95d36f6bc8b906fd4ee56cc048a0c94a323dd9cd74505e4de30ce52f4799ddc478df118b8377b0378d870014d36ae3fa98409f0a6bfd45fc9d31e54be9b |
+---+------------------+--------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
生成具有不同输出格式的钱包:
您还可以生成钱包并以和JSON格式输出它们CSV,这对于jq和等实用程序很有用dasel:
$ ethw wallet create --output=json "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar"
输出将如下所示:
[{"alias":"Hermione Granger","address":"0x8d86D515fbee6A364C96Cf60f3220826f13A64F3","private_key":"1d0b0a3898ff359032970f9d831269020d78463d861b305f40b1a85bed5bcefe","public_key":"04119a43acba93317d89e4a1181cbcef1a8ac28fdee7bb0df785db2510534b4a001cff289a9b70eb8d962009490c64bc546aa1fc0c880a4d608275639cab07391c"}]
密钥库
此功能允许直接生成密钥库,以兼容 Geth 和其他执行客户端。
钱包数据格式:
- seed=
,其中 是生成钱包的种子,可以是助记词或任意字符串。 - password=
,其中 是保护密钥库的密码(请记住在终端上直接使用密码会导致密码泄露)。
一些例子:
创建单个密钥库
$ ethw keystore create "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar;password=1234"
在密钥库中创建多个钱包
与生成钱包时相同,您可以将多个钱包添加到一个钱包中keystore:
$ ethw keystore create "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar;password=1234" "seed=radar sibling empty knee dignity text remind curtain panda feel apology crouch;password=5678"
覆盖现有的密钥库
您可以使用参数删除单个密钥库中找到的所有内容--overwrite:
$ ethw keystore create --overwrite "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar;password=1234"
指定自定义密钥库目录
默认情况下,ethw将在您调用命令的当前目录中创建一个密钥库,但您可以轻松地使用以下命令覆盖它--keystore-dir:
$ ethw keystore create --keystore-dir=./my_keystore "seed=crouch apology feel panda curtain remind text dignity knee empty sibling radar;password=1234"