I've finished all of the initial features of pywit and released version 1.0.3 on Github! Pywit is a steem witness and wallet command line tool built in Python, using holger80's beem. I took inspiration from Netherdrake's conductor, but I added some extra features as well. I've released it under the GNU General Public License v3.0, and would love any input or contributions y'all may have!
Pywit is at version 1.0.3 because, while I was writing this post after getting to 1.0.0, then 1.0.1 after adding the license, I decided to add some testing stuff with CircleCI because I've been meaning to figure out how to use CI tools. Not a lot of tests yet, but I've got CircleCI running now!
It has both an interactive command mode, and shell commands for quicker access and automation. It keeps a configuration file for your witness account, as well as having a built in wallet to store your keys. It also includes a high-verbosity debug mode and a testing mode that won't broadcast transactions. To find out what you can do just from the shell, run pywit --help.
Pywit can run a price feed for you, using several different markets through a Steem/BTC/USDT/USD proxy, as well as a separate Steem/BTC/USD proxy that are then averaged together (inspiration for these proxies, although not as well implemented, came from someguy123's steemfeed-js). You can adjust the wait time between updates, the minimum percent difference from your last price to publish an update, an option to immediately publish when you start the price feed, and pywit will also publish a feed if you haven't posted one in 24 hours. Outliers are also taken into account, and a difference too large (>25%, but might change), will not be published.
Pywit can also monitor your witness's missed blocks for you, with several different options available. The number of missed blocks (within the current session) and the time between updates are two of the options you can pass in. You can pass in the public key for a backup server, which it will switch your witness signing key to when your primary server has missed too many blocks. If you don't pass in a backup key, it will disable your witness when too many blocks have been missed. There is currently not a notification sent when your witness server misses too many blocks (I don't know how to do it in Python yet), but a large warning appears in Terminal. If you keep an eye on your witness like you should, it shouldn't be an issue anyways as you'll notice quickly.
You can also quickly enable and disable your witness from the shell, and you can get your witness status printed out. The final shell command is witness update, which takes you through questions to update your witness information. This includes all props, and will confirm that you want to update.
Check out the emergency level warning with pywit test-warning, it's pretty cool. Got the ASCII art here and figured out how to center it in a console with some help from StackOverflow. This will only appear when something time sensitive (ish) occurs, e.g. your witness monitor switching keys to backup.
The interactive console is great as well, with a lot more commands to use. First, just run pywit by itself, and it will set up your configuration, with both a witness account and a wallet (in the future, the witness account will not be required as I'm planning on making this a more versatile utility). The wallet is encrypted with a BIP38 passphrase through beem, and the witness account is stored locally, holding just your account name, witness URL, props, and default public signing key (if you've set it, it does not pull it from the network). Help is your friend in there, I tried to document all the commands as well as I could, there are also some from Cmd2 (the plugin that runs the interactive console) that are still in there to be helpful, like alias if you'd rather call a command something else.
As I wrote earlier, while I was writing this post I decided to put together CircleCI and a basic test setup into the Github as well. I'm going to be fleshing out the testing to improve my skills in that area, as well as learning how to use CI so I can start working on the main steem repository with testing like some of the other witnesses. Right now I think I'm going to be using pytest with CircleCI and tox, mostly because half of this is me learning how to write Python test code by checking out what holger80 did.
This wouldn't have been possible at all if not for beem by the awesome @holger80, both because that's the base of this tool but also because I went looking at the repo for hints whenever I got stuck with some python stuff (especially the testing).
@furion wrote the original conductor, and I wouldn't have gotten started on this if I hadn't originally been using it, tried to submit a PR for hard fork 20, and seen it not go through. After that, I looked through the whole base and decided I could figure it out myself! Next,
@someguy123's steemfeed-js gave me a lot of help figuring out how I should be calculating the price of Steem in the feeds, even though I can barely read Javascript. Finally, I couldn't have done anything without such a great Steem community. Thanks for all your previous work!
If I have seen further, it is by standing on the shoulders of Giants.
Cheers, thanks for reading! If you like my tools and content and would like to see more, Vote for me as witness or proxy your votes and I'll vote the best witnesses for you!
Pywit- A witness tool-kit built in Python on top of Holger80's Beempy.