Geth 帐户新建 - 命令行上的密码



我正在尝试在命令行上使用密码,而不是使用 geth 将其保存在文本文件中:

geth --password mYp@ssw0rd account new

但以上抛出:

致命:无法读取密码文件:打开mYp@ssw0rd:没有此类文件或 目录

这是有道理的,因为--password需要一个"用于非独立密码输入的密码文件"。
有没有办法使用 geth 直接在命令行上提供密码?像这样:

geth --password mYp@ssw0rd account new

我在go-ethereum wiki上看到过一篇文章,使用:

geth --password <(echo -n mYp@ssw0rd) account new

但这在 CentOS 上抛出了另一个错误:

-sh:意外标记"("附近的语法错误

有两种方法可以从命令行创建帐户。

geth account new --password <(echo $mypassword)
geth account new --password [arg] 

[arg] = 包含密码而不是密码本身的文件的名称。

另一种方法是在PowerShell的一个窗口中启动网络(如果使用Windows)然后,在新的 PowerShell 窗口中,执行

geth attach

然后将管理 API 用于各种目的,例如:

> personal.newAccount()
Passphrase:                      //Type password here
Repeat passphrase:
<addressOfNewAccount>

> personal.newAccount("PasswordHere")
<addressOfNewAccount>

这是了解有关管理 API 的更多信息的链接

最新更新