update for beem - get_account_votes improved and signing speed improvedsteemCreated with Sketch.

in utopian-io •  3 months ago




beem is a python library for steem. beem has now 494 unit tests and a coverage of 70 %. The current version is 0.20.17.
I created a discord channel for answering a question or discussing beem: https://discord.gg/4HM592V
The newest beem version can be installed by:

pip install -U beem

or when using conda:

conda install beem

beem can be updated by:

conda update beem

New Features

Signing can be speed up by installing secp256k1prp

The python package secp256k1prp is now supported to speed up signing all broadcasted transaction.

Before, secp256k1 was supported which is not maintained and I'm not able to install it anymore.

The following benchmark works only when secp256k1prp and cryptography is installed. The library which should be used for sign/verify can be specified with ecda.SECP256K1_MODULE.

from beemgraphenebase.account import PrivateKey, PublicKey
import beemgraphenebase.ecdsasig as ecda
from beemgraphenebase.py23 import py23_bytes
import time
ecda.SECP256K1_MODULE = "ecdsa"
wif = "5J4KCbg1G3my9b9hCaQXnHSm6vrwW9xQTJS6ZciW2Kek7cCkCEk"
for lib in ["cryptography", "secp256k1", "ecdsa"]:
    ecda.SECP256K1_MODULE = lib
    start_time = time.time()
    for i in range(30):
        pub_key = py23_bytes(repr(PrivateKey(wif).pubkey), "latin")
        signature = ecda.sign_message("Foobar", wif)
        pub_key_sig = ecda.verify_message("Foobar", signature)

    print("%s: sign and verify took %.2f seconds." % (lib, (time.time() - start_time)/30))

libraryduration [s]

The benchmark shows that secp256k1prp is slightly faster than cryptography for sign/verify a transaction.

Bug fixes

get_account_votes works again with api.steemit.com

get_account_votes stoped working for api.steemit.com (post). The get_account_votes uses now list_votes with "order": "by_voter_comment" when get_account_votes returns a dict with a error field.

from beem.account import Account
from beem import Steem
stm = Steem("https://steemd.minnowsupportproject.org")
account = Account("holger80", steem_instance=stm)
votes = account.get_account_votes()


{'authorperm': 'steemcleaners/steemcleaners-report-for-december-29-2018', 'weight': 13434, 'rshares': '56347337681', 'percent': 1000, 'time': '2019-01-12T07:44:30'}

Due to the changes, the function works again for api.steemit.com:

from beem.account import Account
from beem import Steem
stm = Steem("https://api.steemit.com")
account = Account("holger80", steem_instance=stm)
votes = account.get_account_votes()


{'id': 361753207, 'voter': 'holger80', 'author': 'steemcleaners', 'permlink': 'steemcleaners-report-for-december-29-2018', 'weight': 13434, 'rshares': '56347337681', 'vote_percent': 1000, 'last_update': '2019-01-12T07:44:30', 'num_changes': 0}

The returned dict of a vote is slightly different.

  • percent -> vote_percent
  • time -> last_update

Fix rounding error in transfer broadcasting

The Amount class in beembase is used to calculate the signature of a transfer transaction. Inside this function, a rounding error occured, which prevents sending of 1.013 STEEM.
It was caused by:

(float(1.013) * 10 ** 3)

which is


and was round with the int() function to


This had prevented broadcasting.
A round function is now used:

round(float(1.013) * 10 ** 3) = 1013

which returns 1013.
Function test:

Unit tests fixed

Due to the some changes and the not working testnet, some unit tests were broken. They are all fixed now.


Replace secp256k1 by secp256k1prp which is better maintained and available on more platforms

Get_account_votes enhanced for api.steemit.com node

Fix unit tests

Add coverage calculation and fix not working unit tests

Fix more unit tests

add sonar analysis

Repair unit tests for beempy

Fix wrong rounding of 1.013 STEEM to 1.012 STEEM which prevents transfer of certain STEEM amounts.

Github account


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:  
  • Great article and formatting with images and code samples.
  • I really liked your bug fix explanations.

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 https://support.utopian.io/.
Chat with us on Discord.


Thank you for your review, @helo! Keep up the good work!

ǝɹǝɥ sɐʍ ɹoʇɐɹnƆ pɐW ǝɥ┴

Hey, @holger80!

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

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

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @holger80! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 600 comments. Your next target is to reach 700 comments.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemWhales has officially moved to SteemitBoard Ranking
SteemitBoard - Witness Update

Support SteemitBoard's project! Vote for its witness and get one more award!

is there a command to check the installed version (wich version is installed) for noobs like me?

Thank you so much for participating the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

This post has been just added as new item to timeline of beem on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.

Hi @holger80!

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

Hi, @holger80!

You just got a 2.7% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

This post has been included in the latest edition of SOS Daily News - a digest of all you need to know about the State of Steem.

Congratulations @holger80!
Your post was mentioned in the Steem Hit Parade in the following category:

  • Pending payout - Ranked 8 with $ 78,18