Introducting Steemsnippets

in programming •  last year  (edited)

A few days ago I wrote about the problems of the steem development ecosystem and notably the lack of examples/documentation on how to do things in this article.

It thought about how I could solve these problems and after a few days, and talking with @scipio about it, I created steemsnippets.



Steemsnippets is a github repository with small snippets of code(aka very small functions for some specific use cases) To interact with steem.

To give you an idea for now the repository contains those snippets :

All of them using steemjs but I plan to expand it to other languages very soon.

Disclamer : I use pieces of code that worked for me but there may be ways to improve them, if you do find some ways to do that, don't hesitate to submit a pull request :)

What's the point ?

The core idea behind this is to ease the pain and googling of the future programmers. On steemsnippets they can find ready to use functions that they can add in their workflow. Which means less time searching and more time creating awesome applications around steem.

How to contribute

I obviously accept external pull requests. Look up github's documentation on How to create a pull request on how to do so. But make sure you follow these rules :

  • The function must be small and must only do one action (post an article, broadcast a vote etc).
  • The function must be fully commented jsdoc/python docstring style
  • The files must follow the directory structure :
    • /library/nameofthesnippet/nameofhtesnippet.js/.py
  • The file must include an installation file with all the dependencies. Aka a requirements.txt for python or a package.json for nodejs. This must be placed next to the source code file.

Don't forget that your contributions can be submitted to for a reward so don't forget to look there as well :)

Example : Test if a login/password is correct

This snippet can be found here

 * Tests if an username/password pair is correct
 * @param {String} username - username of the account
 * @param {String} password - password of the account
 * @return {boolean} valid - True of the password is correct, false if not (or if the account doesn't exists)
function login_using_password(username, password) {
    // Get the private posting key
    var wif = steem.auth.toWif(username, password, 'posting');

    steem.api.getAccounts([username], function (err, result) {
        // check if the account exists
        if (result.length !== 0) {
            // get the public posting key
            var pubWif = result[0].posting.key_auths[0][0];
            var valid = false;
            try {
                // Check if the private key matches the public one.
                valid = steem.auth.wifIsValid(wif, pubWif)
            } catch (e) {
            return valid;
        return false;
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:  

Nice initiative (love how the steem-js example has a dependency on dsteem :D)

Btw check out if you ever add dsteem snippets.


Well I added the dsteem dependency to future proof it with the creation fee. I hesitated adding it for a good time and just add "6 STEEM" but I thought having it future proof is more important than just another dependency ^^


Also, thanks for the link, I will definitely add some dsteem snippets later, right now I try to focus one lib/language at at time. I also have a LOT of interest for the playground app I think it's awesome. I just did not get the time to look into it yet.

  ·  last year (edited)


Yo! thanks for this. I'm new to Steemit and a JS developer. Have been thinking about idea for dev ontop of the steem network and know something like this will help myself and others quickly ramp into projects.

Perhaps we could make a boilerplate, with your basic steemjs functions so it's even quicker to get started.

Still just getting started here, are there any recommended steem development resources I should look at? Thanks


That is definitely the idea. That's why I try to add as many snippets as possible.

For the development ressources there aren't many, depends on what you wan to do.
Most of the time the README and googling the exact function name can lead up to some old articles which can give you an idea of what you're supposed to do.

There's also but it's kinda empty.

Very nice. I’ll Watch this repo and give some of these a try. Thanks for sharing 👍🏽


Thanks, feel free to contact me on if you need help with any of those :)

nice starting point! already forked the repo :-)


Thanks :D feel free to contribute if you make a new snippet

  ·  last year (edited)

I will! currently busy with setting up the local testnet. plan is to publish blog entries and a starter-project that cover these topics :-)

  ·  last year (edited)

I thought it was a code snippet share website uses Steem as backend just by reading the title. :)


This would is an interesting use case as well !

Nice project!

BTW how do you think, would it be cool to build a stakeoverflow-like service on top of steem? Steem reward for contribution model is native there.


It's actually an idea that has been going around for quite some time. Last time I checked was trying to do a mix of quora and stackoverflow. But as far as I know that's about it.

I'd love to see it implemented though :D



I really appreciate this information, thanks @originalworks


The @OriginalWorks bot has determined this post by @howo to be original material and upvoted it!

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!

Really nice post. Snippets...great notion.

Woah nice article