Lightsteem 0.0.7 - Account helper is arrived.

in lightsteem •  4 months ago

It's been a while since the last update on Lightsteem. It's my primary way to interact with the STEEM blockchain.

Adding helper classes and functions for well-known blockchain objects was in the plans in the initial design of Lightsteem. Later on, I have decided to put this on hold to see how it goes to develop with Lightsteem.

While I was enjoying Lightsteem in the last couple of weeks (as a library user), I had to implement similar stuff (recursive account history, recursive follow/follower list) and repeating myself in different projects, and scripts.

Therefore, the new plan is going back to the old plan and implementing helpers module. The first iteration includes Account and Amount helpers.

Installation / Upgrading

$ (sudo) pip install lightsteem --upgrade

Account helper

This class defines an Account in the STEEM blockchain.

from lightsteem.client import Client
c = Client()
account = c.get_account('emrebeyler')
Account History

Screen Shot 2018-09-04 at 5.20.07 PM.png

account_history is an important call for the STEEM applications. A few use cases:

  • Getting incoming delegations
  • Filtering transfers on specific accounts
  • Getting author, curation rewards


Example: Get all incoming STEEM of binance account in the last 7 days

import datetime

from lightsteem.client import Client
from lightsteem.helpers.amount import Amount

client = Client()
account = client.account('deepcrypto8')

one_week_ago = datetime.datetime.utcnow() -
total_steem = 0
for op in account.history(

    if op["to"] != "deepcrypto8":

    total_steem += Amount(op["amount"]).amount

print("Total STEEM deposited to Binance", total_steem)
Relationships (Follow, Mute)
Getting followers:

from lightsteem.client import Client

client = Client()
account = client.account('deepcrypto8')

Getting following

from lightsteem.client import Client

client = Client()
account = client.account('emrebeyler')
Getting muters

from lightsteem.client import Client

client = Client()
account = client.account('emrebeyler')

Getting muted list

from lightsteem.client import Client

client = Client()
account = client.account('emrebeyler')

Voting Power

This helper method determines the account's voting power. In default, It considers
account's regenerated VP. (Actual VP)

If you want the VP at the time the last vote casted, you can pass consider_regeneration=False.

from lightsteem.client import Client

client = Client()
account = client.account('emrebeyler')

Normalized Account Reputation

from lightsteem.client import Client

client = Client()
account = client.account('emrebeyler')


Default precision is 2. You can set it by passing precision=N parameter.

Amount helper

A simple class to convert "1234.1234 STEEM" kind of values to Decimal.

from lightsteem.helpers.amount import Amount

amount = Amount("42.5466 STEEM")


Moar Helpers in the roadmap

  • Witness class
  • BlockStream class
  • Post class
  • Vote class
  • Converter class (vests to sp, etc.)

Bonus: Benchmark time

While implementing account.followers(), I have realized that steem-python and beem would be less efficient compared to lightsteem in accounts has a following more than 100.

Let's get the well known witness @blocktrades' followers with this three libraries:

  • Lightsteem
import logging

from lightsteem.client import Client

c = Client(loglevel=logging.DEBUG, nodes=[""])
account = c.account('blocktrades')


  • Beem

from beem import Steem
from beem.account import Account

import logging

steemd = Steem(node=[""])
acc = Account('blocktrades', steem_instance=steemd)

  • Steem-Python
from steem import Steem
from steem.account import Account

import logging

steemd = Steem(nodes=[""])

acc = Account('blocktrades', steemd_instance=steemd)


LibraryTotal Time SpentTotal Requests

In a small implementation detail, while steem-python and beem call the related RPC method with limit=100, lightsteem uses 1000 as default.


  • You can stop by Lightsteem discord and join the development with your feedback and ideas.

  • You can pick an open issue and start working on it. But we should reach a consensus about the design decisions before any merge.

  • Make sure you update the documentation and unit tests for each change you do on the codebase.

Related pull request

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:  

Thank you for your contribution.

  1. It is interesting to see the benchmarking for performance. But I wonder how many test-runs have you carried out.
  2. I notice some code are quite the same for example here seems taken from here, it would be better to give a reference somewhere in your project.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.

Need help? Write a ticket on
Chat with us on Discord.


I notice some code are quite the same for example here seems taken from here, it would be better to give a reference somewhere in your project.

Yep, base58 module stands for transaction signing stuff which is mostly derived from steem-python. It's already written in the earlier announcement posts and related pull requests.

For example, beem has a similar and bitshares-python has the same, and goes on. Also steem-python's base58 module is based on cryptocoins project, etc.

However, also adding somewhere in the project would make sense since this is not the first time I hear that.



Thank you for your review, @justyy!

So far this week you've reviewed 1 contributions. Keep up the good work!

First of all receive a cordial greeting, sorry if my question doesn't come up but I need help from someone with knowledge. I recently decided to create delegation accounts for my blood brothers. I didn't have much experience with that so when I created the first account I didn't copy the password. I took the delegation off the account but it's been more than 16 days and the delegation is not coming back to me. How can I get my SPs back? I would really appreciate any help that you or anyone else can please give me in this regard as I have not found this information anywhere.


It will take 1 month to take it back after you revoke your account creation delegation.


Thank you for your reply. Last night I asked the question to several witnesses and all have answered me and of course the answer coincides and is a relief to me. I'm proud of our witnesses!

Thank you for your continued contributions. Great stuff as always 😄

@DUnite supports this author!


Thank you.

Hi @emrebeyler!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @emrebeyler!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support!
Simply set as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord

Vote for Utopian Witness!

awesome as always. I should really give another chance to steem + python