2.2 cli_wallet

A wallet command line tool that supports interactions with the blockchain. The operation instructions are as follows:

2.2.1 Login

  1. Get the command line wallet executable file: cli_wallet and copy it to the scheduled directory
  2. Go to the directory where the command line wallet is located. Run the following command to log in to the command line wallet
    Command format
    --chain-id [chain ID] -s [witness node RPC address] -r [the address that the command line wallet's RPC service listens on]
./cli_wallet --chain-id 81003974d328ff17b64076928ab87b24d7dffbc87df3d4cde89d2fa1877e4f6a -s ws://127.0.0.1:8070 -r 127.0.0.1:8099

Result:

2.2.2 Set password for the wallet

  1. You need to set a password for your wallet when login for the first time
    Command format
    unlock [set password]
set_password xxxx

Result:

  1. After setting the password, you need to unlock the wallet.
    Command format
    unlock [set password]
unlock xxxx

Result:

2.2.3 Import the account to the wallet

  1. Log in to unlock the wallet and execute the following command to import the user.
    Command format
    import_key [username] [user private key]
import_key official-account 5KaVpJa9G4oqA5WHcSGitauFRuzdHcPVEAaESaA

Result:

2.2.4 Import assets to the wallet

  1. Log in to unlock the wallet to import the assets
    Command format
    import_balance [username] [private key corresponding to the asset address] [broadcast (true/false)]
    Context
    A new chain whose founding assets have not been exported
import_balance official-account ["5KAUeN3Yv51FzpLGGf4S1ByKpMqVFNzXTJK7euqc3L"] true

Result:

2.2.5 Transfer

Command format
import_balance [transfer] [from to] [amount] [token asset type] [remarks] [broadcast (true/false)]
Conditions
Login to unlock your wallet. There shall have enough balance in the account
Example
transfer official-account test-account 100 COCOS "info" true

transfer from to amount asset_symblo "memo_info" true

Result:

2.2.6 Register

Command format
register_account [username] [owner public key] [active public key] [registrar account name] [referrer account name] [cost percentage] [broadcast (true/false)]
Conditions
Login to unlock the wallet. The registrar should be a member who have enough balance in the account
Example
register_account test-account XXX6esv8d6u2eqzKyiQvCYJa6XK74c7BrmzUqL4Z7zfhtvB4db XXX6esv8d6u2eqzKyiQvCYJa6XK74c7BrmzUqL4Z7zfhtvB4db official-account official-account 0 true

register_account name owner_key active_key registrar_account referrer_account referrer_percent true

Result:

2.2.7 Upgrade the account for membership

Conditions
There is enough balance in the account
Command format
upgrade_account [username] [broadcast (true/false)]
Example
upgrade_account test-account true
Note
cli_wallet supports upgrading to a lifetime membership only, but not the annual membership.

upgrade_account test-account true

Result:

2.2.8 Get information such as chain ID, current active witnesses and committee members

Command format
info

info

Result:

2.2.9 Return information such as client version, compile time, boost version, openssl version, etc.

Command format
about

about

Result:

2.2.10 Get the information of a specified block

Command format
get_block [block height]
Example
get_block 10

get_block block_num

Result:

2.2.11 Get the total number of accounts registered on-chain

Command format
get_account_count

get_account_count

Result:

2.2.12 List the accounts imported to the wallet

Command format
list_my_accounts

list_my_accounts

Result:

2.2.13 List the account balances

Command format
list_account_balances [account name]
Example
list_account_balances official-account

list_account_balances official-account 

Result:

2.2.14 List the tokens on the chain

Command format
list_assets [lowerbound] [limit]
Example
list_assets “” 1
Note
The return results are sorted by the token symbols. The “lowerbound” parameter is the minimum limit, and the “limit” is the maximum number of returns, which is to return a maximum of “limit” tokens whose symbol is not less than the “lowerbound”.

list_assets lowerbound limit

Result:

2.2.15 Get the account history

Command format
get_account_history [account name] [limit]
Example
get_account_history official-account 2

get_account_history account limit

Result:

2.2.16 Get the static properties such as fees

Command format
get_global_properties

get_global_properties

Result:

Part of the long results

Part of the long results

2.2.17 Get the dynamic properties such as head block ID, time and next maintenance time

Command format
get_dynamic_global_properties

get_dynamic_global_properties

Result:

2.2.18 Get account information

Command format
get_account [account name or ID]
Example
get_account official-account

get_account_id account_name_or_id

Result:

2.2.19 Get the token asset information

Command format
get_asset [asset name or ID]
Example
get_asset COCOS

get_asset asset_name_or_id

Result:

2.2.20 Get the account ID

Command format
get_account_id [account name]
Example
get_account_id official-account

get_account_id account_name

Result:

2.2.21 Get information about token assets

Command format
get_asset [account name]
Example
get_asset COCOS

get_asset asset_name

Result:

2.2.22 Get object

Command format
get_object [object ID]
Example
get_object 1.2.6

get_object object_id

Result:

2.2.23 Get the private key

Command format
get_private_key [public key]
Example
get_private_key XXX6esv8d6u2eqzKyiQvCYJa6XK74c7BrmzUqL4Z3
Note
The private key must be saved in the wallet.

get_private_key public_key

Result:

2.2.24 Lock the wallet

Command format
lock

lock

Result:

2.2.25 Return a set of secure brain key, public key, and private key

Command format
suggest_brain_key

suggest_brain_key

Result:

2.2.26 Register to be a committee member

Command format
create_committee_member [account name] [url address] [broadcast (true/false)]
Example
create_committee_member official-account "http://my-web" true
Note
The user becomes a candidate committee member after registration. He will be the official member only by winning the vote.

create_committee_member account "url" true

Result:

2.2.27 Register to be a witness

Command format
create_witness [account name] [url address] [broadcast (true/false)]
Example
create_witness official-account "http://my-web" true
Note
The user becomes​ a candidate witness after application. He will be the official witness only by winning the vote.

create_witness account "url" true

Result:

2.2.28 List the witnesses

Command format
list_witnesses [lowerbound] [limit]
Example
list_witnesses "" 100
Note
Returned results are sorted by the witness account name. The “lowerbound” parameter is the minimum limit, and the “limit” is the maximum number of returns.

list_witnesses lowerbound limit

Result:

2.2.29 List the committee members

Command format
list_committee_members [lowerbound] [limit]
Example
list_committee_members "" 100
Note
Returned results are sorted by the committee member account name. The “lowerbound” parameter is the minimum limit, and the “limit” is the maximum number of returns.

list_committee_members lowerbound limit

Result:

2.2.30 Get the witness information

Command format
get_witness [witness name or ID]
Example
get_witness Witness-0

get_witness witness_name_or_id

Result:

2.2.31 Get the committee member

Command format
get_committee_member [committee member name or ID]
Example*

get_committee_member Witness-0

get_committee_member committee_member_name_or_id

Result:

2.2.32 Create a contract

Command format
create_contract [contract owner] [contract name] [contract authority (publicKey in a pair of public and private keys)] [data] [broadcast (true/false)]
Example
create_contract 1.2.17 contract.helloworld "COCOS1DE213......" "function hello() chainhelper:log('Hello World!') end" true

create_contract owner name contract_authority data broadcast

Result:

2.2.33 Update the contract

Command format
revise_contract [contract updater username] [contract name or ID] [data] [broadcast (broadcast (true/false))]
Example
revise_contract 1.2.17 contract.helloworld "function hello() chainhelper:log('Hello World!') chainhelper:log(date('%Y-%m-%dT%H:%M:%S', chainhelper:time())) end" true

revise_contract owner name contract_authority data broadcast

Result:

2.2.34 Call the contract

Command format
call_contract_function [username or ID] [contract name or contract ID] [function name] [value list] [broadcast (true/false)]
Example
call_contract_function 1.2.17 contract.helloworld [] true

call_contract_function account_id_or_name contract_id_or_name function_name value_list broadcast

Result:

2.2.35 List the account bounty amount

Command format
get_vesting_balances [username]
Example
get_vesting_balances official-account

get_vesting_balances account_name

Result:

2.2.36 Get the bounty (for witnesses only)

Command format
withdraw_vesting [witness name] [amount] [asset symbol] [broadcast (true/false)]
Example
withdraw_vesting cocos-witness-0 10 XXX true

withdraw_vesting(string witness_name, string amount, string asset_symbol, bool broadcast)

withdraw_vesting witness_name amount asset_symbol true

2.2.37 Vote for witnesses

Command format
vote_for_witness [username] [witness username] [agree or not] [broadcast (true/false)]
Example
vote_for_witness official-account cocos-witness-0 true true
Prerequisite steps

  1. Go to the directory where the command line wallet is located, and run the command ./cli_wallet-sws://127.0.0.1:8070-r127.0.0.1:8099 to log in to the wallet.
  2. Execute the command unlock xxxx to unlock the wallet
  3. Execute the import_key official-account 5KaVpJa9G4oqA5WHcSGitauFRuzdHcPVEAaESaA7jG8s to import user
  4. Execute the command import_balance official-account ["5KAUeN3Yv51FzpLGGf4S1ByKpMqVFNzXTyKpeuqc3"] true to import assets for users
  5. Execute the command vote_for_witness official-account cocos-witness-0 true true, the official-account will vote for the witness account cocos-witness-0
  6. Follow step 4 to vote for other witnesses
vote_for_witness official-account cocos-witness-0 true true

Result:

2.2.38 Vote for committee members

Command format
vote_for_committee_member [username] [witness username] [agree or not] [broadcast (true/false)]
Example
vote_for_committee_member official-account cocos-witness-0 true true
Prerequisite steps

  1. Go to the directory where the command line wallet is located, and run the command ./cli_wallet-sws://127.0.0.1:8070-r127.0.0.1:8099 to log in to the command line wallet
  2. Execute the command unlock xxxx to unlock the wallet
  3. Execute the import_key official-account 5KaVpJa9G4oqA5WHcSGitauFRuzdHcPVEAaESaA7jG8s to import user
  4. Execute the command import_balance official-account "5KAUeN3Yv51FzpLGGf4S1ByKpMqVFNzXTJK7euq"] true to import assets for users
  5. Execute the command vote_for_committee_member official-account Witness-0 true true, the official-account will vote for the witness account cocos-witness-0
  6. Follow step 4 to vote for other witnesses
vote_for_committee_member official-account cocos-witness-0 true true

Result:

2.2.39 Committee members propose to change the fee

Command format

  1. propose_fee_change [username] [deadline] [content] [broadcast (true/false)]
  2. approve_proposal [username] [proposal ID] [proposer username] [broadcast (true/false)]
    Example
  3. propose_fee_change Witness-0 "2018-07-24T06:55:40" {"transfer" : {"fee": 244000, "price_per_kbyte": 100000}} true
  4. approve_proposal Witness-0 1.10.0 {"active_approvals_to_add" : ["Witness-0"]} true
    Prerequisite steps
  5. Go to the directory where the command line wallet is located, and run the command ./cli_wallet-sws://127.0.0.1:8070-r127.0.0.1:8099 to log in to the command line wallet
  6. Execute the command unlock xxxx to unlock the wallet
  7. Execute the import_key Witness-0 5KaVpJa9G4oqA5WHcSGitauFRuzdHcPVEAaE to import user
  8. Execute the command propose_fee_change Witness-0 "2018-07-24T06:55:40" {"transfer" : {"fee": 244000, "price_per_kbyte": 100000}} true to propose to change the transfer fee
  9. Execute the command transfer official-account committee-account 100 XXX "" true to transfer to the user committee-account (the user is the proposed executor)
  10. Execute the command approve_proposal Witness-0 1.10.0 {"active_approvals_to_add" : ["Witness-0"]} true to approve the proposal (The executor of the proposal is the committee-account, and each committee member holds a certain active authority weight of the account according to the number of votes obtained by the committee member. Therefore, the proposal can be executed when the weight of the committee members who approve the proposal exceeds the threshold of the committee-account.)
  11. When the proposal is about to be expired, the system will automatically determine whether the proposal can be executed. If so, the proposal will be executed, and then the fee will be updated after the next maintenance.
propose_fee_change Witness-0 "2018-07-24T06:55:40" {"transfer" : {"fee": 244000, "price_per_kbyte": 100000}} true
approve_proposal Witness-0 1.10.0 {"active_approvals_to_add" : ["Witness-0"]} true

Result:

2.2.40 Committee members propose to change the global parameter of the chain

◼ Command format
propose_parameter_change [username] [deadline] [content] [broadcast (true/false)]
◼ Example
propose_parameter_change Witness-0 "2018-07-24T06:55:40" {"committee_proposal_review_period": 300} true
◼ Prerequisite steps

  1. Go to the directory where the command line wallet is located, and run the command ./cli_wallet-sws://127.0.0.1:8070-r127.0.0.1:8099 to log in to the command line wallet
  2. Execute the command unlock xxxx to unlock the wallet
  3. Execute the command import_key Witness-0 5KaVpJa9G4oqA5WHcSGitauFRuzdHcPVEAaE to import committee member user
  4. Execute the command prepare_parameter_change Witness-0 "2018-07-24T06:55:40" {"committee_proposal_review_period": 300} true to propose to change the committee proposed review period of the global parameter of the chain
  5. Execute the command transfer official-account committee-account 100 XXX "" true to transfer to the committee-account (the user is the proposed executor)
  6. Execute the command approve_proposal Witness-0 1.10.0 {"active_approvals_to_add" : ["Witness-0"]} true to approve the proposal (The executor of the proposal is committee-account, and each committee member holds a certain active authority weight of the account according to the number of votes obtained by the committee member. Therefore, the proposal can be executed when the weight of the committee members who approve the proposal exceeds the threshold of the committee-account.)
  7. When the proposal is about to be expired, the system will automatically determine whether the proposal can be executed. If so, the proposal will be executed, and then the fee will be updated after the next maintenance.
    ◼ Configurable parameter
    "block_interval"
    "maintenance_interval"
    "maintenance_skip_slots"
    "committee_proposal_review_period"
    "maximum_transaction_size"
    "maximum_block_size"
    "maximum_time_until_expiration"
    "maximum_proposal_lifetime"
    "maximum_asset_whitelist_authorities"
    "maximum_asset_feed_publishers"
    "maximum_witness_count"
    "maximum_committee_count"
    "maximum_authority_membership"
    "reserve_percent_of_fee"
    "network_percent_of_fee"
    "lifetime_referrer_percent_of_fee"
    "cashback_vesting_period_seconds"
    "cashback_vesting_threshold"
    "count_non_member_votes"
    "allow_non_member_whitelists"
    "witness_pay_per_block"
    "worker_budget_per_day"
    "max_predicate_opcode"
    "fee_liquidation_threshold"
    "accounts_per_fee_scale"
    "account_fee_scale_bitshifts"
    "max_authority_depth" One account can authorize another account. This parameter can be configured to be effective up to several layers downwards.
propose_parameter_change Witness-0 "2018-07-24T06:55:40" {"committee_proposal_review_period": 300} true

Result:

2.2 cli_wallet


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.