update for beem: preperation for HF24 (eclipse)

in hive-139531 •  2 days ago 

Repository

https://github.com/holgern/beem


beem-logo

beem is a python library and command line tool for HIVE. The current version is 0.24.4.

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 versions 0.24.4

  • add get_replace_hive_by_steem() to Hive(), for transition from HF23 to HF24 on HIVE

  • Replace HIVE by STEEM and SBD by HBD only when Hive HF < 24

  • Replace steem and sbd parameter names for Hive HF >= 24 by hive and hbd

  • Add get follow list to Account (only for HIVE and HF >= 24)

  • Add BLURT, SMOKE and VIZ chain_id

  • Remove not used STEEM chains (STEEMZERO and STEEMAPPBASE)

  • Improve chain detection

  • rshares_to_token_backed_dollar, get_token_per_mvest, token_power_to_vests, token_power_to_token_backed_dollar
    and vests_to_token_power have been added for chain independent usage

  • New beempy command followlist, which can be used on HIVE to receive info about follow lists

  • Fix beempy info on Hive

  • Use Hive() on beempy when default_chain is set to "hive"

  • Fix more Token symbols in beempy

  • Fix unittest and add more unit tests

Prepare beem for HF 24 (eclipse)

Currently, STEEM and SBD are internally used to broadcasting operations on Hive which including an amount as parameter. There are also some parameter names in operations that include steem or sbd.

In the next HF 24 (ecplise), all will be renamed to HIVE/HBD and hive/hbd.

Beem does now support Hive HF23 and Hive HF24. There is a temporary function call get_replace_hive_by_steem() is is True on HF23 and False on HF24. I'm using this as test when to replacing all steem/sbd with hive/hbd.

When HF24 took place, I will remove this check and make the replacement with hive/hbd permanent.

A node running HF24 can be set with

beempy set nodes https://beta.openhive.network

A first test:

beempy transfer -a holger80 beembot 0.001 HIVE test

looks good:

{
    "expiration": "2020-06-29T19:56:04",
    "ref_block_num": 28926,
    "ref_block_prefix": 826483934,
    "operations": [
        [
            "transfer",
            {
                "from": "holger80",
                "to": "beembot",
                "amount": "0.001 HIVE",
                "memo": "test"
            }
        ]
    ],
    "extensions": [],
    "signatures": [
        "1f427f44eee5f0abe1602854dc66175922417330bd12ba1cd4653b53a7658e5fff09d41fc49e0079ff084a0b11392cd290a5667cf95795c31f59cc92df1ea6280b"
    ],
    "trx_id": "991b773129b0b04fe56c6b89a6ceb23971d89701"
}

Broadcasting a post was not yet possible on https://beta.openhive.network, I will investigate and fix this.

Tags to replace

The following list shows all parameter that will be replaced:

  "STEEM_"                            : "HIVE_",
  "SBD_"                              : "HBD_",
  "steem"                             : "hive",
  "sbd"                               : "hbd",
  "reblogged_on"                      : "reblog_on",
  "sbd_interest_rate"                 : "hbd_interest_rate",
  "percent_steem_dollars"             : "percent_hbd",
  "current_sbd_supply"                : "current_hbd_supply",
  "init_sbd_supply"                   : "init_hbd_supply",
  "sbd_print_rate"                    : "hbd_print_rate",
  "sbd_start_percent"                 : "hbd_start_percent",
  "sbd_stop_percent"                  : "hbd_stop_percent",
  "sbd_volume"                        : "hbd_volume",
  "steem_volume"                      : "hbd_volume",
  "steem_revision"                    : "hive_revision",
  "sbd_exchange_rate"                 : "hbd_exchange_rate",
  "last_sbd_exchange_update"          : "last_hbd_exchange_update",
  "reward_sbd_balance"                : "reward_hbd_balance",
  "reward_steem_balance"              : "reward_hive_balance",
  "reward_vesting_steem"              : "reward_vesting_hive",
  "savings_sbd_balance"               : "savings_hbd_balance",
  "savings_sbd_last_interest_payment" : "savings_hbd_last_interest_payment",
  "savings_sbd_seconds"               : "savings_hbd_seconds",
  "savings_sbd_seconds_last_update"   : "savings_hbd_seconds_last_update",
  "sbd_balance"                       : "hbd_balance",
  "sbd_last_interest_payment"         : "hbd_last_interest_payment",
  "sbd_seconds"                       : "hbd_seconds",
  "sbd_seconds_last_update"           : "hbd_seconds_last_update",
  "pending_rewarded_vesting_steem"    : "pending_rewarded_vesting_hive",
  "total_reward_fund_steem"           : "total_reward_fund_hive",
  "total_vesting_fund_steem"          : "total_vesting_fund_hive",
  "percent_hive_dollars"              : "percent_hbd"

Replace more SP, steem and sbd related functions

I created blockchain independent function at the BlockchainInstance class, which are then implemented in Hive() and Steem().
The following functions are now available on Hive() and Steem() objects:

  • rshares_to_token_backed_dollar()
  • get_token_per_mvest()
  • token_power_to_vests()
  • token_power_to_token_backed_dollar()
  • vests_to_token_power()

E.g. token_power_to_token_backed_dollar is using hp_to_hbd() on Hive and sp_to_sbd() on Steem.

Preparation for Hivemind API changes

It is now possible to provide account name lists as array or as comma-separated string in follow():

from beem.account import Account
acc = Account("holger80")
acc.follow("user_a,user_b")
acc.follow(["user_c","user_d"])

As the changes or not live, broadcasting a list is not yet working.

There is already a get_follow_list() which can then be used to return blacklisted, follow_blacklist muted, or follow_muted lists.

from beem.account import Account
acc = Account("holger80")
print(acc.get_follow_list("muted"))

You can find more about the upcoming api changes in this post

Support for different chains

I improved the correct identification for other graphene blockchains. Use the Steem() class for connecting to the API node from a Graphene based blockchain.

My focus is on the usage of beem together with Hive, but I'm open to PRs that improve the usage of beem on other chains (as long as they do not impact the usage on Hive).

Example for connecting to a graphene blockchain:

from beem import Steem
blt = Steem("https://test.blurt.world/rpc")
print(blt.chain_params)

returns

{'chain_id': 'afa547e2e0adef898219d7f74abf36e6e957460a70120db21a03fed76cc0e8b6', 'min_version': '0.0.0', 'prefix': 'BLT', 'chain_assets': [{'asset': '@@000000021', 'symbol': 'BLURT', 'precision': 3, 'id': 1}, {'asset': '@@000000037', 'symbol': 'VESTS', 'precision': 6, 'id': 2}]}

If you like what I do, consider casting a vote for me as witness on Hivesigner or on PeakD

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi @holger80, you have received a small bonus upvote from MAXUV.
This is to inform you that you now have new MPATH tokens in your Hive-Engine wallet.
Please read this post for more information.
Thanks for being a member of both MAXUV and MPATH!

I have picked your post for my daily hive voting initiative, Keep it up and Hive On!!

Another great tutorial on Beem library application for HIVE. Thanks for sharing your publication
Your post has been submitted to be curated with @gitplait community account because this is the kind of publications we like to see in our community.

Join our Community on Hive and Chat with us on Discord.

[[Gitplait-Team]](https://gitplait.tech

I find the addition of other chains interesting.

  ·  2 days ago Reveal Comment

Hola @holger80… He elegido tu post para mi iniciativa diaria de reblogear. Este es mi aporte para Hive…
Sigamos trabajando y aportando ideas para crecer en Hive!...
alegria.jpg
Hello @holger80... I have chosen your post for my daily reblogging initiative. This is my contribution to Hive...
Let's keep working and giving ideas to grow in Hive!

Congratulations @holger80! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

Your post got the highest payout of the day

You can view your badges on your board And compare to others on the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Support the HiveBuzz project. Vote for our proposal!
  ·  20 hours ago (edited)

Cool !

Thanks for including Smoke.io as one of the auto detected chains. 👍

Great work!!!
Thanks.

Hello @ holger80, quite interesting thanks for the links.

Hola @ holger80, bastante interesante gracias por los enlaces.