Using the Cli_Wallet

in #guide7 years ago (edited)

The command line wallet or Cli_Wallet for Steem is capable of doing more functions with the blockchain than the Steemit.com frontend has. If you would like to give it a try, here's a little guide to show you some commands to get started with it.

First things first, you need to compile the Cli_Wallet and this guide is for Linux Ubuntu 16.04. You are able to compile it on other distros, Ubuntu 14.04 and OSX. You can even compile it using the Docker container but with this guide, I'll just be showing you how you can just use the Cli_Wallet without Docker. If you want to compile it with other methods, you can check out:
https://github.com/steemit/steem/blob/master/doc/building.md

Install The Required Packages

# Required packages
sudo apt-get install -y \
    autoconf \
    automake \
    cmake \
    g++ \
    git \
    libssl-dev \
    libtool \
    make \
    pkg-config \
    python3 \
    python3-jinja2

# Boost packages (also required)
sudo apt-get install -y \
    libboost-chrono-dev \
    libboost-context-dev \
    libboost-coroutine-dev \
    libboost-date-time-dev \
    libboost-filesystem-dev \
    libboost-iostreams-dev \
    libboost-locale-dev \
    libboost-program-options-dev \
    libboost-serialization-dev \
    libboost-signals-dev \
    libboost-system-dev \
    libboost-test-dev \
    libboost-thread-dev

# Optional packages (not required, but will make a nicer experience)
sudo apt-get install -y \
    doxygen \
    libncurses5-dev \
    libreadline-dev \
    perl



I found it easier to just be a super user when doing this but it's up to you. Just type sudo su before you start and enter your password for your system.
Cli_wallet8.png

Cli_wallet9.png

Cli_wallet10.png

Compile Cli_Wallet

After installing the required packages, you can begin compiling the wallet. The command below will set things up for compiling Steemd but won't. It will just compile the Cli_Wallet. If you decided you want to try out in running Steemd, you can always come back to this step to compile it right away.

This may take some time to compile depending on the performance of your system.

Note: This will be compiling version 0.19.1 make sure to double check that latest version before compiling.
sudo git clone https://github.com/steemit/steem && cd steem && git checkout -b 0.19.1 && git submodule update --init --recursive && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=ON -DENABLE_CONTENT_PATCHING=OFF .. && make -j$(nproc) cli_wallet && make install  # defaults to /usr/local



Cli_wallet11.png

Run Cli_Wallet

When the compiling is finished, you can begin to start the Cli_Wallet. Whichever directory you are in, the wallet file will be created there once setting a password and importing a key. Enter the command:
cli_wallet -s wss://steemd.steemit.com

Cli_wallet.png

Cli_wallet3.png

After you have connected, you will need to create a password of your choosing by entering:
set_password YOURPASSWORD
I used YOURPASSWORD as my password for an example.

Cli_wallet2.png

Then unlock the wallet.
unlock YOURPASSWORD

Cli_wallet4.png

Now you want to import your key.
import_key YOURPRIVATEACTIVEKEY

Cli_wallet5.png

Cli_wallet6.png

Now you can begin using the Cli_Wallet and do a range of different operations like sending funds or get information on a witness like so:
get_wintess gtg

Cli_wallet7.png

Note: You could get an invalid state error
10 assert_exception: Assert Exception                                                                                   
!ec: websocket send failed: invalid state                                                                                   {"msg":"invalid state"}                                                                                                 
th_a  websocket.cpp:164 send_message
If this happens, just restart the Cli_Wallet by hitting the ctrl + c to exit and use the cli_wallet -s wss://steemd.steemit.com command, unlock your wallet, and run the command again.

List of Cli_wallet Commands

about()                                                                                    
cancel_order(string owner, uint32_t orderid, bool broadcast)    
cancel_transfer_from_savings(string from, uint32_t request_id, bool broadcast)   
challenge(string challenger, string challenged, bool broadcast)                            
change_recovery_account(string owner, string new_recovery_account, bool broadcast)                                                                                                                                 
claim_reward_balance(string account, asset reward_steem, asset reward_sbd, asset reward_vests, 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_delegated(string creator, asset steem_fee, asset delegated_vests, 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_account_with_keys_delegated(string creator, asset steem_fee, asset delegated_vests, 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)                                                                  
decline_voting_rights(string account, bool decline, bool broadcast)                                              
decrypt_memo(string memo)                                                                  
delegate_vesting_shares(string delegator, string delegatee, asset vesting_shares, bool broadcast)                                                                                                                  
escrow_approve(string from, string to, string agent, string who, uint32_t escrow_id, bool approve, bool broadcast)                                                                                                 
escrow_dispute(string from, string to, string agent, string who, uint32_t escrow_id, bool broadcast)                                                                                                               
escrow_release(string from, string to, string agent, string who, string receiver, uint32_t escrow_id, asset sbd_amount, asset steem_amount, bool broadcast)                                                        
escrow_transfer(string from, string to, string agent, uint32_t escrow_id, asset sbd_amount, asset steem_amount, asset fee, time_point_sec ratification_deadline, time_point_sec escrow_expiration, string json_meta, bool broadcast)                                                                                                       
follow(string follower, string following, set<string> what, bool broadcast)                             
account_api_obj 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_encrypted_memo(string from, string to, string memo)                                            
get_feed_history()                                                                      
get_inbox(string account, fc::time_point newest, uint32_t limit)                              
get_miner_queue()                                                                          
get_open_orders(string accountname)                                                           
get_ops_in_block(uint32_t block_num, bool only_virtual)                                                      
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_withdraw_routes(string account, withdraw_route_type type)                                 
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_from_savings(string from, uint32_t request_id, string to, asset amount, string memo, bool broadcast)                                                                                                      
transfer_to_savings(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)

If you want a more detailed description of each command, you can check out this post:
https://steemit.com/steemhelp/@hannixx42/cliwallet-commands-v0

Note: The link above does not include descriptions of the newer commands such as ones dealing with delegation and a few others but if you have been dealing with Steem for a while, you'll generally know how they work.

If there is an updated and detailed description of the commands please let me know.




Image Source


Thank you for taking the time to read my post.
Feel free to follow and find me in SteemSpeak on Discord.

Sort:  

Thank you for your post! I can't list my accounts to check my balance.
Here is my error:
10 assert_exception: Assert Exception
a0 != e: too few arguments passed to method
{}
th_a api_connection.hpp:165 fc::generic_api::call_generic

I tried to change the server, but it didn't work. Any advices would be greatly appriciated

What command did you do? also depending on what node you are connected to and if the plugin is enabled then certain commands won't work. You would also need to import the private keys of the accounts you are looking to list their balance. If you do have the keys imported to your Cli_Wallet, you can do list_my_accounts. I know this node wss://gtg.steem.house:8090 has the plugin enabled. You can also use get_account STEEMUSERNAME and get them individually...

Irrelevant to this post; yes. I just wanted to say thank you very much ; much mahalo, for your support. You are very kind to me. Aloha!

No thanks necessary. I think you do great blog posts and I enjoy seeing and helping a fellow user representing Hawaii. It's all about the Aloha ;)

I encourage you to keep writing and don't be discouraged if you end up with a low rewarding post. Just keep Steemin on!

Mahalo. I really enjoy it here. Aloha!

That's really cool! Thanks for this complete tutorial! And now: let's have fun :D

Yes, go for it!!! :)

Man I wish I could understand this stuff....lol....you put it together very good I guess I just need some abc patterns to understand

You can, just have want to learn it. There was a time I didn't understand any of this. I'll help you with what I know if you want to learn man!

Looks interesting. What are a couple use cases for installing and using the CLI wallet? Can it hold steem offline?

Technically it holds and encrypts your private keys so I guess you could say you can hold it offline in a sense.

A few use cases would be the commands you see like getting information on witnesses, creating accounts, delegating, etc. There are a few operations that currently don't work but will be in the future such as escrow.

useful wallet tips thanks for sharing followed:)

Thank you for sharing this valuable information. Have a great day!

Nice post.... I have upvote you ... if you like please upvote back @rizkiandrian ...thanks

Resteem your post to 1000+ followers for only 0.5 SBD or Steem)

Just send 0.5 SBD or steem to @steemvote (URL as memo)

New Followers get 0.001 SBD$ and an upvote for free!!

Just follow @steemvote and...

  • we follow back
  • send you 0.001 SBD to your wallet

Coin Marketplace

STEEM 0.19
TRX 0.13
JST 0.030
BTC 61978.49
ETH 3408.83
USDT 1.00
SBD 2.48