create account

steem-python tips #2 - Create Steem accounts yourself by emrebeyler

View this thread on: hive.blogpeakd.comecency.com
· @emrebeyler · (edited)
$50.75
steem-python tips #2 - Create Steem accounts yourself
<img src="https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/U5drxhdemuq4r4ezSCFC6xhAknvQspB_1680x8400">

#### Creating accounts
***

Do you know that you can actually create accounts with 1 STEEM fee and 10 SP delegation? Otherwise, it wouldn't make any sense since, in a decentralized blockchain, we would be bounded to Steemit.

Creating an account is actually an "account\_create\_with\_delegation" operation broadcasted to the network. Creating accounts has a cost because every account needs a little SP to interact with the blockchain. (SP gives voting power and bandwidth allocation to steem accounts)

Steemit [does that](https://steemd.com/@steem) for you if you are willing to wait for their approval and give up your privacy. (Phone number) But if you want to create an account for your friends, family, you can actually do it yourself without waiting for Steemit's approval.

Also, if you create an account, automatically, you become the recovery account of the created account, which may be better in certain situations.

#### Account creator script


***

Out script's main flow should be like this:

- Get an input with new_account_username, new_account_master_key and creator account.
- Broadcast an "account\_create\_with\_delegation " operation to the network
- Get new account's posting, active, owner, memo keys. (both private and public.) 

*Basic example to create an account:*

```
from steem import Steem
from steem.account import Account
s = Steem(
	nodes=["https://api.steemit.com"],
   keys=["active_key_of_creator_account",]
   )
steemd_instance.create_account(
    new_account,
    delegation_fee_steem="1 STEEM",
    password=new_account_master_key,
    creator=creator_account,
)
```    

<img src="https://s17.postimg.org/wsw3u76lb/Screen_Shot_2018-03-02_at_10.07.09.png">
<center><sup>Steemd representation of account\_create\_with\_delegation operation.</sup></center>
    
This script will create  the account successfully. But you don't know to get the private keys, yet. (posting, active, owner, memo.) These keys can be obtained with the master key.

#### The Ultimate Account Creator Script
***

```
from steem import Steem
from steembase.account import PasswordKey
def create_account(steemd_instance, new_account, new_account_master_key, creator):
    steemd_instance.create_account(
        new_account,
        delegation_fee_steem="1 STEEM",
        password=new_account_master_key,
        creator=creator,
    )
    keys = {}
    for key_type in ['posting','active','owner','memo']:
        private_key = PasswordKey(
            new_account, new_account_master_key, key_type).get_private_key()
        keys[key_type] = {
            "public": str(private_key.pubkey),
            "private": str(private_key),
        }
    return keys
if __name__ == '__main__':
    s = Steem(nodes=["https://api.steemit.com"],
              keys=["creator_acc_active_wif"])
    keys = create_account(
        s,
        "new_account_username",
        "new_account_master_key",
        "creator_account_username"
    )
    for key, subkeys in keys.items():
        print("Key Type: %s" % key)
        print("Public: %s\nPrivate: %s\n--" % (
            subkeys["public"], subkeys["private"]))
```
<center><sup>See the script nicely formatted at [Github gists](https://gist.github.com/emre/1b1d819f8a369fc3b48893432813f207).</sup></center>

It should give an output like this when you execute it.

<img src="https://s17.postimg.org/5iasm6vxr/Screen_Shot_2018-03-02_at_10.13.31.png">


#### Notes
***

- It will cost you 1 STEEM and 10 SP delegation. You can take back the delegation later on and power down the STEEM.

- Make sure you have picked up a complicated and secure password for the master key. These are similar to brain wallets so it might be ugly if you pick 123456.

- You need steem-python installed in your local environment to execute this script.

Have fun.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 51 others
properties (23)
authoremrebeyler
permlinksteem-python-tips-2-create-steem-accounts-yourself
categorysteem-python
json_metadata{"community":"busy","app":"busy/2.4.0","format":"markdown","users":["steem"],"links":["https://steemd.com/@steem","https://gist.github.com/emre/1b1d819f8a369fc3b48893432813f207"],"image":["https://steemitimages.com/0x0/https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/U5drxhdemuq4r4ezSCFC6xhAknvQspB_1680x8400","https://steemitimages.com/0x0/https://s17.postimg.org/wsw3u76lb/Screen_Shot_2018-03-02_at_10.07.09.png","https://steemitimages.com/0x0/https://s17.postimg.org/5iasm6vxr/Screen_Shot_2018-03-02_at_10.13.31.png"],"tags":["steem-python","python","steem","steemstem","sndbox"]}
created2018-03-02 07:19:51
last_update2018-03-02 11:04:09
depth0
children3
last_payout2018-03-09 07:19:51
cashout_time1969-12-31 23:59:59
total_payout_value41.615 HBD
curator_payout_value9.132 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,919
author_reputation448,535,049,068,622
root_title"steem-python tips #2 - Create Steem accounts yourself"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,572,395
net_rshares10,327,915,986,580
author_curate_reward""
vote details (115)
@arysanjaya ·
Great postings, very important and useful for all steemians, and I say thanks to @emrebeyler for helping steemians.
properties (22)
authorarysanjaya
permlinkre-emrebeyler-201832t14302594z
categorysteem-python
json_metadata{"tags":["steem-python","python","steem","steemstem","sndbox"],"app":"esteem/1.5.1","format":"markdown+html","community":"esteem"}
created2018-03-02 07:30:12
last_update2018-03-02 07:30:12
depth1
children0
last_payout2018-03-09 07:30: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_length115
author_reputation26,301,830,722
root_title"steem-python tips #2 - Create Steem accounts yourself"
beneficiaries
0.
accountesteemapp
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,574,090
net_rshares0
@buildawhale ·
re-emrebeyler-steem-python-tips-2-create-steem-accounts-yourself-20180302t090409936z
You got a 4.81% upvote from @buildawhale courtesy of @emrebeyler!
If you believe this post is spam or abuse, please report it to our [Discord](https://discord.gg/yv2TMPu) #abuse channel.

If you want to support our [Curation Digest](https://steemit.com/curation/@buildawhale/buildawhale-curation-digest-02-06-18) or our Spam & Abuse prevention efforts, please vote [@themarkymark](https://v2.steemconnect.com/sign/account-witness-vote?witness=themarkymark&approve=1) as witness.
properties (22)
authorbuildawhale
permlinkre-emrebeyler-steem-python-tips-2-create-steem-accounts-yourself-20180302t090409936z
categorysteem-python
json_metadata{"app":"postpromoter/1.8.7"}
created2018-03-02 09:04:09
last_update2018-03-02 09:04:09
depth1
children0
last_payout2018-03-09 09:04:09
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_length479
author_reputation26,761,520,358,321,264
root_title"steem-python tips #2 - Create Steem accounts yourself"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,589,907
net_rshares0
@ulqu3 ·
Didn't know this. Thanks for posting helpful information.
properties (22)
authorulqu3
permlinkre-emrebeyler-steem-python-tips-2-create-steem-accounts-yourself-20180302t072814209z
categorysteem-python
json_metadata{"tags":["steem-python"],"app":"steemit/0.1"}
created2018-03-02 07:28:21
last_update2018-03-02 07:28:21
depth1
children0
last_payout2018-03-09 07:28: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_length57
author_reputation43,754,280,289,730
root_title"steem-python tips #2 - Create Steem accounts yourself"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,573,813
net_rshares0