一、利用节点生成地址keystore
进入节点控制台,执行以下命令
# geth attach
> personal.newAccount()
Passphrase: 输入密码
Repeat passphrase: 再次输入密码
"0x603136f51b165303862008c6d1031c6ea5c5e229"
我们在控制台输入personal.newAccount会创建一个新的账户,会进入到ethapi.api中的newAccount方法中,这个方法会返回一个地址。
// NewAccount will create a new account and returns the address for the new account.
func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) {
ks, err := fetchKeystore(s.am)
if err != nil {
return common.Address{}, err
}
acc, err := ks.NewAccount(password)
if err == nil {
log.Info("Your new key was generated", "address", acc.Address)
log.Warn(