create account

Brief introduction to how to get started writing apps that work with the Steem blockchain by l0k1

View this thread on: hive.blogpeakd.comecency.com
· @l0k1 ·
$6.95
Brief introduction to how to get started writing apps that work with the Steem blockchain
Please note that this is not a simple howto, but a summary of the basic steps and the reason why I am personally doing this.

I got a bug up my butt and decided that there needs to be another way to access the Steem blockchain, both reading and writing it. It is motivated, as you can see by looking at my blog, by some heinous abuse of power by certain parties who I will not name. But the way I see it, it was more that the interface on the main website did not really show me what a collossal blunder I was about to make, so close to being paid out a very decent reward for a post, that was going to pay my rent for another month, and not only that after I decided I wanted to not see the character involved, I find the javascript interface does not in fact let me make these unlikeable people disappear from my screen. Not only that, the official site uses a javascript interface that runs like a snail on my machine on posts with long comment threads.

So, that's why I am doing this.

Well, I am writing an application in Python, because I know it pretty well and I have done a fair bit already towards building other apps, although I have never completed something that I can put out there. Laziness you might think, but actually, I just had so many other things to contend with. I just quit my job and I have a little breathing room, and I am confident that if I really dedicate myself to the work, within a few weeks I can have something put together that people want to see.

But I want to log my process with the people, and I want to help others do this. The promise of Steem is so much more than just what exists. The blockchain is a platform, not just an application. Even if the Steemit site goes down, if there is people mining and running the steemd, it still exists. There is really little impediment to anyone really forking the protocol either, especially outside the jurisdiction the copyright claims are made. The management should be cognizant of the fact that they have put something together that will exist whether they profit from it or not. Ethereum management did not want ETC to happen. They can't stop it. Neither will Steem be able to stop people from ultimately ditching them and starting new blockchains, forking, and I think it is intended that people be able to make their own interfaces, I am not promoting something controversial.

So. If you want to make an application to interact with the blockchain, first you need to build and run the steem daemon, called 'steemd'.  Basically you need to go https://github.com/steemit/steem and clone the thing, and you can find it. It wasn't hard to figure out how to compile and build it. I will not go into this. It requires some prerequisites, again, you will have to find out what they are. I am aiming this at people who have enough knowledge already to build any application for their platform.

I pre-downloaded a compressed version of the blockchain, which includes a base configuration, from here: http://steemitup.eu/

Then you need to modify the config.ini in the folder called witness_node_data_dir to add a list of nodes to seed your node's database of other nodes. 

here is mine, taken from somewhere or other:

> seed-node = 212.117.213.186:2016
> seed-node = 185.82.203.92:2001
> seed-node = 52.74.152.79:2001
> seed-node = 52.63.172.229:2001
> seed-node = 104.236.82.250:2001
> seed-node = 104.199.157.70:2001
> seed-node = steem.kushed.com:2001
> seed-node = steemd.pharesim.me:2001
> seed-node = seed.steemnodes.com:2001
> seed-node = steemseed.dele-puppy.com:2001
> seed-node = seed.steemwitness.com:2001
> seed-node = seed.steemed.net:2001
> seed-node = steem-seed1.abit-more.com:2001
> seed-node = steem.clawmap.com:2001
> seed-node = 52.62.24.225:2001
> seed-node = steem-id.altexplorer.xyz:2001
> seed-node = 213.167.243.223:2001
> seed-node = 162.213.199.171:34191
> seed-node = 45.55.217.111:12150
> seed-node = 212.47.249.84:40696
> seed-node = 52.4.250.181:39705
> seed-node = 81.89.101.133:2001
> seed-node = 46.252.27.1:1337

You can double check on that if you want, but obviously if they aren't running they won't work, and if they are, they have to obey the protocol, and if they don't, then they won't work. 

Since to run an interface and mirror the blockchain, you don't need to be a miner or a witness, this is all you need to do to get started. As it was not hard for me to get started, I won't repeat the instructions I found, just search for them, if you are competent enough to write programs and scripts, you will be able to do this yourself. Steemd will give you nasty red log lines complaining about having no miner or witnesses set up, but this is irrelevant if you are neither running a witness nor mining.

Once you have the steemd up and running, you can write an app that talks to the RPC interface on it, I added this near the top of the config to set this up:

> # Endpoint for P2P node to listen on
> p2p-endpoint = 127.0.0.1:8092

Then you unpack your pre-compressed blockchain in the appropriate place, put the steemd in /usr/local/bin or so, start it up, and it will search in the current folder, so you can start the steemd there, I used ~/.steemd, and with the blocks already downloaded and the configuration, and by default it will not mine, simply replicate the blockchain, and allow you to query the blockchain and send commands such as posting, voting and so forth, through the interface.

Then you need to do your development work, learn how to send RPC queries to the running node, and your interface will be able to grab the data, send commands, and whatever else you intend to let the interface do. This includes analytics as well, of course. What you want to do, is up to you. You can write bots, you can write python, gtk, win32, carbon, or whatever interfaces you want to use. If you are working with windows it is easiest to run the steemd in a virtual machine and the interface can be reached through an appropriate VM configuration, presumably another IP address on your LAN, but on macos and linux it can be localhost.

The steemd uses a standard network based RPC interface, and these can be found on almost any language platform of current versions. There is a python piston interface that already has some of this done, but I have looked at the way it works and I don't like the coding style. But I can dig out the essential information in the code for how to make the RPC calls and the rest I know how to do from my existing experience coding python/gtk3 programs.

The more people who do this the better. The web interface is far from effective, and for beginners, like me, can leave you in a situation where you kick yourself for being so stupid. A good interface would make this harder to do. I may even leave out flagging in my interface, and just let you make users you don't like disappear, and their posts, and the responses with them. I will make interfaces to lower level stuff that show when you get voted on or flagged by these people, but the best way to deal with them is to just not even know they exist. They are harming the system and do not deserve any attention whatsoever. This is my personal goal for building an interface, as well as making it a lot faster.
👍  , , , , , , , , , , , , , , , ,
properties (23)
authorl0k1
permlinkbrief-introduction-to-how-to-get-started-writing-apps-that-work-with-the-steem-blockchain
categorysteemd
json_metadata{"tags":["steemd","development","interface"],"links":["https://github.com/steemit/steem"]}
created2016-08-18 13:24:12
last_update2016-08-18 13:24:12
depth0
children0
last_payout2016-09-19 04:39:00
cashout_time1969-12-31 23:59:59
total_payout_value5.216 HBD
curator_payout_value1.733 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7,233
author_reputation94,800,257,230,993
root_title"Brief introduction to how to get started writing apps that work with the Steem blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id870,455
net_rshares11,447,985,330,739
author_curate_reward""
vote details (17)