steem-python for dummies #7 - Creating accounts

in #utopian-io7 years ago (edited)


Hello,

This is the 7. post of "steem-python for dummies" series. If you didn't read the older ones take your time and have a look.

  1. steem-python for dummies #1 - Introduction and Basic Operations
  2. steem-python for dummies #2 - Playing with account data
  3. steem-python for dummies #3 - Coding an upvote bot
  4. steem-python for dummies #4 - Private Memos
  5. steem-python for dummies #5 - Bundling Blockchain Operations
  6. steem-python for dummies #6 - Delegating

In this post, we will learn about creating accounts in steem network with steem-python.

Creating Accounts

When you have a look to original steemit account's movements in the network, you will see that
@steem account constantly creates new accounts.

This is the "account_create_with_delegation" operation in the chain. Basicly, you can create a new account by paying a fee and creating a delegation to the newly created account.

Steemit does it free but sometimes it may delay new users because of the waiting queue. But luckily you know python and you can do it yourself with steem-python!

Action

s = Steem(nodes=["https://rpc.buildteam.io"],
          keys=["active_wif"])
s.create_account(
    'new_account_username',
    delegation_fee_steem="1 STEEM",
    password="yourpassword",
    creator="emrebeyler",
    json_meta={"profile": {"name": "Test account"}},
)

Even though, it's possible to create accounts with lower steem fees, steem-python need at least 1 STEEM at the moment. I have created a test account with this code as @steempythontut, which I paid 1 STEEM and 25 SP delegation. (You can take them back anytime, of course.)

steemd representation of my try

Accessing the private keys

After that code executes, you have your freshly created account in place but where are the private keys?

We will get help from steempy again. steempy is the cli tool of steem-python package. When you install steem-python, steempy comes with it.

Importing the account

steempy importaccount new_account_name

It will ask the password. (The pass we have entered while creating the account) Then it will ask a new password for the wallet. Note it.

steempy listaccounts

It should show the accounts and available keys.

NameTypeAvailable Key
steempythontutactiveWIF
steempythontutpostingWIF
n/an/aWIF

This list includes public keys. In order to get private keys, you can just use:

steempy getkey WIF

Also, you can login to steemit with the last one once you dump it's private key steempy getkey.

Tip: You don't actually need to use steempy to get private keys. You can see what's happening while using these commands by investigating cli.py on steem-python.

I used steempy in this tutorial, since it removes the boiler-plate code, but if you want to automate stuff, you need to learn what's going on under the hood.


That's all for this post. Feel free to ask questions or request topics about steem-python for the incoming posts.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thanks for post

Hey @emrebeyler I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Haver another happy year, !BEER



Hey @emrebeyler, here is a little bit of BEER from @isnochys for you. Enjoy it!