Updating your witness with Python

in #witness-category9 years ago (edited)

It is now trivially easy to update your witness with a few lines Python:

from steemtools.experimental import Transactions

t = Transactions()
props = {
    "account_creation_fee": "15.000 STEEM",
    "maximum_block_size": 65536,
    "sbd_interest_rate": 500,
}
tx = t.witness_update("furion", "<PUBLIC_POSTING_KEY>", "https://steemdb.com/@furion/witness", props, "<PRIVATE_ACTIVE_KEY>", sim_mode=False)
pprint(tx)

Outputs:

{'expiration': '2016-09-21T19:50:27',
 'extensions': [],
 'operations': [['witness_update',
                 {'block_signing_key': 'STM7WDG2QpThdkRa3G2PYXM7gH9UksoGm4xqoFBrNet6GH7ToNUYx',
                  'fee': '0.000 STEEM',
                  'owner': 'furion',
                  'props': {'account_creation_fee': '15.000 STEEM',
                            'maximum_block_size': 65536,
                            'sbd_interest_rate': 500},
                  'url': 'https://steemdb.com/@furion/witness'}]],
 'ref_block_num': 59959,
 'ref_block_prefix': 4091806926,
 'signatures': ['205afd9f3ac04...1bb0459320894e']}

Why would you want to update your witness programmatically?
1.) If you would like to stop minting blocks while your witness is offline, or being upgraded, then you should update your witness with an empty signing key "" to avoid missing blocks.

2.) If you would like to do an automated failover to another server, you should change your signing key to avoid forking (very bad).

3.) Because its easier and more fun than cli_wallet.

Source
> steemtools on GitHub

Big thanks to @jesta for the challenge.



Don't miss out on the next post - follow me.
steemtools | steem.li | witness


Sort:  

So awesome, thank you for toiling away on this. I've been fighting with the same issues you initially encountered while I've been experimenting with this. Big kudos to putting your effort into it and getting it done.

I'll be using this for my witness nodes now to assist in automatic failover!

It is actually always easier with the cli_wallet, assuming u know what to do. :D

But you can't automate failover as securely with the cli_wallet ;)

Perhaps I should elaborate what I meant by easier. With a Python script, you can re-run it at anytime, as well as have it be part of the automated system. To be fair, you could also do this with the wallet RPC, so now that I think of it, its not a super valid point anymore :) The more fun part subjectively still stands :)

Coin Marketplace

STEEM 0.08
TRX 0.30
JST 0.037
BTC 105364.68
ETH 3554.54
USDT 1.00
SBD 0.55