https://github.com/holgern/beem
beem is a python library and command line tool for HIVE. The current version is 0.24.18.
There is also a discord channel for beem: https://discord.gg/4HM592V
The newest beem version can be installed by:
pip install -U beem
Check that you are using hive nodes. The following command
beempy updatenodes --hive
updates the nodelist and uses only hive nodes. After setting hive as default_chain, beempy updatenodes can be used.
The list of nodes can be checked with
beempy config
and
beempy currentnode
shows the currently connected node.
In version 0.24.16, a rounding bug was fixed which prevents sending 8.19 HIVE. This bug leads to a wrong signature, which then prevents broadcasting the transfer op. This is now fixed.
The account history and history_reverse functions have now a better error handling.
The returned index is now checked, which prevents that account history elements were added twice to the output.
Currently the new filter parameter are only implemented at "https://api.hive.blog" API node.
On this node, the get_account_history call has two more parameters: operation_filter_low and operation_filter_high.
These parameters are a bitmask of all possible operation names.
They can be obtained with the _get_operation_filter function:
operation_filter_low, operation_filter_high = account._get_operation_filter(only_ops=["transfer", "vote"])
which results in operation_filter_low=5 and operation_filter_high=0.
The history and history_reverse function from beem will now use the operation_filter when
"https://api.hive.blog" is set as node. This speeds up receiving account history data up to 100 %.
from beem.account import Account
from beem import Hive
import time
hive = Hive("https://api.hive.blog")
acc = Account("holger80", blockchain_instance=hive)
start_time = time.time()
n_op = acc.virtual_op_count()
transfer_ops = list(acc.history_reverse(only_ops=["transfer"]))
print("Time needed to search all transfers in %d history elements: %.2f s" % (n_op, (time.time() - start_time)))
print("%d transfer op have been found" % (len(transfer_ops)))
returns
Time needed to search all transfers in 283514 history elements: 145.66 s
4666 transfer op have been found
from beem.account import Account
from beem import Hive
import time
hive = Hive("https://api.hive.blog")
acc = Account("holger80", blockchain_instance=hive)
start_time = time.time()
n_op = acc.virtual_op_count()
transfer_ops = list(acc.history(only_ops=["transfer"]))
print("Time needed to search all transfers in %d history elements: %.2f s" % (n_op, (time.time() - start_time)))
print("%d transfer op have been found" % (len(transfer_ops)))
returns
Time needed to search all transfers in 283517 history elements: 144.55 s
4666 transfer op have been found
Now we do the same without filtering:
from beem.account import Account
from beem import Hive
import time
hive = Hive("https://api.hive.blog")
acc = Account("holger80", blockchain_instance=hive)
start_time = time.time()
n_op = acc.virtual_op_count()
transfer_ops = []
for op in acc.history():
if op["type"] == "transfer":
transfer_ops.append(op)
print("Time needed to search all transfers in %d history elements: %.2f s" % (n_op, (time.time() - start_time)))
print("%d transfer op have been found" % (len(transfer_ops)))
returns
Time needed to search all transfers in 283518 history elements: 261.63 s
4666 transfer op have been found
If you like what I do, consider casting a vote for me as witness on Hivesigner or on PeakD