A Python script to unvote top20 witnesses

in #test5 years ago (edited)
from lighthive.client import Client
from lighthive.datastructures import Operation

def unvote_top_20(account, active_key):
    c = Client(keys=[active_key])
    top20_witnesses = set(
        [w["owner"] for w in c.get_witnesses_by_vote("", 20)])
    witness_votes = set(c.get_accounts([account])[0]["witness_votes"])
    intersection = top20_witnesses.intersection(witness_votes)
    print("These witnesses will be unvoted:", ", ".join(intersection))

    ops = []
    for witness in intersection:
        op = Operation('account_witness_vote', {
            'account': account,
            'witness': witness,
            'approve': False,
        })
        ops.append(op)

    c.broadcast(ops)


if __name__ == '__main__':
    unvote_top_20("your_account_name", "<active_key>")

The result:



Not that there is something wrong with anybody in the top20 list at the moment, however, the amount of difference [MV] in votes between top20 and the rest is very big.

Of course, I've some favorite people on that list, so in case they have a danger to lose their spot, I'll be voting for them, again. But until then, it's what it's. I'll be using my spare votes for promising backup witnesses instead.

If you agree with this approach, you can set me your witness voting proxy, so that you don't have to deal with this yourself.