2

is there any way to get the name for a given public key, something like?

      eos.getKeyAccounts({
        "public_key": "EOS73iTgPXEPXGazpU6XzU5Vq81Qk7TUHsmujTYn9DKJHm4MX1e2j"
      })

Am I reading this wrong or is it out of date? https://github.com/EOSIO/eosjs-api/blob/master/src/api/v1/history.json#L32

When I call the function with no arguments i get this back

USAGE
getKeyAccounts - undefined

PARAMETERS
{
  "public_key": "public_key_type"
}

RETURNS
{
  "account_names": "account_name[]"
}

ERRORS
nothing special

the error I get is

api error =>  https://api.eosrio.io/v1/chain/get_account {"account_name":"EOS73iTgPXEPXGazpU6XzU5Vq81Qk7TUHsmujTYn9DKJHm4MX1e2j"}

2 Answers 2

1

Wrong address. It should be

https://api.eosnewyork.io/v1/history/get_key_accounts

with POST data:

{"public_key":"EOS73iTgPXEPXGazpU6XzU5Vq81Qk7TUHsmujTYn9DKJHm4MX1e2j"}
1

Also, if you want to use a command line solution, you can try:

$ cleos -u http://api.eosnewyork.io  get accounts <public key> 

This will return all the accounts associated with a public key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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