英文:
The error "personal is not defined" occurs when running Geth
问题
我想使用Geth来建立一个本地以太坊测试网络。
我的启动命令是:geth --datadir ./data --nodiscover console 2>>geth.log.
当我尝试使用personal.newAccount("12345")创建一个帐户时,终端报告了一个错误"personal is not defined"。
我尝试在启动命令中添加以下命令:--http --http.api 'web3,eth,net,debug,personal'
,但没有起作用。
英文:
I want to use Geth to set up a local Ethereum test network.
My startup command is: geth --datadir ./data --nodiscover console 2>>geth.log.
When I tried to create an account using personal.newAccount("12345"), the terminal reported an error "personal is not defined".
I tried to add the command --http --http.api 'web3,eth,net,debug,personal'
to the startup command, but it didn't work.
答案1
得分: 3
Personal Namespace has been deprecated.
Instead,
create a new user with the Clef command.
如果您已经安装了geth,clef应该已经安装。
which clef
>/opt/homebrew/bin/clef
或者类似的位置。
要使用clef创建新用户,请创建一个keystore文件。如果在dataDir下没有keystore文件夹,请创建一个。
mkdir [yourDataDir/keystore]
然后运行以下命令
clef newaccount --keystore [yourDataDir/keystore]
输入命令后,会要求您输入"ok"。然后输入您的密码(至少10个字符)。
> 生成了您的新密钥
将显示在屏幕上。
密钥文件将生成在--keystore指定的文件夹中。
接下来,通过指定由geth命令生成的keystore文件所在的文件夹来启动。
例如,使用--keystore选项指定如下。
geth --networkid "15" --nodiscover --datadir . / --keystore . /keystore console 2>> . /log/geth_err.log
当提示启动时。
您可以在提示中检查
eth.accounts
>["0x94c52f891819d46b15d84a05e621f15f20ab307b"]
您的用户钱包应该已经增加。
英文:
Personal Namespace has been deprecated.
Instead,
create a new user with the Clef command.
If you have installed geth, clef should be installed.
which clef
>/opt/homebrew/bin/clef
or something similar.
To create a new user with clef, create a keystore file. if there is no keystore folder directly under dataDir, create one.
mkdir [yourDataDir/keystore]
Then run the following command
clef newaccount --keystore [yourDataDir/keystore]
After typing the command
You will be asked for "ok". Then enter your password. (At least 10 characters).
> Your new key was generated
should appear on the screen.
The key file is generated in the folder specified in
--keystore.
Next, start by specifying the folder where the keystore file generated by the geth command is located.
For example, specify it with the --keystore option as follows.
geth --networkid "15" --nodiscover --datadir . / --keystore . /keystore console 2>> . /log/geth_err.log
When the prompt starts up.
You can check in prompt
eth.accounts
>["0x94c52f891819d46b15d84a05e621f15f20ab307b"]
Your user wallet should have increased.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论