Update for beem: improved account history handling
hive-139531·@holger80·
0.000 HBDUpdate for beem: improved account history handling
## Repository https://github.com/holgern/beem<center>  </center> [beem](https://github.com/holgern/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. ## Changelog for 0.24.18 * Adapt account history on api changes and fixes issue #267 * Speed up history call, when limit is below 1000 * Improve unit tests for account history * Fix estimate_virtual_op_num, when get_account_history returns an empty entry for an index * Implement _get_operation_filter and use filter operations in history and history_reverse on the https://api.hive.blog api node ## Changelog for 0.24.17 * Fixed a bug when using skip_account_check=True * Refactor code in Account * Add more unit tests ## Changelog for 0.24.16 * Fix bug in bytes representation of an Amount which prevents sending certain amounts (e.g. 8.19 HIVE) * Added unit tests to check if 8.190 is correctly working ## Fixing rounding errors in transfers 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. ## Improved error handling in account history 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. ## New filtered account history 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 %. ### History reverse with operation_filter ``` 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 ``` ### History with operation_filter ``` 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 ``` ### History without operation filter 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](https://hivesigner.com/sign/account-witness-vote?witness=holger80&approve=1) or on [PeakD](https://peakd.com/witnesses)*
👍 eval, reza-shamim, elleok, lizanomadsoul, manncpt, jnmarteau, opt2o, thehealthylife, payger, globalschool, onealfa, buggedout, maxuvv, dera123, saboin, swedishdragon76, glastar, techslut, amico, kriang3tee, imtase, baiboua, akioexzgamer, french-tech, yuza, paopaoza, ten-years-before, puza, crypto.story, univers.crypto, mintrawa, steementertainer, nalexadre, muscara, battlegames, ew-and-patterns, tipsybosphorus, ticketyboo, ticketywoof, borbina, mindtrap, abh12345, benedict08, dine77, giftgiver, gerber, askari, deathwing, polish.hive, dcityrewards, ezzy, exyle, emrebeyler, steembasicincome, nealmcspadden, steem.leo, mice-k, hivecur, someguy123, lordneroo, runicar, themarkymark, mermaidvampire, jimcustodio, philnewton, tobias-g, cadawg, sweetkathy, foxon, cwow2, plankton.token, mehmetfix, foxoff, upmyvote, netaterra, dune69, iansart, alphacore, jayna, shitsignals, felander, accelerator, caladan, purefood, unconditionalove, pkocjan, anikys3reasure, hasmez, bestboom, freddio, themightyvolcano, nateaguila, swisswitness, gallerani, dalz, mozo, luppers, dlike, engrave, bobby.madagascar, ldp, followjohngalt, mistia, cakemonster, determine, permaculturedude, mfblack, threejay, sm-silva, steemindian, shimozurdo, milu-the-dog, triplea.bot, zaku-pal, asteroids, project.hope, beta500, sbi-tokens, maxuvd, qwertm, ribary, troll3838, dpend.active, folklure, monster-burner, discohedge, dado13btc, shebe, pardeepkumar, buildawhale, therealwolf, ocupation, enjoyinglife, florino, tggr, therealyme, sacrosanct, dapplr, quello, recoveryinc, lelon, abitcoinskeptic, ilovecanada, co2admin, xpilar, lastminuteman, nicniezgrublem, makerhacks, ladysalsa, iseeyouvee, angatt, reflektor, flyingbolt, hungryharish, firefuture, localgrower, mismo, smartsteem, elektr1ker, movement19, libuska, shortsegments, bigpower, hingsten, vxc, gerbo, miketr, musinka, tombstone, onetin84, revisesociology, jpphotography, nerdtopiade, casberp, berthold, actifit-peter, epicdice, simplex-world, phortun, sbi2, triviummethod, carlpei, petrvl, investyourvote, velinov86, jelly13, tarazkp, onlavu, stevescoins, belahejna, usainvote, blockchainpeople, gadrian, iamjohn, babytarazkp, bilpcoin.pay, borran, sbi3, gadrian-sp, imbartley, mcoinz79, agent14, thrasher666, dying, maxer27, crokkon, peekbit, solarwarrior, votum, kran10, kibela, anech512, kran9, offgridlife, borgheseglass, arcange, sharker, bobskibob, blacklux, ronaldoavelino, camplife, helene, blackbunny, exec, laoyao, somebody, midnightoil, xiaohui, oflyhigh, djennyfloro, lingfei, realgoodcontent, sbi4, gamer00, codingdefined, khalil319, kipling, itchyfeetdonica, slobberchops, ronavel, fractalnode, sudefteri, wherein, fw206, skepticology, kimzwarch, daisyphotography, cultus-forex, chrismadcboy2016, kahvesizlik, urdreamscometrue, forecasteem, cnstm, freakeao, lemouth, shadflyfilms, jongolson, akifane, davidlionfish, tabea, bubke, condeas, marcus0alameda, besheda, likuang007, lianjingmedia, omstavan, madridbg, ericburgoyne, lesmouths-travel, broxi, dachcolony, votebetting, mytechtrail, sbi5, voxmonkey, vtol79, publicumaurora, dreimaldad, steemitcuration, szf, jerrybanfield, jacekw, bronkong, andrepol, candyboy, maxpatternman, leeyh, inteligente, sbi6, re2pair, holybread, detetive, traduzindojogos, properfraction, rufruf, fengchao, steempearls, sbi8, stuntman.mike, kingscrown, raphaelle, flugschwein, backinblackdevil, eunsik, sm-skynet, leeyh5, freebornsociety, sbi7, boatymcboatface, theshell, uwelang, justyy, dyrt88, lebin, thranax, sbi9, losi, ctl001, flemingfarm, dailychina, cst90, superlao, moneybaby, altonos, likwid, btscn, sbi10, oliverschmid, nervi, kr-coffeesteem, smon-joa, fourfourfun, promobot, geeklania, blue.rabbit, nulledgh0st, furioslosi, minigame, investegg, linuxbot, lauchmelder, andylein, fjcalduch, tryskele, voxmortis, alinalazareva, jancharlest, mittwochsquickie, ambyr00, kiemis, actifit-devil, samujaeger, ninnu, pladozero, blainjones, bashadow, curationvoter, moritzjaeger, zerofive, kosimoos, thedevilsbride, curationhelper, meins0815, sparstrumpf, meins0816, sniem5180, solomon.grundy, mein2070, crimo, fooblic, suffragator, hivelist, naltedtirt, funnyman, jsantana, holycow2019, vaansteam, onartbali, mammasitta, massivevibration, linnyplant, commonlaw, starrouge, korinkrafting, drsensor, felixgarciap, lrekt01, thelogicaldude, abbenay, bewithbreath, steempty, maxsieg, jphamer1, drew0, muelli, kraken99, techhype, bluerobo, hanke, blue-witness, jewel-lover, smonia, keepit2, tina-tina, ssc-token, tradingideas2, fingolfin, aaalviarez, hope-on-fire, blocktrades, roelandp, tomatom, frassman, jackofcrows, memepress, kgswallet, idkpdx, kennyroy, auracraft, jim888, gabrielatravels, minerspost, celinavisaez, ricardomello, mountaingod, jjangjjanggirl, quediceharry, futurecurrency, betterdev, smonian, happiness19, tr777, smonbear, gdhaetae, eturnerx, jarvie, vimm, chiren, sirjaxxy, dudeontheweb, youraverageguy, dunite, somegaming, dagamers, gamesjoyce, jrungi, lethsrock, ajaxalot, naruitchi, aceaeterna, justasperm, calimeatwagon, tricki, overmedia, thisbejake, thatterrioguy, nebuladream, tsnaks, mow, m2nnari, timcliff, sk1920, jessy22, erixink, nathen007, icuz, barge, borislavzlatanov, scorer, vikisecrets, tommasobusiello, citimillz, jedigeiss, fatherfaith, udabeu, tokenindustry, pjcorts, asgarth, espoem, holger80, fullnodeupdate, ixindamix, bluengel, hiq.redaktion, quekery, smooms, mary-me, kaeptn-iglo, hiq, carmate, beebay, beebay.office, tradingideas, smoner, ace108, angelusnoctum, santigs, softworld, dhimmel, emeka4, jeanpi1908, j-p-bs, ricardovieira, actnearn, theguruasia, rubenalexander, marianomariano, tazi, ibelin, alphacentauris, ssekulji, schlafhacking, koxmicart, dotwin1981, gamer0815, kaldewei, cristianlrj, victorjopaca, elevator09, alapok, jannatmirza, geekgirl, jocieprosza, pogarda, manojbhatt, brewery, aaliyahholt, cesinfenianos, drax, inertia, brofund-stem, ibc, pibara, mattockfs, busybody, euc, aleda0616, ahmedsy, jasonbu, tattytoque, arabisouri,