Learn Steem-Python #2- Basic CommandssteemCreated with Sketch.

in #utopian-io5 years ago (edited)


Hi Guys!!...

Today in this tutorial, we will learn about few basic commands for programming the Steem blockchain using Python language.

Please, refer to Part 1 before going any further, if the required tools are not installed.


This is all about practising the basic commands of "Steem-Python".

Basic commands

Import the Steem function from steem library. After importing, we can use the function to access further commands (variables) inside that function.

>>> from steem import Steem
>>> s = Steem()

All keys

Using all keys, we can query.

>>> s.get_account('abhi3700').keys()



This represents the 'user id' of the steem account holder. This is assigned whenever the user joins for 1st time and it remains permanent for the 'username'

>>> s.get_account('abhi3700')['id']


>>> s.get_account('abhi3700')['name']

Owner, Active, Posting, Memo Keys

Here, all the keys required to access account's different features.


>>> s.get_account('abhi3700')['owner']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
>>> s.get_account('abhi3700')['active']
{'weight_threshold': 1, 'account_auths': [], 'key_auths': [['**************************************************', 1]]}
>>> s.get_account('abhi3700')['posting']
{'weight_threshold': 1, 'account_auths': [['utopian.app', 1]], 'key_auths': [['**************************************************', 1]]}
>>> s.get_account('abhi3700')['memo_key']

Public Profile Settings

This shows the meta-data about the user.

>>> s.get_account('abhi3700')['json_metadata']
'{"profile":{"name":"Abhijit Roy","about":"A Software Developer, Traveller, Crypto Trader, Blockchain enthusiast","location":"Chandigarh, India","profile_image":"https://firebasestorage.googleapis.com/v0/b/bitinfocoinfree.appspot.com/o/14068548_1125160424216001_2627046384272844500_o.jpg?alt=media&token=8bb1b1f9-36f5-4b9a-8220-4134f01f8542","website":"https://play.google.com/store/apps/details?id=in.topux.bitinfocoin","cover_image":"https://www.ethereum.org/images/assets/1900/Ethereum-homestead-background-4.jpg"}}'


It is null in this case as no proxy server used.

>>> s.get_account('abhi3700')['proxy']

Last owner update

It comes from the UNIX command i.e. January 1st 1970. Also birthdays are written in timestamps (time from this date till date).

>>> s.get_account('abhi3700')['last_owner_update']

Last account update

It mainly is when the account settings (public profile) was last updated.

>>> s.get_account('abhi3700')['last_account_update']

Account creation time

The date, time when the account was created.

>>> s.get_account('abhi3700')['created']

Recovery account

If your account gets hacked, it can be recovered before any data is manipulated.

>>> s.get_account('abhi3700')['recovery_account']
>>> s.get_account('abhi3700')['last_account_recovery']

Click here for details.

Post counts

The no. of posts posted by the user.

>>> s.get_account('abhi3700')['post_count']

Can vote

Whether a person can vote or not.

>>> s.get_account('abhi3700')['can_vote']

Voting Power

This depends upon the 'steem power' a user holds. Here, it calculates out of 10,000.

>>> s.get_account('abhi3700')['voting_power']

So, I hold 98 % voting power currently.

Last vote time

Last time, I voted.

>>> s.get_account('abhi3700')['last_vote_time']


All balances in steem, SBD.
The user account looks like this...

>>> s.get_account('abhi3700')['balance']
'0.000 STEEM'

>>> s.get_account('abhi3700')['sbd_balance']
'0.603 SBD'

>>> s.get_account('abhi3700')['savings_sbd_balance']
'0.000 SBD'


Basically, it defines the steem power.
Click here for details.

>>> s.get_account('abhi3700')['vesting_shares']
'1038936.179712 VESTS'
>>> s.get_account('abhi3700')['delegated_vesting_shares']
'0.000000 VESTS'
>>> s.get_account('abhi3700')['received_vesting_shares']
'12358.959056 VESTS'
>>> s.get_account('abhi3700')['vesting_withdraw_rate']
'0.000000 VESTS'
>>> s.get_account('abhi3700')['next_vesting_withdrawal']

Basically, I have never withdrawn my steem-power. The time itself indicates i.e. before Jan 1, 1970 ())


It is the power to post, upvote, comment. The more Steem-power one has, the more steem-blockchain's bandwidth is owned by the user.
It is like holding a percent of the network.

# Content post bandwidth
>>> s.get_account('abhi3700')['average_bandwidth']

>>> s.get_account('abhi3700')['lifetime_bandwidth']

>>> s.get_account('abhi3700')['last_bandwidth_update']

# Market bandwidth
>>> s.get_account('abhi3700')['average_market_bandwidth']

>>> s.get_account('abhi3700')['lifetime_market_bandwidth']

>>> s.get_account('abhi3700')['last_market_bandwidth_update']

Last post date

The date, time for last post.

>>> s.get_account('abhi3700')['last_post']

Witness votes

The witnesses I have voted for.

>>> s.get_account('abhi3700')['witness_votes']
['steemed', 'utopian-io']

Basically, all the above discussed user properties can be viewed here-(https://steemd.com/@username)

That's all.

Stay tuned for more such tutorials......

View in Github

Posted on Utopian.io - Rewarding Open Source Contributors



You've got a 1UP from the @utopian-1up curation trail. 22 Utopians have upvoted your quality contribution to the open source community.

Join 1UP for better posts and high curation rewards.

1UP is neither organized nor endorsed by Utopian.io!

Thank you for the contribution. It has been approved.

You can contact us on Discord.

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


  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

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


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

Great stuff and good detailled explanations with examples.
Now I have to find how I can use all this.. thanks !

Coin Marketplace

STEEM 0.22
TRX 0.07
JST 0.028
BTC 28297.75
ETH 1785.93
USDT 1.00
SBD 2.97