运行Geth时出现”personal is not defined"的错误

img

 personal.newAccountr123456°)
 ReferenceError:personal is not defined
     at:1:1(0)
 这个问题
 我的命令是:
 geth--datadir"./--nodiscover--networkid528-ipcdisable--port 3333-http--http.port 4444--http.api="db,eth,net,web3,personal"
 allow-insecure-unlock--http.corsdomainconsole
 找的环境:
 Version:1.11.5-stable
 GitCommit:a38f4108571d1a144dc3cf3faf8990430d109bc4
 Architecture:amd64
 Go Version: go1.20.2
 Operating System: linux
 GOPATHE
 GOROOT=lusrllocallgo

这个错误是因为您在控制台中使用了未定义的personal对象。如果您想在geth节点中使用personal对象,您需要在启动节点时启用个人账户管理API(personal API)。
您提供的启动geth节点的命令中似乎已经包括了--http.api参数来启用API,但未包括个人账户管理API(personal API)。
要启用个人账户管理API(personal API),您需要将http.api参数设置为包含personal在内的完整API列表,如下所示:

geth --datadir "./" --nodiscover --networkid 528 --ipcdisable --port 3333 --http --http.port 4444 --http.api "db,eth,net,web3,personal" --allow-insecure-unlock --http.corsdomain console

这将启用personal API并解决personal未定义错误。