noisy cross-posted this post in Hive Projects 5 years ago


update for beem: include support for HIVE

in HiveDevs5 years ago (edited)

Repository

https://github.com/holgern/beem


beem-logo

beem is a python library for STEEM and HIVE. The current version is 0.22.5.

There is also a discord channel for beem: https://discord.gg/4HM592V

The newest beem version can be installed by:

pip install -U beem

Changelog

  • Add HIVE chain
  • improve hive chain detection
  • add hive option to nodes in Nodelist
  • new is_hive property of steem object
  • Add two new hive api nodes
  • Fix bug in ecdsa
  • Add workaround to allow transfers of HIVE/HBD in HIVE (operation need to use STEEM/SBD internally)

Using beem with HIVE

There are three ways to use beem with HIVE:

Set a hive node:

from beem import Steem
hive = Steem("https://api.hive.blog")
print(hive.is_hive)

True
If a hive node is currently set, can be checked with the is_hive property.

Set hive nodes with beempy

This beempy commend fetches all currently working HIVE nodes from the @fullnodeupdate metadata (nodes are checked every hour) and stores them in the beem config database.

beempy updatenodes --hive

In a python script, beem is using now only hive nodes.

from beem import Steem
from beem.account import Account
hive = Steem()
print(hive.is_hive)
print(hive.rpc.nodes)
acc = Account("holger80")
print(acc.steem.is_hive)
True
['https://api.hive.blog', 'http://anyx.io', 'https://api.hivekings.com', 'https://anyx.io']
True

Set hive nodes with nodelist

A list of hive nodes can also be obtained by the NodeList class:

from beem import Steem
from beem.nodelist import NodeList
nodelist = NodeList()
nodelist.update_nodes()
nodes = nodelist.get_nodes(hive=True)
hive = Steem(node=nodes)
print(hive.is_hive)

Let me know if you found bugs by using beem with HIVE.