update for beem - account snapshot added and fix for 0.19.5

in #utopian-io7 years ago (edited)

Repository

https://github.com/holgern/beem


beem-logo.png

beem is a python library for steem. beem has now 527 unit tests and a coverage of 74 %. The current version is 0.19.47.
I created a discord channel for answering a question or discussing beem: https://discord.gg/4HM592V


Bug Fixes

In order to fix the frozen steem blockchain, steem was updated to 0.19.5 and 0.19.10. Due to this changes, beem stopped working.

Commits 4523f59, a37f108,
2795f9d, d1b15a9, and
bedd1b1 where able to fix all problems.

Problem was the appbase ready node detection which depends on the RPC-node version. Before the update, all nodes with a version below 0.19.4 were not appbase ready and 0.19.4 was appbase ready.
After the blockchain fix, 0.19.5 was not appbase ready and 0.19.10 was appbase ready. This inconsitent versioning was addressed by implementing a version comparison function and by adding three different chains to chains.py (with min_version 0.0.0, 0.19.5 and 0.19.10).

New Features

ObjectCache is now threadsafe

In commits d56e822, 94a7c13, dd9b5b4, 6925794, and b1c3205, a robust solution was found to make all BlockchainObjects thread safe. In each cache function a with self.lock: where self.lock = threading.RLock() was added. This prevents that one thread add something to the cache while an other thread is reading at the same time.

AccountSnapshot class added

In commits bedd1b1, 29d685a, and c54180e a new class was implemented which can be used to access historic account states.

The plot shows the effective SP and own SP of an account over time. The SP is only calculated based on account operation. In the end the difference is only 8958.65 SP - 8961.9 SP = 3.25 SP.
sp_over_time-holger80.png

from beem.snapshot import AccountSnapshot
acc_snapshot = AccountSnapshot("holger80")
acc_snapshot.get_account_history()
acc_snapshot.build()
acc_snapshot.build_sp_arrays()

get_account_history() fetches the complete account op history. build() goes then through every operation and adds or removes vests to internal state. Delegations are also tracked in a separate state variable. build_sp_arrays() creates then an array for plotting the effective and owning Steem power.

curation_per_week-holger80.png

AccountSnapshot can also be used to plot the curation rewards.

acc_snapshot = AccountSnapshot(account)
acc_snapshot.get_account_history()
acc_snapshot.build(enable_rewards=True)
acc_snapshot.build_curation_arrays()

enable_rewards is now set True in the build() function. This creates an second internal state which trackes all curation_reward operations. build_curation_arrays() builds an array which contain the curation_reward per week and 1000 effective Steem Power.

At the moment, AccountSnapshot is not well documented, but two examples were added the repository:

  • account_curation_per_week_and_1k_sp.py
  • account_sp_over_time.py

AccountSnapshot is based on account_sp_over_time.py by @crokkon and was enhanced by tracking of Steem and Sbd balance as well as tracking of curation rewards. Some missing operation were added and some bugs fixed.


Commit history

Prepare next release and improve parse_body for post()

Add conversion of datetime objects to timestamp in get_steem_per_mvest

Fix is_network_appbase_ready for newest steem update

Fix known chains and network versions

Fix wrong version number in known_chains

Prepare next release and add chain for testnet.steemitdev.com

Add lazy as option to all discussion classes

Fix start and stop for history_reverse

Add option use_del to ObjectCache, for making the cache thread safe

Try to fix clear_expired_items

Add bool for clear_expired_items to make it thread safe

Add RLock to Cache for make it thread safe

Remove use_del again from ObjectCache and optimize OpjectCache

Example
  • A cache performance evaluation script was added to examples
Blockchain
  • set_cache_auto_clean disabled

Add support for nodes with version below 0.19.5 and fix node version comparision

Replace recursive call by while loop

  • commit 3c78ac8
  • Update nodes in Nodelist
  • Disable seed.bitcoiner.me node

Release of 0.19.46

Snapshot added
  • This class can be used to access old account states. At the moment, only changes in vests are tracked over time.
  • example added for plotting SP over time
Steem
  • last_node added and refresh of json_config data is forced on node switch

snapshot improved and unit tests fixed

Snapshot
  • improved STEEM and SBD history added
  • Documentation added
  • get_data, reset, build functions added

Fix unit test and improve documentation

Snapshot improved

  • commit c54180e
  • get_data is now fast
  • update_rewards added
  • enable_rewards added to build
  • build_curation_arrays added

Add blocknumber check to wait_for_and_get_block


If you like what I'm doing, please consider @holger80 as one of your witnesses (steemconnect).

Sort:  

Thank you for you contribution. I can see that you have put a great effort in this library. Keep up good work.

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.
[utopian-moderator]

You are doing some serious business ;-)

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.

Very interesting library. I played with Steem API via pysteem, but will check your library too.

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

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

Vote for Utopian Witness!