create account

beempy 利用RC领取的新号资源创建steem 新号 by dappcoder

View this thread on: hive.blogpeakd.comecency.com
· @dappcoder · (edited)
$1.85
beempy 利用RC领取的新号资源创建steem 新号
<h1>beempy 利用RC领取的新号资源创建steem 新号</h1>

最近虽然在做[steem-python](https://github.com/steemit/steem-python) 实战教程,但不支持利用RC领取的新号资源创建steem 新号,需要使用beempy.

代码如下(create_account_with_RC.py):
--------------------------------------
```python
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# python create_account_with_RC.py creator account

from contextlib import suppress
import sys
import json

# from beem import Steem
from beem.account import Account
from beem.instance import shared_steem_instance
from beemgraphenebase.account import BrainKey, PasswordKey

def run():

    # need creator and  name of the new account
    try:
        creator = sys.argv[1]
        account = sys.argv[2]
    except Exception as e:
        sys.exit()
    print('creator:', creator)
    print('account:', account)

    # gen a set of keys
    bk = BrainKey()
    brainkey = bk.get_brainkey()
    print('brain key:', str(brainkey))
    prikey = str(bk.get_private())
    print('private key:', str(prikey))
    pubkey = format(bk.get_public(), "STM")
    print('public key:', str(pubkey))

    # unlock local wallet
    stm = shared_steem_instance()
    stm.wallet.unlock(password)

    try:
        # Account of creator
        creatorA = Account(creator, steem_instance=stm)
        # test the new account is exist on steem blockchain?
        accountA = Account(account, steem_instance=stm)
    except Exception as e:
        print('account can be created:', account)

    # create new account
    tx = stm.create_claimed_account(account, creator=creatorA, password=pubkey)
    print('create_claimed_account:', json.dumps(tx, indent=4))

    # get keys
    posting_key = PasswordKey(account, pubkey, role="posting", prefix=stm.prefix)
    active_key = PasswordKey(account, pubkey, role="active", prefix=stm.prefix)
    memo_key = PasswordKey(account, pubkey, role="memo", prefix=stm.prefix)
    owner_key = PasswordKey(account, pubkey, role="owner", prefix=stm.prefix)
    # get publick keys
    # active_pubkey = active_key.get_public_key()
    # owner_pubkey = owner_key.get_public_key()
    # posting_pubkey = posting_key.get_public_key()
    memo_pubkey = memo_key.get_public_key()
    # get private keys
    active_privkey = active_key.get_private_key()
    posting_privkey = posting_key.get_private_key()
    owner_privkey = owner_key.get_private_key()
    memo_privkey = memo_key.get_private_key()

    print('posting_privkey:', str(posting_privkey))
    print('active_privkey:', str(active_privkey))
    print('owner_privkey:', str(owner_privkey))
    print('memo_privkey:', str(memo_privkey))


if __name__ == '__main__':
    with suppress(KeyboardInterrupt):
        run()
```
执行程序:`python create_account_with_RC.py dappcoder newcoder`
执行结果符合预期:
![屏幕快照 2020-02-14 上午12.50.30.png](https://cdn.steemitimages.com/DQmfXKRqpmd3WWxduwMjh7YZY4U5V782TYYUQYhyHsM2i2P/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202020-02-14%20%E4%B8%8A%E5%8D%8812.50.30.png)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 83 others
properties (23)
authordappcoder
permlinkbeempy-rc-steem
categoryhive-180932
json_metadata{"tags":["cn","chinese","hive-143316","cn-reader","cn-curation","sct","sct-cn","sct-freeboard","whalepower","dblog","actnearn","neoxian","palnet","upfundme","zzan","jjm","lifestyle","mediaofficials","lassecash","liv","steemleo","busy","esteem","esteem-cn","marlians"],"links":["https://github.com/steemit/steem-python"],"app":"busy/2.5.4","format":"markdown","community":"esteemapp","image":["https://cdn.steemitimages.com/DQmfXKRqpmd3WWxduwMjh7YZY4U5V782TYYUQYhyHsM2i2P/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202020-02-14%20%E4%B8%8A%E5%8D%8812.50.30.png"]}
created2020-02-11 21:04:39
last_update2020-02-13 16:55:21
depth0
children3
last_payout2020-02-18 21:04:39
cashout_time1969-12-31 23:59:59
total_payout_value1.006 HBD
curator_payout_value0.845 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,919
author_reputation9,480,331,507,174
root_title"beempy 利用RC领取的新号资源创建steem 新号"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id95,345,785
net_rshares7,565,442,626,952
author_curate_reward""
vote details (147)
@hero777 ·
# According to the Bible, *How do you influence faith to Christian believers? (Part 3 of 3)*
***(Sorry for sending this comment. We are not looking for our self profit, our intentions is to preach the words of God in any means possible.)***
https://youtu.be/QUE64WdiKMg
https://i.postimg.cc/SxmKZFY2/image.jpg
Comment what you understand of our Youtube Video to receive our full votes. We have 30,000 #SteemPower. It's our little way to **Thank you, our beloved friend.**  
Check our [Discord Chat](https://discord.gg/vzHFNd6) 
Join our Official Community: https://beta.steemit.com/trending/hive-182074
👍  
👎  
properties (23)
authorhero777
permlinknk84mjj9zcg
categoryhive-180932
json_metadata""
created2020-02-11 21:12:54
last_update2020-02-11 21:12:54
depth1
children0
last_payout2020-02-18 21:12: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_length604
author_reputation-12,129,381,532,907
root_title"beempy 利用RC领取的新号资源创建steem 新号"
beneficiaries[]
max_accepted_payout10,000.000 HBD
percent_hbd100
post_id95,345,966
net_rshares-23,393,096,000
author_curate_reward""
vote details (2)
@steemitboard ·
Congratulations @dappcoder! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@dappcoder/votes.png?202002120508"></td><td>You distributed more than 600 upvotes. Your next target is to reach 700 upvotes.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@dappcoder) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=dappcoder)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-dappcoder-20200212t055532000z
categoryhive-180932
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2020-02-12 05:55:33
last_update2020-02-12 05:55:33
depth1
children0
last_payout2020-02-19 05:55: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_length899
author_reputation38,975,615,169,260
root_title"beempy 利用RC领取的新号资源创建steem 新号"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id95,356,792
net_rshares0
@tongpingxia ·
不错啊。免得在第三方网站上创建,还需要提供active蜜月,不太安全
properties (22)
authortongpingxia
permlinkre-dappcoder-2020213t1764529z
categoryhive-180932
json_metadata{"tags":["cn","chinese","hive-143316","cn-reader","cn-curation","sct","sct-cn","sct-freeboard","whalepower","dblog","actnearn","neoxian","palnet","upfundme","zzan","jjm","lifestyle","mediaofficials","lassecash","liv","steemleo","busy","esteem","esteem-cn","marlians"],"app":"esteem/2.2.4-mobile","format":"markdown+html","community":"hive-125125"}
created2020-02-13 09:06:51
last_update2020-02-13 09:06:51
depth1
children0
last_payout2020-02-20 09:06: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_length34
author_reputation1,001,811,627,665
root_title"beempy 利用RC领取的新号资源创建steem 新号"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id95,403,302
net_rshares0