eth 命令 eth.accounts

1. 执行结果

eth.accounts
["0xd4c3b95bf0bbf0fd0087062125dd572114ded44f", "0x3024ae5b7e9010c90ef9a3e9026c1c3e06670cee", "0xe97f041cec59c4874d0335800fc2a840477fa753", "0xe1d91374d7c62c5aac13a71df80e9e7d1f81a3aa", "0x7695cad6c74ff1aa8ddf0c5941c7d5676d02cbd9"]


2.

go-ethereum/internal/ethapi/api.go

func (s *PublicAccountAPI) Accounts() []common.Address {
    addresses := make([]common.Address, 0) // return [] instead of nil if empty
    for _, wallet := range s.am.Wallets() { //manager的 wallets
        for _, account := range wallet.Accounts() { //wallet的 account
            addresses = append(addresses, account.Address)
        }
    }
    return addresses
}

你可能感兴趣的:(eth 命令 eth.accounts)