geth account new - 命令行上的密码

问题描述 投票:0回答:2

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

geth --password mYp@ssw0rd account new

但以上抛出:

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

这是有道理的,因为--password期望“密码文件用于非交互式密码输入”。 有没有办法使用geth直接在命令行上提供密码?就像是:

geth --password mYp@ssw0rd account new

我见过 article on go-ethereum wiki使用:

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

但这会在CentOS上引发另一个错误:

-sh:意外令牌附近的语法错误`('

blockchain ethereum web3 go-ethereum geth
2个回答
0
投票

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

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

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


0
投票

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

geth attach

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

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

要么

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

以下是了解更多关于management APIs的链接

© www.soinside.com 2019 - 2024. All rights reserved.