create account

Claiming Discounted Hive Accounts Using Beem by geekgirl

View this thread on: hive.blogpeakd.comecency.com
· @geekgirl ·
$56.74
Claiming Discounted Hive Accounts Using Beem
<center>![hive.png](https://images.hive.blog/DQmZvYBDgTZEduRYdDUDtWGLQ1XLC5KNEb2qoaPDHAaVNUX/hive.png)</center>

Beem is a great python library to interact with Hive Blockchain. It is created and maintained by @holger80. 

Hive has discounted accounts. Anybody who has enough resource credits can claim these discounted account tokens at the cost of their available RC. At a later time new accounts can be created using these claims for free. From time to time I claim some accounts with intention to use them in the future or help other onboarding efforts. 

Normally I would use peakd to claim accounts. In the wallet section, under delegate they have an option to claim accounts. They used to provide two options: single account claim, and multiple accounts claim. For some reason the multiple accounts claim option is not there anymore. Maybe it has moved somewhere else on the website. Instead of figuring out what happened to that option, I decided to see if I could achieve the same results using Beem.

As I was going looking for the ways how to write this script, I came across Holger's post from three years ago on the same topic. Holder gives a detailed explanation with the codes on how to claim discounted account and also how to create accounts using Beem in python. Here is the post:

https://hive.blog/beem/@holger80/claiming-and-creating-a-discounted-account-using-beem

Since the post is from three years ago, it is written for Steem blockchain. The code was so easy to follow, and I was able to repurpose it for Hive blockchain without any difficulty. 

I had to make changes so that it works with Hive. The original code was written to claim one account at a time. But it was written so well, it was very easy to change it to claim multiple accounts. I left the option for claiming one account in the code as commented out lines.

Here is my final code:

```
from beem import Hive
from beem.nodelist import NodeList
from beem.account import Account
from beem.rc import RC
import pprint
import getpass
import time

if __name__ == "__main__":

    nodelist = NodeList()
    nodelist.update_nodes()
    nodes = nodelist.get_hive_nodes()

    wif = getpass.getpass(prompt='Enter your Hive active key:')
    hive = Hive(node=nodes, keys=[wif])

    creator = hive.wallet.getAccountFromPrivateKey(wif)
    creator = Account(creator)

    rc = RC(blockchain_instance=hive)
    current_costs = hive.get_rc_cost(rc.get_resource_count(tx_size=250, new_account_op_count=1, execution_time_count=1))
    current_mana = creator.get_rc_manabar()["current_mana"]
    last_mana = current_mana
    print("Current costs %.2f G RC - current mana %.2f G RC" % (current_costs / 1e9, current_mana / 1e9))

    # if current_costs + 10 < current_mana:
    #     hive.claim_account(creator)
    #     time.sleep(10)
    #     creator.refresh()
    #     current_mana = creator.get_rc_manabar()["current_mana"]
    #     print("Account claimed and %.2f G RC paid." % ((last_mana - current_mana) / 1e9))
    #     last_mana = current_mana
    # else:
    #     print("Not enough RC for a claim!")
        
    while current_costs + 10 < last_mana:
        hive.claim_account(creator)
        time.sleep(10)
        creator.refresh()
        current_mana = creator.get_rc_manabar()["current_mana"]
        print("Account claimed and %.2f G RC paid." % ((last_mana - current_mana) / 1e9))
        last_mana = current_mana
    
    print("Not enough RC for a claim!")
```

I didn't get a chance to play with creating accounts part of Holger's guide. I will try to do that soon and if successful will share here in the future.

If you have questions or suggestions let me know in the comments. Thank You.

Posted Using [LeoFinance <sup>Beta</sup>](https://leofinance.io/@geekgirl/claiming-discounted-hive-accounts-using-beem)
๐Ÿ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 166 others
๐Ÿ‘Ž  
properties (23)
authorgeekgirl
permlinkclaiming-discounted-hive-accounts-using-beem
categoryhive-167922
json_metadata{"app":"leofinance/0.2","format":"markdown","tags":["python","hive","beem","dev","coding","stem","palnet","neoxian","ctp","blog","leofinance"],"canonical_url":"https://leofinance.io/@geekgirl/claiming-discounted-hive-accounts-using-beem","links":["https://hive.blog/beem/@holger80/claiming-and-creating-a-discounted-account-using-beem"],"image":["https://images.hive.blog/DQmZvYBDgTZEduRYdDUDtWGLQ1XLC5KNEb2qoaPDHAaVNUX/hive.png"]}
created2021-04-06 20:08:18
last_update2021-04-06 20:08:18
depth0
children17
last_payout2021-04-13 20:08:18
cashout_time1969-12-31 23:59:59
total_payout_value30.847 HBD
curator_payout_value25.891 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,813
author_reputation1,587,935,096,746,654
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,870,554
net_rshares56,165,734,700,378
author_curate_reward""
vote details (231)
@chekohler ·
$0.28
The claim multiple is still there in the peakd wallet I just claimed 4 tokens now I have 169 not sure what Iโ€™m going to do with them but I collect it none the less

Wonder if there will ever be an internal market for it one day 
๐Ÿ‘  ,
properties (23)
authorchekohler
permlinkre-geekgirl-qr5sc0
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2021.03.9"}
created2021-04-06 20:16:51
last_update2021-04-06 20:16:51
depth1
children2
last_payout2021-04-13 20:16:51
cashout_time1969-12-31 23:59:59
total_payout_value0.138 HBD
curator_payout_value0.138 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length228
author_reputation524,332,427,393,665
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,870,730
net_rshares450,762,602,116
author_curate_reward""
vote details (2)
@geekgirl ·
For some reason multiple claim option doesnโ€™t show up for me.
properties (22)
authorgeekgirl
permlinkqr5uqg
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2021-04-06 21:08:39
last_update2021-04-06 21:08:39
depth2
children0
last_payout2021-04-13 21:08:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length61
author_reputation1,587,935,096,746,654
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,871,667
net_rshares0
@simplegame ·
I agree.
I keep claiming but not sure what to do with them :)

Posted Using [LeoFinance <sup>Beta</sup>](https://leofinance.io/@simplegame/re-chekohler-3s1he2)
properties (22)
authorsimplegame
permlinkre-chekohler-3s1he2
categoryhive-167922
json_metadata{"app":"leofinance/0.2","format":"markdown","tags":["hive-167922","leofinance"],"canonical_url":"https://leofinance.io/@simplegame/re-chekohler-3s1he2"}
created2021-04-07 01:03:33
last_update2021-04-07 01:03:33
depth2
children0
last_payout2021-04-14 01:03:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length159
author_reputation128,625,210,956,373
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,875,225
net_rshares0
@cwow2 ·
$0.25
This is so confusing for someone who knows nothing about code xD
You could also just use peakd xD
๐Ÿ‘  ,
properties (23)
authorcwow2
permlinkre-geekgirl-202146t221051421z
categoryhive-167922
json_metadata{"tags":["python","hive","beem","dev","coding","stem","palnet","neoxian","ctp","blog","leofinance"],"app":"ecency/3.0.16-mobile","format":"markdown+html"}
created2021-04-06 20:10:51
last_update2021-04-06 20:10:51
depth1
children3
last_payout2021-04-13 20:10:51
cashout_time1969-12-31 23:59:59
total_payout_value0.125 HBD
curator_payout_value0.124 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length97
author_reputation208,068,840,559,585
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,870,609
net_rshares407,827,155,647
author_curate_reward""
vote details (2)
@geekgirl ·
But python is fun. :)
properties (22)
authorgeekgirl
permlinkqr5uwc
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2021-04-06 21:12:12
last_update2021-04-06 21:12:12
depth2
children1
last_payout2021-04-13 21:12:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length21
author_reputation1,587,935,096,746,654
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,871,710
net_rshares0
@cwow2 ·
Python is so fun no doubt! I just dont understand it :p
properties (22)
authorcwow2
permlinkre-geekgirl-202147t61930190z
categoryhive-167922
json_metadata{"tags":["ecency"],"app":"ecency/3.0.16-mobile","format":"markdown+html"}
created2021-04-07 04:19:30
last_update2021-04-07 04:19:30
depth3
children0
last_payout2021-04-14 04:19:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation208,068,840,559,585
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,877,724
net_rshares0
@starstrings01 ·
$0.02
lol... we are on the same table.
๐Ÿ‘  ,
properties (23)
authorstarstrings01
permlinkre-cwow2-qr5sgj
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2021.03.9"}
created2021-04-06 20:19:30
last_update2021-04-06 20:19:30
depth2
children0
last_payout2021-04-13 20:19:30
cashout_time1969-12-31 23:59:59
total_payout_value0.011 HBD
curator_payout_value0.011 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length32
author_reputation942,630,974,283,386
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,870,794
net_rshares42,521,438,602
author_curate_reward""
vote details (2)
@drbenzz ·
$0.25
Wow this is very great work @geekgirl. Whatโ€™s the advantage of claiming discounted accounts 
๐Ÿ‘  
properties (23)
authordrbenzz
permlinkre-geekgirl-qr8mvs
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2021.03.9"}
created2021-04-08 09:11:51
last_update2021-04-08 09:11:51
depth1
children1
last_payout2021-04-15 09:11:51
cashout_time1969-12-31 23:59:59
total_payout_value0.126 HBD
curator_payout_value0.126 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length92
author_reputation2,413,899,356,631
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,903,540
net_rshares422,987,380,607
author_curate_reward""
vote details (1)
@geekgirl ·
By doing this we can create accounts for free. Otherwise it would cost 3 Hive to create an account.
properties (22)
authorgeekgirl
permlinkqr99gf
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2021-04-08 17:19:51
last_update2021-04-08 17:19:51
depth2
children0
last_payout2021-04-15 17:19:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length99
author_reputation1,587,935,096,746,654
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,911,953
net_rshares0
@hivebuzz ·
Congratulations @geekgirl! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@geekgirl/replies.png?202104071702"></td><td>You got more than 7000 replies.<br>Your next target is to reach 7250 replies.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@geekgirl) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out the last post from @hivebuzz:**
<table><tr><td><a href="/hivebuzz/@hivebuzz/pud-202104-feedback"><img src="https://images.hive.blog/64x128/https://i.imgur.com/zHjYI1k.jpg"></a></td><td><a href="/hivebuzz/@hivebuzz/pud-202104-feedback">Feedback from the April 1st Hive Power Up Day</a></td></tr></table>
properties (22)
authorhivebuzz
permlinkhivebuzz-notify-geekgirl-20210407t172650000z
categoryhive-167922
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2021-04-07 17:26:48
last_update2021-04-07 17:26:48
depth1
children0
last_payout2021-04-14 17:26:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length940
author_reputation370,310,450,219,482
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,889,705
net_rshares0
@jfang003 ·
$0.25
I haven't really been keeping up with it but I don't even think I have enough HP to collect these tokens. Just for reference, how much HP or RCs are required to collect a token right now? I might go claim some in the future when I do have enough HP.

Posted Using [LeoFinance <sup>Beta</sup>](https://leofinance.io/@jfang003/re-geekgirl-6vnciy)
๐Ÿ‘  
properties (23)
authorjfang003
permlinkre-geekgirl-6vnciy
categoryhive-167922
json_metadata{"app":"leofinance/0.2","format":"markdown","tags":["hive-167922","leofinance"],"canonical_url":"https://leofinance.io/@jfang003/re-geekgirl-6vnciy"}
created2021-04-06 20:45:45
last_update2021-04-06 20:45:45
depth1
children2
last_payout2021-04-13 20:45:45
cashout_time1969-12-31 23:59:59
total_payout_value0.126 HBD
curator_payout_value0.125 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length344
author_reputation635,603,184,112,042
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,871,261
net_rshares409,749,335,389
author_curate_reward""
vote details (1)
@geekgirl ·
When my rc is at 100% I can usually claim 8-11 accounts. I have 45k hp. So probably about 5k hp will be needed to claim one account.
๐Ÿ‘  
properties (23)
authorgeekgirl
permlinkqr5uu8
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2021-04-06 21:10:57
last_update2021-04-06 21:10:57
depth2
children1
last_payout2021-04-13 21:10:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length132
author_reputation1,587,935,096,746,654
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,871,694
net_rshares525,258,086
author_curate_reward""
vote details (1)
@jfang003 ·
Thanks for the information. I'll note it down but it will probably be quite a while till I get enough HP.

Posted Using [LeoFinance <sup>Beta</sup>](https://leofinance.io/@jfang003/re-geekgirl-5fdtta)
properties (22)
authorjfang003
permlinkre-geekgirl-5fdtta
categoryhive-167922
json_metadata{"app":"leofinance/0.2","format":"markdown","tags":["hive-167922","leofinance"],"canonical_url":"https://leofinance.io/@jfang003/re-geekgirl-5fdtta"}
created2021-04-06 21:25:21
last_update2021-04-06 21:25:21
depth3
children0
last_payout2021-04-13 21:25:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length200
author_reputation635,603,184,112,042
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,871,925
net_rshares0
@mau189gg ·
donde copio y pego ese codigo? jejeje

Posted Using [LeoFinance <sup>Beta</sup>](https://leofinance.io/@mau189gg/re-geekgirl-jakvn)
properties (22)
authormau189gg
permlinkre-geekgirl-jakvn
categoryhive-167922
json_metadata{"app":"leofinance/0.2","format":"markdown","tags":["hive-167922","leofinance"],"canonical_url":"https://leofinance.io/@mau189gg/re-geekgirl-jakvn"}
created2021-04-06 20:16:54
last_update2021-04-06 20:16:54
depth1
children0
last_payout2021-04-13 20:16:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation30,901,782,843,366
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,870,732
net_rshares0
@nickyhavey ·
$0.25
I noticed I didn't have the option for claiming multiple accounts. Sometimes it's there, sometimes not. Does it depend on available HP?
๐Ÿ‘  
properties (23)
authornickyhavey
permlinkre-geekgirl-qr5v78
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2021.03.9"}
created2021-04-06 21:18:45
last_update2021-04-06 21:18:45
depth1
children2
last_payout2021-04-13 21:18:45
cashout_time1969-12-31 23:59:59
total_payout_value0.124 HBD
curator_payout_value0.124 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation343,022,660,476,683
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,871,823
net_rshares407,080,011,195
author_curate_reward""
vote details (1)
@geekgirl ·
I donโ€™t know the reason why it doesnโ€™t show up on peakd. I donโ€™t think it has to do hp. Thatโ€™s why I wanted to try with python.
properties (22)
authorgeekgirl
permlinkqr5vwp
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2021-04-06 21:34:00
last_update2021-04-06 21:34:00
depth2
children1
last_payout2021-04-13 21:34:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length127
author_reputation1,587,935,096,746,654
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,872,105
net_rshares0
@nickyhavey ·
I thought you needed to stake HP to be able to get resource credits. You then claim an account via RC. But I'm just claiming when I remember to, would be nice if there was an automatic way of doing it ๐Ÿ˜
properties (22)
authornickyhavey
permlinkre-geekgirl-qr7c2a
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2021.03.9"}
created2021-04-07 16:20:39
last_update2021-04-07 16:20:39
depth3
children0
last_payout2021-04-14 16:20:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length202
author_reputation343,022,660,476,683
root_title"Claiming Discounted Hive Accounts Using Beem"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id102,888,396
net_rshares0