Inspired by @gadrian's recent post "Had a look at my approved witness list [...]" I decided to take a look to my own witness votes. One aspect here was: do I vote for inactive witnesses. While there's nothing wrong with voting for (permanently) inactive witnesses, it just doesn't benefit anybody. There are probably a couple of tools already out there to get the same information, but I'll take the occasion to show how this can be done with beem/python:
- get a list of all witnesses an account votes for
- get the witness details of those
- check if they have set the 'disabled' signing key STM1111111111111111111111111111111114T1Anm
- check for how long they haven't been scheduled a block
import sys from beem import Steem from beem.blockchain import Blockchain from beem.account import Account from beem.witness import GetWitnesses from prettytable import PrettyTable from datetime import timedelta, datetime s = Steem(use_condenser=True) a = Account(sys.argv, steem_instance=s) pt = PrettyTable(['Witness', 'inactive since']) head = Blockchain(mode='head', steem_instance=s).get_current_block_num() for w in GetWitnesses(a['witness_votes'], steem_instance=s): if w.is_active is True: inactive_date = "active" else: inactive = timedelta(seconds=(head - w['last_aslot']) * 3) inactive_date = (datetime.utcnow() - inactive).date() pt.add_row([w['owner'], inactive_date]) print(pt)
- The list of voted witnesses is only available via the condenser API (for whatever reason?!) - this is why it needs a dedicated
- The last scheduled block is given as a block number. In order to get the time since then, I take the difference in blocks to the current head block and calculate the time with the Steem block time (3s).
Save the snippet above as a .py file and run it with python (assuming beem is installed):
python [filename].py [your_account]
Here's the result for me
There are two candidates who shut down their witnesses and were last scheduled around half a year ago. I'll probably unvote those.
I realize I have quite a couple of free slots - not that my stake moves the ranks, but time to have a look for new witnesses to vote. Every vote counts.
Feel free to leave a comment if you want to have your witness votes checked, I can run the same script for you.