Does anyone know if its possible to get a list of the accounts on a node using golang, after Dialing to the node, basic PoC would be assuming the accounts are already unlocked via the CLI

Basically looking for the same functionality as web3.eth.Accounts() or to list the account addresses on a remote geth node that are already unlocked via the CLI

  • Could you clarify/define "dialling into the node"? – Linmao Song Dec 1 '18 at 17:58
  • To connect to a node in go you use the ethclient.Dial() – Kravitz Dec 1 '18 at 17:59

One way is to interact with the keystore, this is a package i wrote for interacting with keystore function "GetAllKeys" will list all the accounts. package keystore

import (


type KeyStore struct {
    Handle *keystore.KeyStore

func SetUpKeyStore(kp string) *KeyStore {
    ks := &KeyStore{}
    ks.Handle = keystore.NewKeyStore(kp, keystore.LightScryptN, keystore.LightScryptP)
    return ks

func (ks *KeyStore) CreateNewKeys(password string) accounts.Account {
    account, err := ks.Handle.NewAccount(password)
    if err != nil {
    return account

func (ks *KeyStore) GetKeysByAddress(address string) accounts.Account {

    var account accounts.Account
    var err error
    if ks.Handle.HasAddress(common.HexToAddress(address)) {
        if account, err = ks.Handle.Find(accounts.Account{Address: common.HexToAddress(address)}); err != nil {
    return account

func (ks *KeyStore) GetAllKeys() []accounts.Account {

    return ks.Handle.Accounts() 
  • What is the implementation here? setupKeyStore(string), what string? Then pass *keystore to GetAllKeys? – Daithí Aug 28 '19 at 14:32

Ended up writing my own implementation doing a post request to the node, pretty much what web3 does under the hook with RPC/WS endpoints

  • any more details on POST request or link to doc/rpc methods? – Daithí Aug 28 '19 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.