Are Top 20 Witnesses Voting Each Other? Introducing Witness-voti

  • 时间:2020-09-09 13:08:38
  • 分类:网络文摘
  • 阅读:125 次

Let’s introduce a concept i.e. witness-voting factor that represent the average witness voting each other in the TOP 20. The maximum value is 20, and the minimal is 0.

If the witness-voting factor is 20, it means that all top 20 witnesses are voting each other. This is not healthy as the gap (of votes) between TOP 20 and the rest will be always increasing. Also, since witnesses are voting each other, it is kinda controlled by a group of people who share the same interests – this is centralisation admit it or not.

SteemJs code to compute the witness-voting factor
The idea is to retrieve the list of the votes of the TOP 20, and group them, count the frequency and sort them. Compute the average. The witness-voting factor for Top 20 on STEEM blockchain is 4.5, compared to 12.65 on HIVE.

Run the following in SteemJs Editor.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
function getTotalWitnesses() {
    return new Promise((resolve, reject) => {
      steem.api.getWitnessCount(function(err, result) {
          if (!err) {
              resolve(result);
          } else {
              reject(err);
          }
      });
    });
}
 
function getAllWitnessAccounts(total) {
    return new Promise((resolve, reject) => {
          steem.api.getWitnesses([...Array(total).keys()], function(err, result) {
            if (!err) {
                resolve(result);
            } else {
                reject(err);
           }
        });
    });
}   
 
function getAccounts(accounts) {
    return new Promise((resolve, reject) => {
          steem.api.getAccounts(accounts, function(err, result) {
            if (!err) {
                resolve(result);
            } else {
                reject(err);
           }
        });
    });
}   
 
(async function () {
    const totalWitnesses = await getTotalWitnesses();
    let data = await getAllWitnessAccounts(totalWitnesses);
    data = data.filter(x => {
        // reduce the noise
        return (x.votes > 0) && (x.running_version === "0.23.1");
    });
    // sort by votes
    data.sort((a, b) => {
        return b.votes - a.votes;
    });
    // only count TOP 20 witnesses
    data = data.slice(0, 20);
    let top = [];
    data.map((x) => {
        top.push(x.owner);
    });
    const accountData = await getAccounts(top);
    let votes = {};
    data.map((x) => {
        const account = accountData.filter(v => {
            return v.name === x.owner
        });
        // count the vote frequency for each witness
        for (let w of account[0].witness_votes) {
            if (typeof votes[w] === "undefined") {
                votes[w] = 1;
            } else {
                votes[w] ++;
            }
        }
    });    
    
    var items = Object.keys(votes).map(function(key) {
      return [key, votes[key]];
    });
    
    items.sort(function(first, second) {
      return second[1] - first[1];
    });
    
    let x = 0, cnt = 0;
    for (let w of items) {
        // TOP 20 witnesses only
        if (top.includes(w[0])) {
            log(w[0] + ", " + w[1]);
            x += w[1];
            cnt ++;
        }
    }
    log(x/cnt);
})();
function getTotalWitnesses() {
    return new Promise((resolve, reject) => {
      steem.api.getWitnessCount(function(err, result) {
          if (!err) {
              resolve(result);
          } else {
              reject(err);
          }
      });
    });
}

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

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

(async function () {
    const totalWitnesses = await getTotalWitnesses();
    let data = await getAllWitnessAccounts(totalWitnesses);
    data = data.filter(x => {
        // reduce the noise
        return (x.votes > 0) && (x.running_version === "0.23.1");
    });
    // sort by votes
    data.sort((a, b) => {
        return b.votes - a.votes;
    });
    // only count TOP 20 witnesses
    data = data.slice(0, 20);
    let top = [];
    data.map((x) => {
        top.push(x.owner);
    });
    const accountData = await getAccounts(top);
    let votes = {};
    data.map((x) => {
        const account = accountData.filter(v => {
            return v.name === x.owner
        });
        // count the vote frequency for each witness
        for (let w of account[0].witness_votes) {
            if (typeof votes[w] === "undefined") {
                votes[w] = 1;
            } else {
                votes[w] ++;
            }
        }
    });    
    
    var items = Object.keys(votes).map(function(key) {
      return [key, votes[key]];
    });
    
    items.sort(function(first, second) {
      return second[1] - first[1];
    });
    
    let x = 0, cnt = 0;
    for (let w of items) {
        // TOP 20 witnesses only
        if (top.includes(w[0])) {
            log(w[0] + ", " + w[1]);
            x += w[1];
            cnt ++;
        }
    }
    log(x/cnt);
})();

Here is the detail result:

future.witness, 7
justyy, 7
steem-agora, 7
steemchiller, 7
dev.supporters, 6
dlike, 6
maiyude, 6
steem-supporter, 6
symbionts, 6
steem-dragon, 4
scissor.sisters, 4
cryptoking777, 3
hivei0, 3
hoasen, 3
juddsmith079, 3
matreshka, 3
protoss20, 3
hinomaru-jp, 2
inwi, 2
rnt1, 2

–EOF (The Ultimate Computing & Technology Blog) —

推荐阅读:
煲汤的诀窍及胡萝卜熟吃煮汤更营养  胡萝卜不但可以保护视力还对精子有益  节令食品年糕的营养价值与食用禁忌  如何吃辣椒不上火?怎样吃辣椒更健康?  冬季养生黄金期可多吃这些保健食物  三种食物滋阴润燥蜂蜜是冬天补养佳品  川贝雪梨适合秋咳 甘草片止咳不治咳  花生营养丰富怎么吃对人体健康最有益  吃水果的禁忌以及富含维生素的水果  黄瓜的营养价值保健效果及食用方法 
评论列表
添加评论