Steem Vs PHP - Episode 1

Investigating the blockchain via PHP and making steps towards building some Steem Tools for my fellow Steemians!!!


StormriderBOT in the works???

So you're a coder?

Yup. I've been programming now for 27 years. In PHP for 20 years. Professionally for 17 years. Self-employed for 12 years.

So you can write a bot right?

Well, erm... maybe. Knowing how to program is one thing, knowing how to program a specific application is a little more complex. You have to use someone else's framework and, let's not beat around the bush, the steem API isn't exactly well documented.

So why PHP and not JQuery - there's a spiffy JQuery library you know?

Yep, and I originally wrote it all in JQuery but that has to be run in a browser. Great for making tools, useless for making a bot unless you're willing to leave your browser window open 24/7 and know it won't crash ever.

So how far are you?

So right now I can connect to an open free node, https://steemd.steemit.com, and I can fetch node version information, account information, posts, comments etc. I can basically do all of the information READING (other than the market information - that will come later).

I'm using CURL to connect, format a POST query and handle the returned information. Some of those information blocks are formatted differently and I'm not 100% on the rhyme or reason behind it but some trial and error got me there.

Right now I have lots of blocks of code that I'm reformatting into 1 single toolkit. I'm fetching information on my 2 accounts and my wife's account, reading the voting power and I'm about to look at fetching the most recent posts and comments. Combining that I can then say whether any of the accounts are full on voting power (and should spend some to avoid wasting it) or are too low and should conserve it.

So you're just circle-jerking? You asshat!

No, not quite. I'm using this as a test case. Bear in mind that my second account has 1 single post to its name and has naff all Steem Power. Add to that, I always upvote my wife and she always upvotes me anyway... we kinda love each other, y'know? (barf!)

So what's next?

Well right now the system reads but it doesn't write. It can't post, comment or vote. I'm reliably informed that posting through PHP without going via piston or some other external library is a major ball ache. It must be possible, or so my mind tells me, but as for actually how... I'm not 100%. If it can be done via JQuery though then surely PHP can do the same.

So where is all this going?

I'd like to create a system similar to steemvoter for the MSP. Steemvoter is limited in that it steals/charges a vote every day from everyone signed up to it AND limits how many accounts you can follow unless you pay a subscription.

Also, I'd be interested in creating an upvote bot of my own, not be cause steem needs another bot but just because it sounds like an interesting project.


To end...

Anyway, stay tuned, this won't be the last post on this, in fact I'm pretty sure the next one will be very soon regarding the issues of fetching voting power (nothing is ever simple!). So who wants to see some code examples in the next post? Let me know!!!


Image Sources:

PHP logo
@stormriderstudio
Supporter of: MSP, TeamGB, MuxxyBot and many more
I need a proper signature!
If you want to help please comment below!
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now