POCKET Day 10: How to run your own confirmation bot


Total Supply update: 1,132 Genesis claims brings the total supply to 1,132,001,132 Pocket tokens. Claims are still trickling in!

How to run a confirmer bot

The setup is not extremely amateur-friendly, but I've seen worse. Two people have figured it out with minimal help from me. So it must not be that hard!

Here are basic instructions for Ubuntu 16.04, and I suspect they should work fine on most Linux distributions. I'm assuming you have the latest version of Python 3.5.

First, install the python steem library and clone the Pocket repo:

pip3 install steem
git clone https://github.com/biophil/pocket
cd pocket

(Here, if you're adventurous, you can switch to the develop branch and run that. As I'm writing this, Develop has the code which makes confirmer bots vote for valid confirmations, which will help improve the robustness of the system. I haven't fully tested that code, so it might give you surprising errors.)
Run the blockchain_reader.py script:

python3 blockchain_reader.py

The first time, it will exit with the error message FileNotFoundError: Please populate config.json file with relevant values.
So open config.json with your favorite text editor and fill in the following fields; I've included here @pocket-a's values:

"confirm_message": "Thanks for using POCKET! I am running [this confirmer code.](https://github.com/biophil/pocket)"
"confirmer_account": "pocket-a"
"confirmer_key": <your account's private Posting key>
"confirmation_active": true
"nodes": [""]

If you are running a local steemd node, the last one, nodes, should be set to ["localhost:8092"] (or whichever port you're running it on). Or, alternatively, you could give it a custom list of public nodes you want it to connect to; enclose each node in double quotes and separate by commas.

Once you've set up your config.json, you're ready to roll! Note: if you are not using a local steemd node, you may want to contact me for a recent snapshot of the Pocket database. Populating the database from scratch on public nodes probably takes a long time, since you have to scan the entire blockchain block-by-block. I'm running an experiment on that right now to see just how long.

Anyway, open a screen terminal and hit it:

screen [press Enter]
python3 blockchain_reader.py

How to see how the sync is going

Once you're running the blockchain_reader.py script, the code will scan through the entire Steem blockchain computing everybody's eligibility and looking for Pocket commands. To check its progress, run these python commands in another terminal window:

python3
>>> import util.db as db
>>> DB = db.Mist_DB()
>>> DB.last_parsed_block()
200

That tells us that it's gotten all the way up to Steem block 200! That's not very far; Steem has over 15,000,000 blocks as I'm writing this. If you want to check again later in that same Python session, run this:

>>> DB._load()
>>> DB.last_parsed_block()
200

Finally, once it gets to Genesis, you'll start seeing messages in your terminal about transactions coming through and if all is well, it'll start confirming for you.

Contact me here or on steemit.chat if you have any questions or if you need a database snapshot!

For more information

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now