SteemJs: How Many Witnesses are Running on 23.1?

in #witness-category4 years ago (edited)

How many witnesses are running on 23.1 and how many of them are active? It turns out answering this question does not require preprocess blocks on steem blockchain e.g. SteemSQL. Rather, we can get the answer by pure SteemJS.

Get All Witnesses

First, we can use the steemp.api.getWitnessCount to return the list of all registered witnesses - which is a lot more than we thought, currently more than 1400 witnesses but of course many of them have been disabled or never produced a block.

function getTotalWitnesses() {
    return new Promise((resolve, reject) => {
      steem.api.getWitnessCount(function(err, result) {
          if (!err) {
          } else {

Get All Witnesses Accounts

Then, we can use steem.api.getWitnesses to retreive the witnesses information for multiple accounts at the same time.

function getAllWitnessAccounts(total) {
    return new Promise((resolve, reject) => {
          steem.api.getWitnesses([...Array(total).keys()], function(err, result) {
            if (!err) {
            } else {


Then, we can chain those two functions to filter out those witnesses that are running 23.1 and are active.

(async function () {
    const totalWitnesses = await getTotalWitnesses();
    let data = await getAllWitnessAccounts(totalWitnesses);
    log(data.filter(x => {
        return x.running_version === "0.23.1" && (x.signing_key !== "STM1111111111111111111111111111111114T1Anm");

The answer is 46 witnesses are running on 23.1 and all of them are active.

If we point the RPC node to HIVE chain, we get 107 witnesses running on 23.0.

Run the code using SteemJs

Slightly changing the query, we know:
There are 24 Witnesses running at 0.23.0 but they are disabled.
And there are 9 witnesses running at 0.23.0 and they are 'active' which may be those HIVE witnesses who didn't take offline they witnesses.

BTW, i have added the dSteem into the SteemJs tool:

Every little helps! I hope this helps!

Steem On!~
Reposted to Blog

If you like my work, please consider voting for me, thanks! 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:

Visit me at:

Coin Marketplace

STEEM 0.33
TRX 0.11
JST 0.034
BTC 66438.74
ETH 3268.32
USDT 1.00
SBD 4.39