Get
Get
Description The subcommands can be used to retrieve various items and information from the blockchain.
Subcommands
Abi — Retrieve the ABI for an account.
Account — Retrieve an account from the blockchain.
Accounts — Retrieve accounts associated with a public key.
Actions — Retrieve all actions with specific account name referenced in authorization or receiver.
Block — Retrieve a full block from the blockchain.
Code — Retrieve the code and ABI for an account.
Currency Balance — Retrieve the balance of an account for a given currency.
Currency Stats — Retrieve the stats of for a given currency.
Info — Get current blockchain information.
Schedule — Retrieve the producer schedule.
Scope — Retrieve a list of scopes and tables owned by a contract.
Servants — Retrieve accounts which are servants of a given account.
Table — Retrieve the contents of a database table.
Transaction — Retrieve a transaction from the blockchain.
Transaction ID — Get transaction id given transaction object.
Abi
Description
The subcommand retrieves the ABI for an account.
Positional Parameters
(string) name
— The name of the account whose abi should be retrieved (required).
Options
-f
,--file
TEXT — The name of the file to save the contract .abi to instead of writing to console.
Command
$ cleos get abi [OPTIONS] <name>
Examples
Retrieve and save abi for cyber.stake contract.
$ cleos get abi cyber.stake -f cyber.stake.abi
saving abi to cyber.stake.abi
Account
Description
The subcommand retrieves an account from the blockchain.
Positional Parameters
(string) name
— The name of the account to retrieve (required).(string) core-symbol
— The expected core symbol of the chain you are querying.
Options
--json
,-j
— Output in JSON format.
Command
$ cleos get account [OPTIONS] <name> [<core-symbol>]
Examples
Get formatted data for user cyberio.
$ cleos get account cyberio
Get JSON data for user cyberio.
$ cleos get account cyberio --json
Accounts
Description
The subcommand retrieves accounts associated with a public key.
Positional Parameters
(string) public_key
— The public key to retrieve accounts for (required).
Options
--json
,-j
— Output in JSON format.
Command
$ cleos get accounts [OPTIONS] <public_key>
Examples
$ cleos get accounts GLS7w...NuSPAfXJHAhWt
{
"account_names": [
"testaccount"
]
}
Actions
Description
The subcommand retrieves all actions with specific account name referenced in authorization or receiver.
Positional Parameters
(string) account_name
— Name of account to query on (required).(int_32) pos
— Sequence number of action for this account, -1 for last.(int_32) offset
— Get actions[pos, pos + offset]
for positive offset or[pos - offset, pos]
for negative offset.
Options
-j
,--json
— Print full json.--full
— Do not truncate action output.--pretty
— Pretty print full action json.--console
— Print console output generated by action.
Command
$ cleos get actions [OPTIONS] <account_name> [<pos>] [<offset>]
Examples
Retrieve and save abi for cyber.token contract.
$ cleos get actions cyber.token
# seq when contract::action => receiver trx id... args
================================================================================================================
# 1101 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token a3fgh5f4... {"from":"userae","to":"useraa","quantity":"0.000...
# 1102 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token rt48fhrh... {"from":"userab","to":"useraa","quantity":"0.000...
# 1103 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token 6gg093dg... {"from":"userab","to":"userah","quantity":"0.000...
# 1104 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token 2ws8d55t... {"from":"userai","to":"useraj","quantity":"0.000...
...
Block
Description
The subcommand retrieves a full block from the blockchain.
Positional Parameters
(string) block
— The number or ID of the block to retrieve (required).
Options
--header-state
— Get block header state from fork database instead.
Command
$ cleos get block [OPTIONS] <block>
Examples
$ cleos get block 7315
or
$ cleos get block 0000...5ye0ort10e
Result output is a block object similar to the following
{
"timestamp": "2020-02-02T10:38:32.000",
"producer": "",
"confirmed": 21,
"previous": "006...9bd",
"transaction_mroot": "1434...d09",
"action_mroot": "dea...469",
"schedule_version": 59218,
"new_producers": null,
"header_extensions": [],
"producer_signature": "SIG_K1_J...eR",
"transactions": [],
"block_extensions": [],
"id": "006...58f22d10",
"block_num": 7315,
"ref_block_prefix": 744221143
}
Code
Description
The subcommand retrieves the code and ABI for an account
Positional Parameters
(string) name
— The name of the account whose code should be retrieved (required).
Options
-c
,--code
TEXT — The name of the file to save the contract .wast to.-a
,--abi
TEXT — The name of the file to save the contract .abi to.--wasm
— Save contract as wasm.
Command
$ cleos get code [OPTIONS] <name>
Examples
Simply output the hash of cyber.token contract
$ cleos get code cyber.token
code hash: 3eadff2...0d002
Retrieve and save abi for cyber.token contract.
$ cleos get code cyber.token -a cyber.token.abi
code hash: 3eadff2...0d002
saving abi to cyber.token.abi
Retrieve and save wast code for cyber.token contract.
$ cleos get code cyber.token -c cyber.token.wast
code hash: 3eadff2...0d002
saving wast to cyber.token.wast
Currency Balance
Description
The subcommand retrieves the balance of an account for a given currency.
Positional Parameters
(string) contract
— The contract that operates the currency (required).(string) account
— The account to query balances for (required).(string) symbol
— The symbol for the currency if the contract operates multiple currencies.
Options
No options required for this subcomand.
Command
$ cleos get balance <contract> <account> [<symbol>]
Examples
Get balance of eosio from cyber.token contract for SYS symbol.
$ cleos get currency balance cyber.token cyberio SYS
10000.0000 SYS
Currency Stats
Description
The subcommand retrieves the stats of for a given currency.
Positional Parameters
(string) contract
— The contract that operates the currency (required).(string) symbol
— The symbol for the currency if the contract operates multiple currencies (required).
Options
No options required for this subcomand.
Command
$ cleos get stats <contract> <symbol>
Examples
Get stats of the SYS token from the cyber.token contract.
$ cleos get currency stats eosio.token SYS
{
"SYS": {
"supply": "10000.0000 SYS",
"max_supply": "100000.0000 SYS",
"issuer": "cyberio"
}
}
Info
Description
The subcommand gets current blockchain information.
Positional Parameters
No parameters required for this subcommand.
Options
No options required for this subcommand.
Command
$ cleos get info
Examples
This subcommand returns the current blockchain state information.
$ cleos get info
{
"server_version": "5ad0",
"head_block_num": 7342,
"last_irreversible_block_num": 7325,
"head_block_id": "006...58f2442",
"head_block_time": "2020-02-02T17:23:40",
"head_block_producer": "zaheader",
"recent_slots": "111...111",
"participation_rate": "1.00000000000000000"
}
Schedule
Description
The subcommand retrieves the producer schedule.
Positional Parameters
No parameters required for this subcommand.
Options
-j
,--json
— Output in JSON format.
Command
$ cleos get schedule [OPTIONS]
Examples
This subcommand returns the current producer schedule.
$ cleos get schedule
active schedule version 0
Producer Producer key
============= ==================
cyberio GLS7w...NuSPAfXJHAhWt
pending schedule empty
proposed schedule empty
Scope
Description
The subcommand retrieves a list of scopes and tables owned by a contract
Positional Parameters
(string) contract
— The contract who owns the table (required).
Options
-t
,--table
TEXT — The name of the table as filter.-l
,--limit
UINT — The maximum number of rows to return.-L
,--lower
TEXT — Lower bound of scope.-U
,--upper
TEXT — Upper bound of scope.-r
,--reverse
— Iterate in reverse order.
Command
$ cleos get scope [OPTIONS] <contract>
Servants
Description
The subcommand retrieves accounts which are servants of a given account.
Positional Parameters
(string) account
— The name of the controlling account (required).
Options
No options required for this subcommand.
Command
$ cleos get servants <account>
Examples
$ cleos get servants alice
Output
{
"controlling_account": [
"alice"
]
}
Table
Description
The subcommand retrieves the contents of a database table.
Positional Parameters
(string) account
— The account who owns the table (required).(string) scope
— The scope within the contract in which the table is found (required).(string) table
— The name of the table as specified by the contract abi (required).
Options
--index
— Index name. The same as in abi decription. If not set the index name will be primary.-b
,--binary
— Return the value as BINARY rather than using abi to interpret as JSON.-l
,--limit
— The maximum number of rows to return.-k
,--key
— Deprecated.-L
,--lower
— JSON representation of lower bound value of key, defaults to first.-U
,--upper
— JSON representation of upper bound value of key, defaults to last.--key-type
— Deprecated.--encode-type
— The encoding type of key_type (i64 , i128 , float64, float128) only support decimal encoding (e.g. 'dec'). i256 - supports both 'dec' and 'hex', ripemd160 and sha256 is 'hex' only.-r
,--reverse
— Iterate in reverse order.--show-payer
— show RAM payer.
Command
$ cleos get table [OPTIONS] <account> <scope> <table>
Examples
Get the data from the accounts table for the cyber.token contract, for user cyberio.
$ cleos get table cyber.token cyberio accounts
Transaction
Description
The subcommand retrieves a transaction from the blockchain.
Positional Parameters
(string) id
— ID of the transaction to retrieve (required).
Options
-b
,--block-hint
UINT — The block number this transaction may be in.
Command
$ cleos get transaction [OPTIONS] <id>
Examples
$ cleos get transaction w234b9...dd76brt5
Transaction ID
Description
The subcommand gets transaction id given transaction object.
Positional Parameters
(string) transaction
— The JSON string or filename defining the transaction which transaction ID will be retrieved (required).
Options
No options required for this subcommand.
Command
$ cleos get transaction_id <transaction>
Last updated