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.
The subcommand retrieves the ABI for an account.
(string) name— The name of the account whose abi should be retrieved (required).
-f,--fileTEXT — The name of the file to save the contract .abi to instead of writing to console.
$ cleos get abi [OPTIONS] <name>Retrieve and save abi for cyber.stake contract.
$ cleos get abi cyber.stake -f cyber.stake.abisaving abi to cyber.stake.abi
The subcommand retrieves an account from the blockchain.
(string) name— The name of the account to retrieve (required).(string) core-symbol— The expected core symbol of the chain you are querying.
--json,-j— Output in JSON format.
$ cleos get account [OPTIONS] <name> [<core-symbol>]Get formatted data for user cyberio.
$ cleos get account cyberioGet JSON data for user cyberio.
$ cleos get account cyberio --jsonThe subcommand retrieves accounts associated with a public key.
(string) public_key— The public key to retrieve accounts for (required).
--json,-j— Output in JSON format.
$ cleos get accounts [OPTIONS] <public_key>$ cleos get accounts GLS7w...NuSPAfXJHAhWt
{
"account_names": [
"testaccount"
]
}The subcommand retrieves all actions with specific account name referenced in authorization or receiver.
(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.
-j,--json— Print full json.--full— Do not truncate action output.--pretty— Pretty print full action json.--console— Print console output generated by action.
$ cleos get actions [OPTIONS] <account_name> [<pos>] [<offset>]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...
...
The subcommand retrieves a full block from the blockchain.
(string) block— The number or ID of the block to retrieve (required).
--header-state— Get block header state from fork database instead.
$ cleos get block [OPTIONS] <block>$ cleos get block 7315or
$ cleos get block 0000...5ye0ort10eResult 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
}
The subcommand retrieves the code and ABI for an account
(string) name— The name of the account whose code should be retrieved (required).
-c,--codeTEXT — The name of the file to save the contract .wast to.-a,--abiTEXT — The name of the file to save the contract .abi to.--wasm— Save contract as wasm.
$ cleos get code [OPTIONS] <name>Simply output the hash of cyber.token contract
$ cleos get code cyber.tokencode hash: 3eadff2...0d002
Retrieve and save abi for cyber.token contract.
$ cleos get code cyber.token -a cyber.token.abicode 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.wastcode hash: 3eadff2...0d002
saving wast to cyber.token.wast
The subcommand retrieves the balance of an account for a given currency.
(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.
No options required for this subcomand.
$ cleos get balance <contract> <account> [<symbol>]Get balance of eosio from cyber.token contract for SYS symbol.
$ cleos get currency balance cyber.token cyberio SYS 10000.0000 SYS
The subcommand retrieves the stats of for a given currency.
(string) contract— The contract that operates the currency (required).(string) symbol— The symbol for the currency if the contract operates multiple currencies (required).
No options required for this subcomand.
$ cleos get stats <contract> <symbol> 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"
}
}
The subcommand gets current blockchain information.
No parameters required for this subcommand.
No options required for this subcommand.
$ cleos get infoThis 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"
}
The subcommand retrieves the producer schedule.
No parameters required for this subcommand.
-j,--json— Output in JSON format.
$ cleos get schedule [OPTIONS]This subcommand returns the current producer schedule.
$ cleos get scheduleactive schedule version 0
Producer Producer key
============= ==================
cyberio GLS7w...NuSPAfXJHAhWt
pending schedule empty
proposed schedule empty
The subcommand retrieves a list of scopes and tables owned by a contract
(string) contract— The contract who owns the table (required).
-t,--tableTEXT — The name of the table as filter.-l,--limitUINT — The maximum number of rows to return.-L,--lowerTEXT — Lower bound of scope.-U,--upperTEXT — Upper bound of scope.-r,--reverse— Iterate in reverse order.
$ cleos get scope [OPTIONS] <contract>The subcommand retrieves accounts which are servants of a given account.
(string) account— The name of the controlling account (required).
No options required for this subcommand.
$ cleos get servants <account>$ cleos get servants aliceOutput
{
"controlling_account": [
"alice"
]
}
The subcommand retrieves the contents of a database table.
(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).
--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.
$ cleos get table [OPTIONS] <account> <scope> <table>Get the data from the accounts table for the cyber.token contract, for user cyberio.
$ cleos get table cyber.token cyberio accounts
The subcommand retrieves a transaction from the blockchain.
(string) id— ID of the transaction to retrieve (required).
-b,--block-hintUINT — The block number this transaction may be in.
$ cleos get transaction [OPTIONS] <id>$ cleos get transaction w234b9...dd76brt5The subcommand gets transaction id given transaction object.
(string) transaction— The JSON string or filename defining the transaction which transaction ID will be retrieved (required).
No options required for this subcommand.
$ cleos get transaction_id <transaction>