Beem n more
ODS dot PY
A small Python3 to store your own data on the Steem Blockchain.
Only on Steem Baby, YEAH!
First of all, I am not a programmer, just a natural born Geek who loves innovative technology. The Python programming language is actually quite new to me. So a lot of trial n error, but I'm getting the hang of it. And as long as I am having fun I'll be experimenting. Thanks to fellow Steemian Holger80 for creating the BEEM Steem Python module, The Marky Mark for the Airdrop application and Felixxx for some handy tutorials on Python.
The ods dot py file is just a simple setup for storing JSON constructed data on the Steem Blockchain. And I have build a switch that you have to set to 'True' if you actually want to store some data. With this setup it would be possible to create your own Dapp on Steem. Not just like that, but in theory. (One would be advised to run a Steem node for that, depending on the kind of data to be stored and fetched.) This is not a tutorial on Python or how to set it up on your Operating System. (Just learn how to use Linux, you'll thank me one day.)
This software is provided to you as it is. Use at your own responsibility. License, if you must: CC-BY-SA @oaldamster. Copyrights are by @oaldamster (a a blockchain recorded trademark of @niwrah).
ods.py
# This ods dot py is a Steem Blockchain experiment.
# This software is provided to you as it is.
# Use at your own responsibility.
# Code is Open & Free, like Speech & Thoughts.
# License CC-BY_SA, if you must.
# Copyrights belong to one(s) who are the first to write.
# Original by Oaldamster (a blockchain recorded trademark of Niwrah.)
# Set do_store to False while doing trial n error
do_store = False
# For future use
import json
# Thanks to Steemian holger80
from beem import Steem
# Test ODS setting, use the Beem key wallet!
# The Steem Account publishing
ods_account="youraccount"
# Beem Key Wallet open thee
pw = "beemopenthee"
# Incase of API trouble:
# Steem(node=["https://api.steemit.com"])
stm = Steem()
stm.wallet.unlock(pw)
# Some smart Data to store
# Could be done with an external config file
config = {
'task': 'remark',
'header' : 'Storing data on the Steem 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 Steem 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-202001221442'
ods_JSON['tx'] = 'ods-20200020814421123-00000009'
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:
stm.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()
And there it is!
Screenshot taken at https://steemd.com/@oaldamster
According to the Bible, In Matthew 17: 1-5, was Matthew in the mountain with Jesus?
(Sorry for sending this comment. We are not looking for our self profit, our intentions is to preach the words of God in any means possible.)
Comment what you understand of our Youtube Video to receive our full votes. We have 30,000 #SteemPower. It's our little way to Thank you, our beloved friend.
Check our Discord Chat
Join our Official Community: https://beta.steemit.com/trending/hive-182074