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

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

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) —

推荐阅读:
How to Turn Your Best Blog Posts Into Even Better Videos  Why You Need Influencers for Your Brand In 2019  How to Use a Blog to Increase Ecommerce Sales  Why conducting a website audit is important  How to Write a Great Blog Post for a Global Audience  Top Reasons Why Your Blog Sucks at Making Money (and How to Fix   How To Write A Great Product Placement Blog Post  Structured Data for SEO Blogging  5 Ways a Blog Can Help Your Business Grow  How to Create Killer Project Proposals to Land Five-Figure Blogg 
评论列表
添加评论