Skip to content

Telos: command reference

Douglas Horn edited this page Dec 7, 2018 · 82 revisions

The intent of this document is to act as a reference for anyone who needs to query the Telos blockchain; most commonly Telos Block Producers, Developers, and Exchanges. This is by no means an exhaustive list, it simply contains useful commands that have been shared by the Telos community. We hope the Telos community will continue to share additional commands over time, which we’ll include here.

For the most part, Telos commands echo those of their counterparts in eosio. The chart below identifies the eosio core programs, their purpose, and their Telos counterparts:

eosio Telos Description
cleos teclos Command line interface to interact with the blockchain and to manage wallets
keosd keosd Component that securely stores keys in wallets
nodeos nodeos Core node daemon for running a node

The eosio command reference is a wealth of information, and can be found here: https://developers.eos.io/eosio-home/docs

Note: In the remote command examples below, we’ve included the sample URL (http://api.blockproducer.io:8888) so as to display the proper command syntax. This is not a valid URL, and is meant to be replaced with the URL of a publicly available Telos API endpoint. You can get a list of valid URLs here: http://testnet.telosfoundation.io/p2p

When referencing a Telos account in a command, we’ve used the example account: blockproducr. As with the URL value, you’ll need to replace this value with a valid account name.

Any values enclosed in square brackets are placeholders, ie: [block number]- and need to be replaced.

Table of Contents:

Accounts:

Get account info from local instance:

teclos get account blockproducr

Associated help command:

teclos get account --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-get-account

Get account info remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 get account blockproducr

Get account info remotely by calling an external API node using curl:

curl http://api.blockproducer.io:8888/v1/chain/get_account -X POST -d '{"account_name":"blockproducr"}'

Create new account (requires existing account’s keys to be in wallet prior to creation. Requires 2 keys, owner + active):

teclos system newaccount --stake-net "10.0000 TLOS" --stake-cpu "10.0000 TLOS" --buy-ram-kbytes 8 blockproducr newaccount (newly generated -->) OwnerKey [ActiveKey]

Associated help command:

teclos system newaccount --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-newaccount

Change “active” account key:

teclos set account permission blockproducr active '{"threshold": 1, "keys": [{"key": "PUBLICKEY", "weight": 1}],"weight":1}]}' owner

Associated help command:

teclos set account permission --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-set-account

Check account balance locally:

teclos get currency balance eosio.token blockprodcer

Associated help command:

teclos get currency --help

Reference: https://developers.eos.io/eosio-cleos/reference#currency-balance

Check account balance remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 get currency balance eosio.token blockprodcer

Get Info:

Get info from local instance:

teclos get info

Associated help command:

teclos get info --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-get-info

Get info about a block:

teclos get block [block number]

Associated help command:

teclos get block --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-get-block


Get Producers:

Get producers (format output in json):

teclos system listproducers -j

Associated help command:

teclos system listproducers --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-listproducers

Get producers remotely (format output in json):

teclos -u http://api.blockproducer.io:8888 system listproducers -j

Show the entire producers table:

teclos get table eosio eosio producers

Associated help command:

teclos get table eosio eosio --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-get-table

Query the producers table for a specific producer:

teclos get table eosio eosio producers -l 150 | grep blockproducr -A 8

Query the producers table for a specific producer remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 get table eosio eosio producers -l 150 | grep blockprodcer -A 8

Register Producer:

Register producer locally:

teclos system regproducer blockproducr [producer public key] [url] [location] 

Associated help command:

teclos system regproducer --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-regproducer

Register producer remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 system regproducer blockproducr [producer public key] [url] [location]

Unregister Producer:

Unregister producer locally:

teclos system unregprod blockproducr 

Associated help command:

teclos system unregprod --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-unregprod

Unregister producer remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 system unregprod blockproducr

Voting:

To cast a vote for block producer(s) locally:

teclos system voteproducer prods blockproducr producer1 producer2 producer3 producer4

To cast a vote for block producer(s) remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 system voteproducer prods blockproducr producer1 producer2 producer3 producer4

Associated help command:

teclos system voteproducer prods --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-voteproducer

Staking:

To stake resources to an account locally:

teclos system delegatebw blockproducr accountname2 "10.0000 TLOS" "10.0000 TLOS"

To stake resources to an account remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 system delegatebw accountname1 accountname2 "10.0000 TLOS" "10.0000 TLOS"

Associated help command:

teclos system delegatebw --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-delegatebw

To unstake resources from an account locally:

teclos system undelegatebw accountname1 accountname2 "10.0000 TLOS" "10.0000 TLOS"

To unstake resources from an account remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 system undelegatebw blockproducr accountname2 "10.0000 TLOS" "10.0000 TLOS"

Associated help command:

teclos system undelegatebw --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-system-undelegatebw


Transfers:

To transfer tokens to another account locally:

teclos transfer blockproducr accountname2 "10.0000 TLOS" "add an optional message here"

To transfer tokens to another account remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 transfer blockproducr accountname2 "10.0000 TLOS" "add an optional message here"

Associated help command:

teclos transfer --help

Reference: https://developers.eos.io/eosio-cleos/reference#cleos-transfer


The Schedule:

The schedule is an ordered list of BPs that gets calculated and written to the chain every minute (1 block/0.5 secs, 120 blocks/minute). Producers are arranged in order based on # of votes they have received.

  • Schedule rotations: 1 of the top 21 BPs are randomly swapped out, while 1 of the standby BPs are randomly swapped in every 6 hrs to validate their readiness.
  • The proposed schedule won't become the active one until the block it was proposed in becomes irreversible, hence needing the LIB to move so the new schedule can take affect.
  • Once the block that contains the proposal becomes irreversible, the schedule is promoted to "pending" automatically. Once the block that promotes the schedule is irreversible, the schedule will become "active"

Get active schedule:

teclos get schedule

Associated help command:

teclos get schedule --help

Get active schedule remotely by calling an external API node:

teclos -u http://api.blockproducer.io:8888 get schedule

Show the rotations table:

teclos get table eosio eosio rotations

Logs:

Logs are a wealth of information. Typically applications chronologically record, or “log” their events in log files. By default, nodeos logs it’s output to the file “stderr.txt.” While the name and location of this file can be customized, the examples here assume you’re using the default configuration.

Parse the last 1000 lines of the logs to show active BPs, and how many blocks they produced in that time, by searching for the “signed by” flag:

tail -n 1000 stderr.txt | grep "signed by" | awk '{ print $14 }' | sort | uniq -c

Parse the last 1000 lines of the logs to show active BPs, and how many blocks they produced in that time, by searching for the “on_incoming” flag:

tail -n 1000 stderr.txt | grep on_incoming | awk '{ print $14 }' | sort | uniq -c

List producers for the last 1000 blocks:

grep on_incoming_block stderr.txt | tail -1000 | awk '{ print $14 }' | sort | uniq -c

Search for dead p2p endpoints, searching for the “Connection refused” flag:

grep "Connection refused" stderr.txt | cut -d "]" -f 2 | cut -d" " -f 5 | sort | uniq -c

Get the blocks and block numbers produced in the last 1000 lines searching for the “produce_block” flag (will only be present if a producing node):

tail -n 1000 stderr.txt | grep produce_block | cut -d "]" -f 2 | cut -d" " -f 5 | sort | uniq -c

Search for internode latency:

grep on_incoming_block stderr.txt  | awk '{ latency[$14] += $22; latencyCnt[$14] += 1 } END { for (key in latency) { print key, latency[key] / latencyCnt[key]} }' | sort -nr -k2

grep on_incoming_block stderr.txt  | awk '{ latency[$14] += $22; latencyCnt[$14] += 1 } END { for (key in latency) { printf("%s %d %d %f\n", key, latency[key], latencyCnt[key], latency[key] / latencyCnt[key])} }' | sort -nr -k4

Search for possible forking:

grep -B1 switching stderr.txt  | grep signed | cut -d"@" - f 2 | cut -d" " -f 5 | sort | uniq -c | sort -nr

Additional commands:

Query remote API endpoint for chain’s expected memory allocation:

teclos -u http://api.blockproducer.io:8888 get table eosio eosio global | grep max_ram_size
You can’t perform that action at this time.