Nozzle v0.1.2 - Update and bugfixes

in #utopian-io7 years ago (edited)

Today, I have updated our RPC-client for the Steem blockchain. This was born out of requirements for other projects of @blockbrothers (Steemify, SteemTurbine, and VoteBot), to have a more stable and low-level RPC-client for the steemd nodes of the Steem network.

Feel free to use it for your own projects.

Bug Fixes

A total of three issues were fixed, two of them were still open until today;

  • Issue #1 - Getting nodes property from RPCClient causes infinite loop.
  • Issue #2 - Unable to stream blocks.
  • Issue #3 - Possible infinite loop in call-method of RPCClient.

Issue #1 was fixed by creating a copy of the nodes list by iterating the itertools.cycle.

Issue #2 was fixed by changing the constant STEEMIT_BLOCK_INTERVAL to STEEM_BLOCK_INTERVAL, as it seems to have changed on the RPC-nodes.

Issue #3 was fixed by refactoring the while-loop in SteemdClient.stream_blocks() method.

New Features

I've added a few high-level methods to nozzle.client.SteemdClient to get accounts, get account reputation, get witness accounts by id, and get witness accounts by accountname:

from nozzle import Steem
s = Steem(nodes=['https://api.steemit.com'])
s.get_accounts(['blockbrothers', 'bennierex', 'eqko', 'exyle', 's3rg3'])
s.get_account_reputation('blockbrothers')
s.get_witnesses_by_account(['blockbrothers', 'aggroed'])
s.get_witnesses_by_id([14639, 14503])

Enhancement

SteemdClient.get_blocks() and SteemdClient.stream_blocks() now always yield a block, even if it is None. It's up to the consumer to decide what to do when that happens.

Installation / upgrade

The new version, v0.1.2, is available on pypi.

To install, simply run pip install steem-nozzle.

To upgrade, run pip install --upgrade steem-nozzle.

Planned future enhancements

  • Add more high-level functions.
  • Make nozzle compatible with Appbase.
  • Performance improvements.
  • Communities/Hivemind/SMT compatibility (when available)



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved. I can see you are using two accounts this one and @blockbrothers. And also the account is not linked properly as it is not clickable. It is advisable to write contributions from the main account.

You can contact us on Discord.
[utopian-moderator]

Hey @codingdefined, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Thanks.

Please advise on how to do that, as @blockbrothers is a Github team account, so I see no way to link it and still commit under my own account...

Then you can create a PR from your account and then when it is merged in @blockbrothers, you can post from your account.

Hey @bennierex I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x