How to Get Blockchain Version of Steem RPC Node using Javascript?
In the Load Balancer RPC Node: https://steem.justyy.workers.dev the return response contains a custom header version which is basically the Version of the RPC Node for the Invoked Steem Node. To obtain this information, it is basically the same as sending the following parameters to invoke the get_version api:
{"id":0,"jsonrpc":"2.0","method":"call","params":["login_api","get_version",[]]}
To wrap it in async Javascript Function - which returns the version string:
async function getVersion(server) {
return new Promise((resolve, reject) => {
fetch(server, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({"id":0,"jsonrpc":"2.0","method":"call","params":["login_api","get_version",[]]})
}).then(response => {
resolve(response.text());
}).catch(function(error) {
reject(error);
});
});
}
To invoke it, we can do something like this:
(async function() {
const ver = await getVersion("https://api.justyy.com");
console.log(ver);
})();
This gives the following to the console:
{"jsonrpc":"2.0","result":{"blockchain_version":"0.23.1","steem_revision":"46c7d93db350e8b031a81626e727c92b27d7348b","fc_revision":"46c7d93db350e8b031a81626e727c92b27d7348b"},"id":0}
The above code can be viewed and tested directly in the SteemJs Editor
Every little helps! I hope this helps!
Steem On!~
Reposted to Computing & Technology
If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

拍行长👏
感谢,回赞。
Great work. carry on
Thanks!
most welcome @justyy . I would like to invite you in my blog. I am artist. Hope you like my art.