A start in scripting on the HIVE Blockchain

I've been interested in trying to understand the technical aspects of the Hive Blockchain for some time, so this week I thought it was about time to try my hand at doing a bit of scripting to interact with the blockchain. I am coming to this from a long term background of programing, (starting with machine code on a ZX81 way back in .... 1981) but I have no experience of modern scripting languages so it'll be an interesting learning experience if nothing else.

I started from scratch by downloading and installing Visual Studio Code from Microsoft and installing the default Python package.

My next step was to find a way to actually read information held on the HIVE Blockchain. Hunting through many posts I came across several mentions of the beem api (beem - Unofficial Python Library for HIVE and STEEM). I did a download from the holgern/beem GitHub page and installed via the VSCode terminal window with:

pip install -U beem

It should be noted that this api hasn't been updated for about 3 years so may well have been abandoned by its creator.

Everything appeared to run as expected, so now was time to test things had been installed correctly. Referring to https://beem.readthedocs.io/en/latest/beem.account.html I copied the following code (Obviously having changed the account name to my own)


from beem.account import Account
from beem import Hive
from beem.nodelist import NodeList
nodelist = NodeList()
nodelist.update_nodes()
stm = Hive(node=nodelist.get_hive_nodes())
account = Account("keyshall", blockchain_instance=stm)
print(account)
print(account.balances)

This produced the following output:


<Account keyshall>
{'available': [0.010 HIVE, 0.029 HBD, 93927.421216 VESTS], 'savings': [0.000 HIVE, 0.000 HBD], 'rewards': [0.000 HIVE, 0.000 HBD, 0.000000 VESTS], 'total': [0.010 HIVE, 0.029 HBD, 93927.421216 VESTS]}

The HIVE and HBD balances are correct for my account so I'll take that as a successful test. I'll work out how to see how many VESTS I have and how to convert that to Hive Power later.

I have a feeling that today was the easy part of this adventure, but I'll try to keep you up to date with how things progress.

H2
H3
H4
3 columns
2 columns
1 column
5 Comments