Warning: Steem witnesses executed a hard fork on 2020-05-20, seizing 23.6M STEEM from 65 accounts. The funds were transferred to an account named @community321, the ownership (and intentions) of which have not been revealed. The witnesses claim to have been targeting accounts which defended against a hostile takeover in early March, but at least 2 accounts on the list have been inactive for over 4 years.

Coverage:
- Decrypt.io: Steem network to seize $5 million from its own users
- SteemPeak.com: Official Announcement by @softfork22888
- GitHub.com: view steemd HF23 changes

What you can do:
- Send exchanges a notice of the pending class action lawsuit.
- Switch to HIVE, the community-led fork. Visit Hive.blog and Hiveblocks.com.

Learn Steem & Hive API - #01 - 轉化 vesting_shares 到 SP or HP | convert vesting shares to SP/HP by nuagnorab

View this thread on steempeak.com
· @nuagnorab ·
$6.28
Learn Steem & Hive API - #01 - 轉化 vesting_shares 到 SP or HP | convert vesting shares to SP/HP
What's up guys,

Ever since day 1 of my life on Steem, I have been wanted to learn how to interact with people or the blockchain directly without any help from frontend applications.

It has been an opportunity for me to finally push myself into this rabbit hole since many friends in the community were talking about the HIVE's API. Especially those times when the Hive's wallet was not available (It is working now).

Having said that, I would like to learn more about Steem / Hive's API as well. Since I have been told they are almost identical except for the naming. Learning one side will definitely earn how to interact with the other. One stone kill two bird, clearly a very good deal!

---

從我在Steem上的第一天開始,我一直想學習如何在沒有前端應用程序的幫助下直接與他人進行區塊鏈交流。

由於社區中許多朋友都在談論HIVE的API,我見有人把hive api Github 轉發出來,便借此機會來了解一下。 特別是在Hive的錢包不可使用的時候(現在正常可用了)。

我也想進一步了解Steem / Hive 的API。 我被告知,除了 library 的名字外,它們幾乎完全相同。 學習一邊肯定可以在另一邊使用上。 一石二鳥,顯然是很劃算的!

---

For Steem, I start with the steem-python from [Github repo](https://github.com/steemit/steem-python) by @steemit.

Steem 我用了 steemit 官方發佈的 GitHhub.

For Hive, I start with forked hive-python from [Github repo](
https://github.com/pharesim/hive-python) by  @pharesim.

至於,Hive 我用了 @pharesim 發佈的 GitHub.

---

Little Intro here.

>steem-python is the official Steem library for Python. It comes with a BIP38 encrypted wallet and a practical CLI utility called steempy.

>hive-python is a Hive library for Python. It comes with a BIP38 encrypted wallet and a practical CLI utility called hivepy.

---

## Installation

First, we need to install the python package from source. You can do 

首先,我們需要安裝python軟件包。 你可以在 CLI 上如此安裝

```
pip3 install steem # for steem-python
pip3 install hivepy  # for hive-python
```

It is getting too wordy, I will be using hive as the example since they are identical.

---

We need to import the installed library

```
from hive import Hive
from hive.converter import Converter
h = Hive()

ac_info = h.get_account(username)

def vests2hp(vests_count):
  vests_count = float(vests_count.replace(' VESTS', ''))
  converter = Converter(hived_instance = h)
  hp_count = vests_count / 1e6 * converter.hive_per_mvests()
  return ('{:.3f}'.format(hp_count))

# This will return you the amount of SP/HP that your are holding
vests2hp(ac_info['vesting_shares']) 
```
---

The main point is to get the calculation right in order to show the correct numbers.

重點是正確計算以顯示正確數字。

```
  hp_count = vests_count / 1e6 * converter.hive_per_mvests()
```

You will need to get the ```hive_per_mvests``` from the blockchain at the time being for the correct calculation which is to divide the product of ```1e6 (1 X10^6)``` and the ```hive_per_mvests()```.

您需要當時從區塊鏈中獲取當時```hive_per_mvests()```的數值才能進行正確計算,再除以```1e6(1 X10 ^ 6)```和```hive_per_mvests``的乘積```。

Now that we know how to calculate vesting shares. Let's see what we will learn about next time.

現在,我們知道如何轉化 vesting_shares 到 SP or HP 了。 

Cheers!
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 206 others
👎  ,
properties (23)
post_id85,417,085
authornuagnorab
permlinklearn-steem-and-hive-api-01-vestingshares-sp-or-hp-or-convert-vesting-shares-to-sp-hp
categoryhive-180932
json_metadata{"tags":["cn","lifestyle","jjm","mini","build-it","hivestem","steem2hive","cn-programming","cn-reader","cn-curation","whalepower","palnet","zzan","dblog","diamondtoken","marlians","neoxian","lassecash","upfundme","actnearn"],"users":["steemit","pharesim"],"links":["https:\/\/github.com\/steemit\/steem-python","https:\/\/github.com\/pharesim\/hive-python"],"app":"steemcoinpan\/0.1","format":"markdown"}
created2020-03-26 18:36:54
last_update2020-03-26 18:36:54
depth0
children3
net_rshares21,943,990,948,267
last_payout2020-04-02 18:36:54
cashout_time1969-12-31 23:59:59
total_payout_value3.179 SBD
curator_payout_value3.097 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,950
author_reputation70,613,687,112,481
root_title"Learn Steem & Hive API - #01 - 轉化 vesting_shares 到 SP or HP | convert vesting shares to SP/HP"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (272)
@annepink ·
👍5⃣👏
properties (22)
post_id85,418,431
authorannepink
permlinkq7tlnm
categoryhive-180932
json_metadata{"app":"steemcn\/0.1"}
created2020-03-26 21:43:03
last_update2020-03-26 21:43:03
depth1
children0
net_rshares0
last_payout2020-04-02 21:43:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length4
author_reputation104,712,854,805,089
root_title"Learn Steem & Hive API - #01 - 轉化 vesting_shares 到 SP or HP | convert vesting shares to SP/HP"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@wilhb81 ·
暖哥手脚真快,我也要去尝试下,拍拍!
properties (22)
post_id85,421,924
authorwilhb81
permlinkq7u8zy
categoryhive-180932
json_metadata{"app":"steemcn\/0.1"}
created2020-03-27 06:07:12
last_update2020-03-27 06:07:12
depth1
children0
net_rshares0
last_payout2020-04-03 06:07:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length18
author_reputation113,937,494,928,134
root_title"Learn Steem & Hive API - #01 - 轉化 vesting_shares 到 SP or HP | convert vesting shares to SP/HP"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
#### Hi @nuagnorab!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your **UA** account score is currently 3.544 which ranks you at **#4204** across all Steem accounts.
Your rank has improved 241 places in the last three days (old rank 4445).

In our last Algorithmic Curation Round, consisting of 124 contributions, your post is ranked at **#59**.
##### Evaluation of your UA score:

* You're on the right track, try to gather more followers.
* The readers like your work!
* Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!


**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
post_id85,425,168
authorsteem-ua
permlinkre-learn-steem-and-hive-api-01-vestingshares-sp-or-hp-or-convert-vesting-shares-to-sp-hp-20200327t133037z
categoryhive-180932
json_metadata{"app":"beem\/0.22.9"}
created2020-03-27 13:30:36
last_update2020-03-27 13:30:36
depth1
children0
net_rshares0
last_payout2020-04-03 13:30:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length729
author_reputation23,203,609,903,979
root_title"Learn Steem & Hive API - #01 - 轉化 vesting_shares 到 SP or HP | convert vesting shares to SP/HP"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000