Project S - Day 1: STEEM blockchain programming; baby steps
How it started
So, we (@exyle,
@s3rg3,
@eqko and me), were talking STEEM at a birthday party.
@exyle and
@s3rg3 had some great idea's about a project based on the STEEM blockchain. We decided we'd go for it, but needed some smaller project to start with. Just to get a feel for how the STEEM blockchain actually works and how to develop software for it.
@eqko was missing a feature (not going to tell you what it is, yet), so that became Project S, an iOS app.
Project S - Day 1
Right... an iOS app. Where to begin?! Well, let's start with seeing what software libraries are available for Python. I know Python pretty well (at least I like to think I do), and use it almost daily at work. Also, it's a great language for fast prototyping, yet stable enough for production quality applications.
Luckily, there seems to be an "official" Python library for interaction with the blockchain, steem-python, a fork of (Piston library by @xeroc) - or the other way around, I'm not sure. After sifting through most of the code to see how it actually works, I wrote a few lines of code to try it out:
from datetime import datetime
from steem import Steem
s = Steem()
for post in s.stream_comments():
if "steem" in post.body.lower():
print("{} | {} - {}".format(datetime.utcnow(), post.author, post.title))
output:
Neat! Unfortunately, it crashed after a few minutes because of what I believe to be a sync issue. Worked around that and let my new code run overnight. In the morning it was still running as it should, so I think I have a good base to start from. I won't be needing all the fancy stuff from the library anyways.