6

Given a list of block producers such as this one:

https://eosportal.io/chain/12/producers

or this one

http://eosnetworkmonitor.io/

How do I figure out the API endpoints that I can connect to with cleos to interact with the blockchain.

0

3 Answers 3

8

You can find the api endpoint for any BP by querying their bp.json file.

The bp.json file has information about the BP publishing it, and among other things it has a key called api_endpoint which is what you need.

Every BP should publish their bp.json on their url - copy the web link for the BP you want from http://eosnetworkmonitor.io/ and append /bp.json to it.

For example for eosnewyork the bp.json file lives on: http://bp.eosnewyork.io/bp.json.

PS: This question was originally asking for a list of endpoints. Leaving the original answer below as a quick reference to some endpoints that should be up.

Every endpoint below should respond to get info.

System commands (cleos system listproducers for example) may result in errors from some of the nodes. That's by design as some BPs are running their nodes behind firewalls with some functionality disabled/blocked.


https://blockmatrix.network/

cleos -u https://eosapi.blockmatrix.network:443 get info


https://eos.cafe/

cleos -u http://mainnet.eoscalgary.io:80 get info


http://eosdetroit.io/

cleos -u https://api.eosdetroit.io:443 get info


https://eosmetal.io/index_en.html

cleos -u https://api.eosmetal.io:18890 get info


https://www.eosnewyork.io/

cleos -v -u http://api.eosnewyork.io get info


https://www.eosphere.io/

cleos -u https://node1.eosphere.io get info

cleos -u https://node2.eosphere.io get info


https://eos42.io/

cleos -u http://nodes.eos42.io:80 get info


http://greymass.com/

cleos -u https://eos.greymass.com:443 get info


https://www.hkeos.com/

cleos -u http://api.hkeos.com:80 get info


https://eossweden.se/

cleos -u https://fn.eossweden.se:443 get info


https://www.saltblock.io/home

cleos -u https://eos.saltblock.io get info


https://www.worbli.io/

cleos -u http://eos-api.worbli.io:80 get info

cleos -u https://eos-api.worbli.io:443 get info


I have no idea who this belongs to (but it works):

cleos -u http://185.109.149.236:8888 get info

1

http://api.bp.fish works as well. We also have a p2p node up at p2p.bp.fish

1

We can do this programmatically by utilizing cleos, jq, sed, and wget.

First of all, we get a list of all the block producers, and specifically we get the URL for their websites:

cleos get table eosio eosio producers -l -1 | jq -r '.rows[].url' > bp_url.dat

Next, we need to add wget to each of these URLs

sed -e 's/^/wget -t 1 --timeout=1 /' -i bp_url.dat

And finally, we can generate a script to add bp.json to the end of each website from the BPs

sed -e 's/$/\/bp.json; cat bp.json | jq -r ".nodes[] | select(.node_type == \\\"full\\\") | .api_endpoint"/' bp_url.dat > api_endpoints.sh

If you run this script, it will download each bp.json file, then print the API endpoints to terminal, you can save the results by doing:

chmod +x ./api_endpoints.sh
./api_endpoints.sh > api_endpoints.dat

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.