Documentation
Search…
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

1
$ cleos get abi [OPTIONS] <name>
Copied!

Examples

Retrieve and save abi for cyber.stake contract.
1
$ cleos get abi cyber.stake -f cyber.stake.abi
Copied!
1
saving abi to cyber.stake.abi
Copied!

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

1
$ cleos get account [OPTIONS] <name> [<core-symbol>]
Copied!

Examples

Get formatted data for user cyberio.
1
$ cleos get account cyberio
Copied!
Get JSON data for user cyberio.
1
$ cleos get account cyberio --json
Copied!

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

1
$ cleos get accounts [OPTIONS] <public_key>
Copied!

Examples

1
$ cleos get accounts GLS7w...NuSPAfXJHAhWt
2
{
3
"account_names": [
4
"testaccount"
5
]
6
}
Copied!

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

1
$ cleos get actions [OPTIONS] <account_name> [<pos>] [<offset>]
Copied!

Examples

Retrieve and save abi for cyber.token contract.
1
$ cleos get actions cyber.token
Copied!
1
# seq when contract::action => receiver trx id... args
2
================================================================================================================
3
# 1101 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token a3fgh5f4... {"from":"userae","to":"useraa","quantity":"0.000...
4
# 1102 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token rt48fhrh... {"from":"userab","to":"useraa","quantity":"0.000...
5
# 1103 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token 6gg093dg... {"from":"userab","to":"userah","quantity":"0.000...
6
# 1104 2020-02-02T10:34:01.000 cyber.token::transfer => cyber.token 2ws8d55t... {"from":"userai","to":"useraj","quantity":"0.000...
7
...
Copied!

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

1
$ cleos get block [OPTIONS] <block>
Copied!

Examples

1
$ cleos get block 7315
Copied!
or
1
$ cleos get block 0000...5ye0ort10e
Copied!
Result output is a block object similar to the following
1
{
2
"timestamp": "2020-02-02T10:38:32.000",
3
"producer": "",
4
"confirmed": 21,
5
"previous": "006...9bd",
6
"transaction_mroot": "1434...d09",
7
"action_mroot": "dea...469",
8
"schedule_version": 59218,
9
"new_producers": null,
10
"header_extensions": [],
11
"producer_signature": "SIG_K1_J...eR",
12
"transactions": [],
13
"block_extensions": [],
14
"id": "006...58f22d10",
15
"block_num": 7315,
16
"ref_block_prefix": 744221143
17
}
Copied!

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

1
$ cleos get code [OPTIONS] <name>
Copied!

Examples

Simply output the hash of cyber.token contract
1
$ cleos get code cyber.token
Copied!
1
code hash: 3eadff2...0d002
Copied!
Retrieve and save abi for cyber.token contract.
1
$ cleos get code cyber.token -a cyber.token.abi
Copied!
1
code hash: 3eadff2...0d002
2
saving abi to cyber.token.abi
Copied!
Retrieve and save wast code for cyber.token contract.
1
$ cleos get code cyber.token -c cyber.token.wast
Copied!
1
code hash: 3eadff2...0d002
2
saving wast to cyber.token.wast
Copied!

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

1
$ cleos get balance <contract> <account> [<symbol>]
Copied!

Examples

Get balance of eosio from cyber.token contract for SYS symbol.
1
$ cleos get currency balance cyber.token cyberio SYS
Copied!
1
10000.0000 SYS
Copied!

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

1
$ cleos get stats <contract> <symbol>
Copied!

Examples

Get stats of the SYS token from the cyber.token contract.
1
$ cleos get currency stats eosio.token SYS
Copied!
1
{
2
"SYS": {
3
"supply": "10000.0000 SYS",
4
"max_supply": "100000.0000 SYS",
5
"issuer": "cyberio"
6
}
7
}
Copied!

Info

Description

The subcommand gets current blockchain information.

Positional Parameters

No parameters required for this subcommand.

Options

No options required for this subcommand.

Command

1
$ cleos get info
Copied!

Examples

This subcommand returns the current blockchain state information.
1
$ cleos get info
Copied!
1
{
2
"server_version": "5ad0",
3
"head_block_num": 7342,
4
"last_irreversible_block_num": 7325,
5
"head_block_id": "006...58f2442",
6
"head_block_time": "2020-02-02T17:23:40",
7
"head_block_producer": "zaheader",
8
"recent_slots": "111...111",
9
"participation_rate": "1.00000000000000000"
10
}
Copied!

Schedule

Description

The subcommand retrieves the producer schedule.

Positional Parameters

No parameters required for this subcommand.

Options

  • -j, --json — Output in JSON format.

Command

1
$ cleos get schedule [OPTIONS]
Copied!

Examples

This subcommand returns the current producer schedule.
1
$ cleos get schedule
Copied!
1
active schedule version 0
2
Producer Producer key
3
============= ==================
4
cyberio GLS7w...NuSPAfXJHAhWt
5
6
pending schedule empty
7
8
proposed schedule empty
Copied!

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

1
$ cleos get scope [OPTIONS] <contract>
Copied!

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

1
$ cleos get servants <account>
Copied!

Examples

1
$ cleos get servants alice
Copied!
Output
1
{
2
"controlling_account": [
3
"alice"
4
]
5
}
Copied!

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

1
$ cleos get table [OPTIONS] <account> <scope> <table>
Copied!

Examples

Get the data from the accounts table for the cyber.token contract, for user cyberio.
1
$ cleos get table cyber.token cyberio accounts
Copied!

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

1
$ cleos get transaction [OPTIONS] <id>
Copied!

Examples

1
$ cleos get transaction w234b9...dd76brt5
Copied!

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

1
$ cleos get transaction_id <transaction>
Copied!
Last modified 1yr ago