Steem Command Line Guide Part 1 - A Learner's Guide to Using cli_wallet

cli_wallet is the command-line program that connects to a Steem node synced with the blockchain to create/broadcast transactions and get info about the chain. It is useful for people who wish to interact with the Steem blockchain manually and directly to a node, rather than through steemit.com. Why? There are some Steem transactions and transaction variables that can't be done with Steemit's UI. Some might want to keep their more powerful active or owner account keys out of their web browser completely. It is also a way to get raw info about the blockchain directly from a node.

In this guide I will show you some basic Steem cli_wallet commands and teach you how to explore the others so you can learn more. This is slightly advanced but just about anyone can follow along and learn. Here, in part 1, I show some examples of basic commands and how to format them. Part 2 will cover more advanced commands, mainly the key change commands. Part 3 will cover some other useful commands.

Since it would be a lot to write a guide for every command, I am taking a "teach a man to fish" approach. I hope this will be a jumping off point for anyone interested in learning more. Even if you don't plan on using the cli_wallet, these posts might be an informative look under the hood of the Steem network.

Build/get steemd and cli_wallet

To use the cli_wallet you need to connect to a local Steem node, a program named steemd. Follow these guides for getting one running and synced:

Once the blockchain is synced, you should see messages in the steemd console like this:
620878ms th_a application.cpp:439 handle_block ] Got 3 transactions from network on block 3448303

cli_wallet

Steem's basic command line software connects to steemd to get information and broadcast transactions. In a Linux build it can be found in steem/programs/cli_wallet/. Once steemd is synced, open a new terminal and enter ./cli_wallet in that directory to run it. With bitcube's Windows build, just double click cli_wallet.exe when synced.

When you run it for the first time it will ask you to use set_password to make a password for the wallet.json file that it creates. Choose a reasonably strong password for this as you may be importing your more powerful keys into the wallet. Note: wallet passwords can't contain special characters for some reason. After setting a password, the wallet is locked, and you must unlock it with unlock followed by the password. You can re-lock it later with lock.

C01setpassword
Make your password random and unlikely to ever be said (this is obviously a bad example)

help

Enter help to get a long and perhaps confusingly laid out list of commands. I'll go into more detail about a few of these later. To the right of each command are parentheses that usually contain syntax hints for the particular command. Each command is listed with its type to the left. Some are for signing/broadcasting transactions, some query steemd for data, and some are internal wallet commands. I've left these categories out for legibility. These are the commands as of v0.12.1:

about()                         
cancel_order(string owner, uint32_t orderid, bool broadcast)
challenge(string challenger, string challenged, bool broadcast)
change_recovery_account(string owner, string new_recovery_account, bool broadcast)
convert_sbd(string from, asset amount, bool broadcast)
create_account(string creator, string new_account_name, string json_meta, bool broadcast)
create_account_with_keys(string creator, string newname, string json_meta, public_key_type owner, public_key_type active, public_key_type posting, public_key_type memo, bool broadcast)
create_order(string owner, uint32_t order_id, asset amount_to_sell, asset min_to_receive, bool fill_or_kill, uint32_t expiration, bool broadcast)
follow(string follower, string following, set<string> what, bool broadcast)
get_account(string account_name)
get_account_history(string account, uint32_t from, uint32_t limit)
get_active_witnesses()
get_block(uint32_t num)
get_conversion_requests(string owner)
get_feed_history()
get_inbox(string account, fc::time_point newest, uint32_t limit)
get_miner_queue()
get_open_orders(string accountname)
get_order_book(uint32_t limit)
get_outbox(string account, fc::time_point newest, uint32_t limit)
get_owner_history(string account)
get_private_key(public_key_type pubkey)
get_private_key_from_password(string account, string role, string password)
get_prototype_operation(string operation_type)
get_state(string url)
get_transaction(transaction_id_type trx_id)
get_witness(string owner_account)
gethelp(const string & method)
help()
import_key(string wif_key)
info()
is_locked()
is_new()
list_accounts(const string & lowerbound, uint32_t limit)
list_keys()
list_my_accounts()
list_witnesses(const string & lowerbound, uint32_t limit)
load_wallet_file(string wallet_filename)
lock()
network_add_nodes(const vector<string> & nodes)
network_get_connected_peers()
normalize_brain_key(string s)
post_comment(string author, string permlink, string parent_author, string parent_permlink, string title, string body, string json, bool broadcast)
prove(string challenged, bool broadcast)
publish_feed(string witness, price exchange_rate, bool broadcast)
recover_account(string account_to_recover, authority recent_authority, authority new_authority, bool broadcast)
request_account_recovery(string recovery_account, string account_to_recover, authority new_authority, bool broadcast)
save_wallet_file(string wallet_filename)
send_private_message(string from, string to, string subject, string body, bool broadcast)
serialize_transaction(signed_transaction tx)
set_password(string password)
set_transaction_expiration(uint32_t seconds)
set_voting_proxy(string account_to_modify, string proxy, bool broadcast)
set_withdraw_vesting_route(string from, string to, uint16_t percent, bool auto_vest, bool broadcast)
sign_transaction(signed_transaction tx, bool broadcast)
suggest_brain_key()
transfer(string from, string to, asset amount, string memo, bool broadcast)
transfer_to_vesting(string from, string to, asset amount, bool broadcast)
unlock(string password)
update_account(string accountname, string json_meta, public_key_type owner, public_key_type active, public_key_type posting, public_key_type memo, bool broadcast)
update_account_auth_account(string account_name, authority_type type, string auth_account, weight_type weight, bool broadcast)
update_account_auth_key(string account_name, authority_type type, public_key_type key, weight_type weight, bool broadcast)
update_account_auth_threshold(string account_name, authority_type type, uint32_t threshold, bool broadcast)
update_account_memo_key(string account_name, public_key_type key, bool broadcast)
update_account_meta(string account_name, string json_meta, bool broadcast)
update_witness(string witness_name, string url, public_key_type block_signing_key, const chain_properties & props, bool broadcast)
vote(string voter, string author, string permlink, int16_t weight, bool broadcast)
vote_for_witness(string account_to_vote_with, string witness_to_vote_for, bool approve, bool broadcast)
withdraw_vesting(string from, asset vesting_shares, bool broadcast)

gethelp

Most of the commands listed with help are documented fairly well by way of the gethelp command. Use this command to figure out what the syntax hints to the right of all the commands above really mean, and get further info on the function of the command. We'll use this as a syntax example: gethelp import_key

import_key

Here is the output of gethelp import_key:

Imports a WIF Private Key into the wallet to be used to sign transactions by an account.

example: import_key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Parameters:
wif_key: the WIF Private Key to import (type: string)

Simple enough, enter import_key followed by one of your account's private keys, maybe starting with the posting key for safety for now. More on keys here. You can get your private posting key by visiting https://steemit.com/@youraccountname/permissions, and then clicking the Show private key button. Be sure to have a good wallet password if you import your active key, and only import your owner key when you are going to change it. You can import as many keys as you want, for as many accounts as you want.

transfer

One of the most basic functions of a cryptocurrency network since Bitcoin is transferring funds. The transfer command is able to send liquid currencies on the Steem network, STEEM and SBD (Steem Dollars), to other accounts. Here's the output of gethelp transfer:

Transfer funds from one account to another. STEEM and SBD can be
transferred.

Parameters:
    from: The account the funds are coming from (type: string)
    to: The account the funds are going to (type: string)
    amount: The funds being transferred. i.e. "100.000 STEEM" (type: asset)
    memo: A memo for the transactionm, encrypted with the to account's
        public memo key (type: string)
    broadcast: true if you wish to broadcast the transaction (type: bool)

Thus the syntax for the transfer command is:

transfer ned pfunk "1000.000 STEEM" "high-five" true

Anything that is a string technically should be in quotes, although for account names that don't have dashes or periods in them, you can get away with skipping them.

  1. The first account string is the sender, for which you must have the account's active or owner key imported.
  2. The second account string is the receiver.
  3. Third in the syntax is the asset string, which must be in quotes, and use every decimal that the asset uses (both STEEM and SBD use 3 decimal places, and trailing zeroes must be included) followed by the asset abbreviation.
  4. Fourth is the memo string, which needs to be included whether you want to leave a memo or not. Simply use "" for no memo.
  5. Last is the boolean (true/false) variable of whether or not to broadcast the transaction. If you want the transfer to go through, you'll enter true.

list_my_accounts

How do we know our account's balances? The list_my_accounts command will show us our STEEM balance, VESTS (the internal Steem unit that is Steem Power, denominated differently), and SBD (Steem Dollars) for any account that we have any key imported for. It will list all of the accounts that you have imported keys for. Sample output:

buttcoin                  0.000 STEEM   27575.184286 VESTS            0.000 SBD
esteem                    0.000 STEEM  867306.160036 VESTS            0.000 SBD
-------------------------------------------------------------------------
TOTAL                     0.000 STEEM  894881.344322 VESTS            0.000 SBD

info

This reports back to you a good deal of the current Steem network info. Much of this data can be found on steemd.com as well. info is useful to see the progress of your blockchain sync, as it will tell you how old the timestamp of the last block is: "head_block_age": "1 second old",

about

about tells you your client version, compile date, and a few other bits of info about the software and environment.

vote and post_comment

You can vote and post (post_comment) from the command line! It's not so easy to format the command yourself, so I suggest using steemd.com's advanced mode on any post or comment you'd like to vote or comment on.

C02steemd

C03steemd

Click the your-acct link (orange arrow) to enter your account name to be autofilled. Then copy and paste the given text into your cli_wallet. When commenting, change the "your reply.." text to your own comment of course.

One thing that cli voting allows you to do that Steemit does not (yet) is to adjust the weight of your votes. This allows you to conserve voting power or select exactly how much you want to upvote or downvote. The 100 before the 'true' in the command is the voting weight variable. It can be anywhere from -100 to 100, with negative votes being a downvote, 0-weighted votes being an un-vote, and 100 being a full-power (normal) upvote.


That's it for part 1. This is meant to be a jumping off point, so anyone who reads this can now probably figure out almost every command available in the cli_wallet. In part 2 I will cover the key changing commands in-depth.


If you found this or my other posts helpful, consider voting for me as a Steem witness and click here for my blog page to hit the follow button in the upper right!

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center