I know I can get the public key from cleos for a given account but is the reverse possible? Basically, I am trying to find all the account names associated with a public key.
Yes, it's possible, you can just retrieve all the accounts for a given public key running the command cleos get accounts EOS_PUB_KEY
Another way to check the accounts for a public key, from an external application, is using the EOS RPC Api, check this out: https://developers.eos.io/eosio-nodeos/reference#get_key_accounts-1
-
-
Is there a public domain I can use instead of 127.0.0.1 for xhr.open("POST", "127.0.0.1:8888/v1/history/get_key_accounts"); ? – Patoshi パトシ Dec 13 '18 at 18:45
-
I don't see a function to get all accounts but one could do:
keys=`cleos wallet keys | grep -v "[]\[]" | cut -f 2 -d "\""`; for i in $keys; do cleos get accounts $i; done
– colin Jan 14 '19 at 4:49 -
this was working only with a now deprecated plugin for the node (history plugin) – colin May 13 '19 at 3:47