我正在尝试在命令行上使用密码,而不是使用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:意外令牌附近的语法错误`('
有两种方法可以从命令行创建帐户。
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>
以下是了解更多关于management APIs的链接