beem.steem module

class beem.steem.Steem(node='', rpcuser=None, rpcpassword=None, debug=False, data_refresh_time_seconds=900, **kwargs)

Bases: object

Connect to the Steem network.

  • node (str) – Node to connect to (optional)
  • rpcuser (str) – RPC user (optional)
  • rpcpassword (str) – RPC password (optional)
  • nobroadcast (bool) – Do not broadcast a transaction! (optional)
  • debug (bool) – Enable Debugging (optional)
  • keys (array,dict,string) – Predefine the wif keys to shortcut the wallet database (optional)
  • offline (bool) – Boolean to prevent connecting to network (defaults to False) (optional)
  • expiration (int) – Delay in seconds until transactions are supposed to expire (optional)
  • blocking (str) – Wait for broadcasted transactions to be included in a block and return full transaction (can be “head” or “irrversible”)
  • bundle (bool) – Do not broadcast transactions right away, but allow to bundle operations (optional)
  • appbase (bool) – Use the new appbase rpc protocol on nodes with version 0.19.4 or higher. The settings has no effect on nodes with version of 0.19.3 or lower.

Three wallet operation modes are possible:

  • Wallet Database: Here, the steemlibs load the keys from the locally stored wallet SQLite database (see To use this mode, simply call Steem() without the keys parameter
  • Providing Keys: Here, you can provide the keys for your accounts manually. All you need to do is add the wif keys for the accounts you want to use as a simple array using the keys parameter to Steem().
  • Force keys: This more is for advanced users and requires that you know what you are doing. Here, the keys parameter is a dictionary that overwrite the active, owner, posting or memo keys for any account. This mode is only used for foreign signatures!

If no node is provided, it will connect to default nodes of Default settings can be changed with:

steem = Steem(<host>)

where <host> starts with ws:// or wss://.

The purpose of this class it to simplify interaction with Steem.

The idea is to have a class that allows to do this:

from beem import Steem
steem = Steem()

This class also deals with edits, votes and reading content.


Broadcast a transaction to the Steem network

Parameters:tx (tx) – Signed transaction to broadcast
connect(node='', rpcuser='', rpcpassword='', **kwargs)

Connect to Steem network (internal use only)

create_account(account_name, creator=None, owner_key=None, active_key=None, memo_key=None, posting_key=None, password=None, additional_owner_keys=[], additional_active_keys=[], additional_posting_keys=[], additional_owner_accounts=[], additional_active_accounts=[], additional_posting_accounts=[], storekeys=True, store_owner_key=False, json_meta=None, delegation_fee_steem='0 STEEM', **kwargs)

Create new account on Steem

The brainkey/password can be used to recover all generated keys (see beemgraphenebase.account for more details.

By default, this call will use default_account to register a new name account_name with all keys being derived from a new brain key that will be returned. The corresponding keys will automatically be installed in the wallet.


Don’t call this method unless you know what you are doing! Be sure to understand what this method does and where to find the private keys for your account.


Please note that this imports private keys (if password is present) into the wallet by default. However, it does not import the owner key for security reasons. Do NOT expect to be able to recover it from the wallet if you lose your password!


Account creations cost a fee that is defined by the network. If you create an account, you will need to pay for that fee! You can partially pay that fee by delegating VESTS. To pay the fee in full in STEEM, leave delegation_fee_steem set to 0 STEEM (Default). To pay the fee partially in STEEM, partially with delegated VESTS, set delegation_fee_steem to a value greater than 1 STEEM. Required VESTS will be calculated automatically. To pay the fee with maximum amount of delegation, set delegation_fee_steem to 1 STEEM. Required VESTS will be calculated automatically.

  • account_name (str) – (required) new account name
  • json_meta (str) – Optional meta data for the account
  • owner_key (str) – Main owner key
  • active_key (str) – Main active key
  • posting_key (str) – Main posting key
  • memo_key (str) – Main memo_key
  • password (str) – Alternatively to providing keys, one can provide a password from which the keys will be derived
  • additional_owner_keys (array) – Additional owner public keys
  • additional_active_keys (array) – Additional active public keys
  • additional_posting_keys (array) – Additional posting public keys
  • additional_owner_accounts (array) – Additional owner account names
  • additional_active_accounts (array) – Additional acctive account names
  • storekeys (bool) – Store new keys in the wallet (default: True)
  • delegation_fee_steem – If set, creator pay a fee of this amount, and delegate the rest with VESTS (calculated automatically). Minimum: 1 STEEM. If left to 0 (Default), full fee is paid without VESTS delegation.
  • creator (str) – which account should pay the registration fee (defaults to default_account)

AccountExistsException – if the account already exists on the blockchain

custom_json(id, json_data, required_auths=[], required_posting_auths=[])

Create a custom json operation :param str id: identifier for the custom json (max length 32 bytes) :param json json_data: the json data to put into the custom_json

  • required_auths (list) – (optional) required auths
  • required_posting_auths (list) – (optional) posting auths
finalizeOp(ops, account, permission, **kwargs)

This method obtains the required private keys if present in the wallet, finalizes the transaction, signs it and broadacasts it

  • ops (operation) – The operation (or list of operaions) to broadcast
  • account (operation) – The account that authorizes the operation
  • permission (string) – The required permission for signing (active, owner, posting)
  • append_to (object) – This allows to provide an instance of ProposalsBuilder (see steem.new_proposal()) or TransactionBuilder (see steem.new_tx()) to specify where to put a specific operation.
… note:: append_to is exposed to every method used in the
Steem class

… note:

If ``ops`` is a list of operation, they all need to be
signable by the same key! Thus, you cannot combine ops
that require active permission with ops that require
posting permission. Neither can you use different
accounts for different operations!
… note:: This uses beem.txbuffer as instance of
beem.transactionbuilder.TransactionBuilder. You may want to use your own txbuffer

Returns the block intervall in seconds


Return witness elected chain properties

{‘account_creation_fee’: ‘30.000 STEEM’,
‘maximum_block_size’: 65536, ‘sbd_interest_rate’: 250}

Returns internal chain configuration.


Returns the current median price :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.


This call returns the dynamic global properties :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.


Returns the feed_history :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.


Returns Hardfork and live_time of the hardfork :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.


Returns the current median history price as Price


Identify the network :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.

Returns:Network parameters
Return type:dict

This call returns the dynamic global properties :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.


Get details for a reward fund. :param bool use_stored_data: if True, stored data will be returned. If stored data are empty or old, refresh_data() is used.


Returns the current rshares to SBD ratio


Returns the current mvest to steem ratio


Return witness elected chain properties


Returns the global properties


Create a new wallet. This method is basically only calls beem.wallet.create().

Parameters:pwd (str) – Password to use for the new wallet
Raises:beem.exceptions.WalletExists – if there is already a wallet created
new_tx(*args, **kwargs)

Let’s obtain a new txbuffer

Returns int txid:
 id of the new txbuffer
refresh_data(force_refresh=False, data_refresh_time_seconds=None)

Read and stores steem blockchain parameters If the last data refresh is older than data_refresh_time_seconds, data will be refreshed

param bool force_refresh:
 if True, data are forced to refreshed
param float data_refresh_time_seconds:
 set a new minimal refresh time in seconds
register_apis(apis=['network_broadcast', 'account_by_key', 'follow', 'market_history'])

Calculates the SBD amount of a vote


Set the default account to be used

sign(tx=None, wifs=[])

Sign a provided transaction witht he provided key(s)

  • tx (dict) – The transaction to be signed and returned
  • wifs (string) – One or many wif keys to use for signing a transaction. If not present, the keys will be loaded from the wallet as defined in “missing_signatures” key of the transactions.
sp_to_rshares(sp, voting_power=10000, vote_pct=10000)

Obtain the r-shares :param number sp: Steem Power :param int voting_power: voting power (100% = 10000) :param int vote_pct: voting participation (100% = 10000)

sp_to_sbd(sp, voting_power=10000, vote_pct=10000)
sp_to_vests(sp, timestamp=None)

Returns the default transaction buffer


Returns the currently active tx buffer

unlock(*args, **kwargs)

Unlock the internal wallet

vests_to_sp(vests, timestamp=None)