1

I want to return all the associated EOS accounts that is linked to a specific public key in JSON format for my javascript dapp. Currently I can paste the pub key into: https://eosflare.io/key/EOS6M1m2KBk8BF6uwEnRyjXvpBTUxqLfMUZALzsUGtrHvcEHTYFi1

But there is no JSON output. How can I just a RELIABLE EOS endpoint to do these queries to get a JSON output of all the accounts associated to a pub key?

Do I use one of these endpoints? https://www.eosdocs.io/resources/apiendpoints/

1 Answer 1

1

Yes you can query that api end points as i have performed query on this api from https://www.eosdocs.io/resources/apiendpoints/ with post parameter {"public_key":"EOS6M1m2KBk8BF6uwEnRyjXvpBTUxqLfMUZALzsUGtrHvcEHTYFi1"} and api url is

https://eos.greymass.com:443/v1/history/get_key_accounts

I am not sure but i think this can be done by eosjs also.

Here is code for js

var request = require('request');


    var Body = {"public_key":"EOS6M1m2KBk8BF6uwEnRyjXvpBTUxqLfMUZALzsUGtrHvcEHTYFi1"};
      //options for liverate api of btc,eth and eos
    var options = {
        url: 'https://eos.greymass.com:443/v1/history/get_key_accounts',
        json: true,   // <--Very important!!!
        body: Body

    };

    function callback1(error, response, body) 
    {
        console.log("in jssss");
       console.log(body);
    }        
    request.post(options, callback1);  
6
  • Do you have a js sample code I can test in the chrome console? Commented Nov 27, 2018 at 9:47
  • @Patoshiパトシ i have edited my answer have a look at it for js code
    – Mr.Y
    Commented Nov 27, 2018 at 9:57
  • what is require('request')? is that a library I need to fetch? Commented Feb 13, 2019 at 16:50
  • It's a node module to post data on url for more you can find out here npmjs.com/package/requesthttps://www.npmjs.com/package/request
    – Mr.Y
    Commented Feb 14, 2019 at 4:41
  • cant i just use pure js instead of external library? Commented Feb 14, 2019 at 15:30

Your Answer

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

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