Given a list of block producers such as this one:
or this one
How do I figure out the API endpoints that I can connect to with
cleos to interact with the blockchain.
EOS.IO Stack Exchange is a question and answer site for users and developers of distributed applications built on top of the blockchain operating system, EOS.IO. It only takes a minute to sign up.Sign up to join this community
You can find the api endpoint for any BP by querying their
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
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.
cleos -u https://eosapi.blockmatrix.network:443 get info
cleos -u http://mainnet.eoscalgary.io:80 get info
cleos -u https://api.eosdetroit.io:443 get info
cleos -u https://api.eosmetal.io:18890 get info
cleos -v -u http://api.eosnewyork.io get info
cleos -u https://node1.eosphere.io get info
cleos -u https://node2.eosphere.io get info
cleos -u http://nodes.eos42.io:80 get info
cleos -u https://eos.greymass.com:443 get info
cleos -u http://api.hkeos.com:80 get info
cleos -u https://fn.eossweden.se:443 get info
cleos -u https://eos.saltblock.io get info
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://18.104.22.168:8888 get info
http://api.bp.fish works as well. We also have a p2p node up at p2p.bp.fish
We can do this programmatically by utilizing
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