Dicebot Dev Post #3: Bouncing off the brick wallsteemCreated with Sketch.

in steemit •  last year

nocturnal-code.png

When we last left off, I was about to dig in to how to actually programmatically post a reply to Steemit, and I feared it might be significantly more difficult than just reading the blockchain as I had been doing so far.

And, yeah, it is. For one, it appears that this is not possible to do with the simple HTTP-based JSON-RPC API endpoint I had been using thus far; instead, I'd have to use Websockets. Websockets were basically invented to allow web browsers to communicate with servers using protocols other than HTTP. They're another one of those things from the people who think that web browsers should not only display primarily text-based documents (which they do very well) but also be entire general-purpose application platforms (which they do very poorly). Posting to the blockchain also involves cryptography. Hey, cryptocurrencies involve cryptography? Go figure.

All right, once again, I'm overwhelmed with what I'm looking at here. Sure, the pieces are in place to implement all of this stuff myself, but I just don't understand yet how those pieces are supposed to fit together.

So, change of plan. I mentioned in my last post about the Steemit libraries and such that are already available but I'm not using because I'm using Swift. Well, is my desire to continue using Swift greater than my desire to accept the help of these libraries? Not anymore. I now intend to implement this bot using Python and the piston-lib library. Its documentation even shows how a reply bot can be written with very little code.

But now I have to learn how to write in Python again, since it's been quite a while since I last did so. And I'm not meaning just code here; I mean things like coding standards, what packages should look like, the correct layout of files in the filesystem, etc. For some reason, I'm a little obsessive about that sort of thing, even though at this stage in a project it's really more important to just get some working code up and keep my motivation going.

Anyway, that's where things are now. As before, I appreciate any feedback anyone may have, particularly those interested in using this bot and those who have developed against the Steemit blockchain before.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

I wish I could be of more help. I am starting my journey to programming in the blockchain. I am finishing my first course on python, in codecademy. I follow these posts of yours carefully, because they are a sort of peeping into the future.

So python would be preferable to other languages (like Swift, the one you mention, unknown to me) because of the existence of these libraries? What are they, anyway? Sort of premade routines, or ways to access the chainblock database?

You can access the DB just like that, or you need to connect to a certain server in a certain way?

Thanks for these describing posts. They are very useful and motivating to me.

·

What are they, anyway? Sort of premade routines, or ways to access the [blockchain] database?

Yes to both. Generically speaking, a library is a chunk of code that provides useful functionality for other programmers so that they don't have to implement that functionality themselves (and write all the code that that would require). Almost all programming languages have a "standard library" which provides basic functionality, but additional libraries can be added to a coder's project to simplify what they need to do.

As Swift is both fairly new and not widely used outside of writing graphical macOS and iOS applications (which this bot will not be), there aren't nearly as many libraries available as there are for more mature and widely-used languages. That can be okay if you can just implement the functionality that you need yourself, and I was getting away with that for a while using Swift, but then…

Keep at it man, i feel your pain around this. :)