Easy as Py
Updated the previous STM version to be used with the Hive blockchain.
ods.py
# This ods dot py is a Hive Blockchain experiment.
# Use at your own responsibility.
# This software is provided to you as it is.
# Code is Open & Free, like Speech & Thoughts.
# License CC-BY_SA, if you must.
# Copyrights belong to one(s) who are the first to publish.
# Original by Oaldamster (a blockchain recorded trademark of Niwrah.)
# Set do_store to False while doing trial n error
do_store = True
# For future use
import json
# Thanks to fellow Hiver holger80
from beem import Hive
# Test ODS setting, use the Beem key wallet!
# The Hive Account publishing
ods_account="oaldamster"
# Beem Key Wallet open thee
pw = "password"
# In case of API trouble:
# Hive(node=["https://api.hive.blog"])
haif = Hive()
haif.wallet.unlock(pw)
# Some smart Data to store
# Could be done with an external config file
config = {
'task': 'remark',
'header' : 'Storing data on the Hive blockchain',
'text' : 'This has been stored, as a remark,\n using a simple Python3 program\n and the BEEM module.'
}
# Now it works like this too
config['footer'] = "Only on Hive Baby, YEAH!\n"
config['footer'] += "Created by @" + ods_account
# The config data can be converted to JSON, but in this case it is not needed.
# Let's build some JSON data
def build_JSON():
ods_JSON = {}
ods_JSON['genesis'] = 'ods-202005160721'
ods_JSON['tx'] = 'ods-202005160721-00000002'
ods_JSON['smartAction'] = config['task']
ods_JSON['smartData'] = {}
ods_JSON['smartData']['title'] = config['header']
ods_JSON['smartData']['paragraph'] = config['text']
ods_JSON['smartData']['subscript'] = config['footer']
# And return the object
return ods_JSON
def main():
# Let's prepare the data to store
ods_JSON = build_JSON()
# Only store once
if do_store:
haif.custom_json('ods-subrosa1', ods_JSON ,required_auths=[ods_account])
print(f"Stored data: {ods_JSON}")
else:
print(f"Testrun data: {ods_JSON}")
if __name__ == '__main__':
main()
Have a great one!
And it got stored!

Screenshot taken at HiveBlocks dot Com.
Beem 0.23.7 Documentation: https://beem.readthedocs.io/en/0.23.7/index.html