edicted Blog Banner

edicted

Steem Tutorials Are Severely Lacking (Where is Hello World?)

bang head programming.gif

It is such a daunting task to learn a new programming language and try to figure out wtf is going on. Relative to Steem API programming, this frustration is magnified ten fold. Why? This technology is so new. Nothing is streamlined. Tutorials don't even exist for the task I'm trying to accomplish.

hello world.jpg

Uh... Hello World?

Seriously though, where is the "Hello World!" tutorial? It doesn't even exist. If you go to Steem API tutorials the first thing listed talks about Node.JS and how to import a blog feed. Yeah, this isn't what I want.

"Hello World" is how every tutorial starts. Learning to program requires baby steps. The opening baby step for any language or API is to print hello world to the screen. In the context of Steem API it would be creating a post that says "Hello World". Well? Where is it? Woof.

I've found several old tutorials on Steemit that try to get you started, but they all use the Steem-JS library. This library isn't even being used anymore. You're supposed to use DSteem.

The more I learn about Node.JS the more I realize this isn't what I'm looking for. I'm not looking to attach a centralized server to the Steem blockchain. I'm looking to use the Steem blockchain as the server itself in a decentralized manner. Apparently, this concept is so foreign that finding instructions on how to do it is nearly impossible.

This issue that I'm having really makes no sense to me. At first I was thinking that Node.JS was required in order to talk to the blockchain. However, when I visited https://jnordberg.github.io/dsteem/ I came across this code:


I was very surprised that this code actually works. All you have to do is copy and paste it into an HTML file. It grabs the top trending post in the "writing" category and displays it. You can toy with the code by changing the "tag" string and the 'trending' string (to 'new' or 'hot'... jk 'new' doesn't work it's actually called 'created'). When you do this the code will display the first post it finds in that category correctly. It's nice that at least something works.

javascript steem api return.png

So it's obvious that you can indeed access the dsteem library directly with JavaScript without the need for node.js. Again, I'm not looking to host a server. I just want simple access to the blockchain:

  1. Posting
  2. Upvoting
  3. Retrieving posts
  4. Deleting posts

This is really the only functionality I'm going to need 99% of the time, but there doesn't seem to be any kind of guidance to accomplish this directly with JavaScript. I'm thoroughly annoyed.

There's no shame at starting at square one... so I guess I'll be the one to create this tutorial unless someone comes along and rescues me.

@fulltimegeek? @aggroed? @krnel? @timcliff? Save me from my own ignorance please 👍

8 hours later

I wrote this last night and I'm still at it. All I'm trying to do is upvote a comment.

Here's the code I have to work with from the dsteem github:

var dsteem = require('dsteem')

var client = new dsteem.Client('https://api.steemit.com') var key = dsteem.PrivateKey.fromLogin('username', 'password', 'posting')

client.broadcast.vote({ voter: 'username', author: 'almost-digital', permlink: 'dsteem-is-the-best', weight: 10000 }, key).then(function(result){ console.log('Included in block: ' + result.block_num) }, function(error) { console.error(error) })

Except you can't "require('dsteem')" because that is a Node.JS thing. So I tried removing it and adding

This gives me the error that my permissions aren't working (signing with the private key)

https://stackoverflow.com/questions/23603514/javascript-require-function-giving-referenceerror-require-is-not-defined

Now I'm trying to use RequireJS so that the "require('dsteem')" line won't throw an error, but that just throws another error:

https://stackoverflow.com/questions/17446844/dynamic-require-in-requirejs-getting-module-name-has-not-been-loaded-yet-for-c

Seriously, all I'm trying to do is upvote a permlink with JavaScript and there are no instructions on how to accomplish the basics. WTF Steemit Inc? I'm not mad at all. Programming is always like this, but if we want to onboard as many programmers as possible it's stupid stuff like this that is going to turn developers away. Not me though, this place is a flippin' gold mine.


Return from Steem Tutorials Are Severely Lacking (Where is Hello World?) to edicted's Web3 Blog

Steem Tutorials Are Severely Lacking (Where is Hello World?) was published on and last updated on 29 Aug 2018.