Stratos-chain 'stchaind' Commands

This document describes a summarized list of `stchaind` commands for Stratos Chain.

Overview

Hardware and Software Requirements

Unlike other projects, Stratos does not require expensive GPUs and high wattage power supplies, but if the node wants to obtain revenue, it needs to provide enough bandwidth and storage capacity to ensure the traffic on the node can reach the reward requirements. We recommend the following to run your node:

* CPU i5 4 cores
* 16GB memory
* 2TB hard disk
* 100M bandwidth

Software(tested version):

* Ubuntu 18.04+
* Go 1.16+ linux/amd64 (optional, if compile the binary with source code)

Get Connected to Stratos Chain Testnet

Please refer to stratos-chain-testnet to

Directory Structure

After the node has caught up to the latest block, your Stratos-chain Wallet has been created and fed with an amount of tokens, the $HOME directory should include the following directories and files.

.
├── ...
├── .stchaincli
├── stchaincli
├── .stchaind
├── stchaind
├── ...

By default, the two binary executable files stchaincli and stchaind as well as two directories .stchaincl and .stchaind have been saved or created in the $HOME folder. If you are not sure what is your$HOMEfolder, in terminal, use 'echo $HOME' to check. In the following instruction, we suppose you have entered the $HOMEfolder

$ echo $HOME
/home/<your login username>

.stchaincli contains the folder keyring-test-cosmos, which holds the wallet info and wallet address

.
└── keyring-test-cosmos
    ├── st14a2h6ldd947c52j796u66ywrfuvkk6mxvq3vdw.address
    └── wallet1.info

.stchaind contains config and data folders.

.
├── config
   ├── addrbook.json
   ├── app.toml
   ├── config.toml
   ├── genesis.json
   ├── node_key.json
   └── priv_validator_key.json
└── data
    ├── application.db
    ├── blockstore.db
    ├── cs.wal
    ├── evidence.db
    ├── priv_validator_state.json
    ├── state.db
    └── tx_index.db

In config folder:

  • addrbook.json stores peer addresses.

  • app.toml contains the default settings required for app.

  • config.toml contains various options pertaining to the stratos-chain configurations.

  • genesis.json defines the initial state upon genesis of stratos-chain.

  • node_key.json contains the node private key and should thus be kept secret.

  • priv_validator_key.json contains the validator address, public key and private key, and should thus be kept secret.

In data folder:

  • All *.db folders are Tendermint databases

  • Tendermint uses a write ahead log (WAL) for consensus

  • priv_validator_state.jsonholds the validator's state

'stchaind' Commands

Global Flags

Each command has its specific flags as well as several global flags. The specific flags will be explained along with each command, while the global flags are summarized as the following that can be used for all stchaind commands.

Global Flags (can be used for all `stchaind` commands):
      --home string             directory for config and data (default "$HOME/.stchaind")
      --inv-check-period uint   Assert registered invariants every N blocks
      --log_level string        Log level (default "main:info,state:info,*:error")
      --trace                   print out full stack trace on errors

--chain-id the current chain-id may change when updating in testing phase . When it is applied, user needs to point out current chain-id which can be found on this page, right next to the search bar at the top of the page.

--home is the directory containing a node's configurations and data. By default, node's account info is saved or created under $HOME/.stchaind. In this case, user does not need to add --home flag in the commands. Otherwise, user has to use this flag to specify the path to the node's root directory(default '$HOME') explicitly if not using the default directory. In the following instruction, we suppose the node's configurations and data have been installed or created under $HOME/.stchaind and skip the --home flag. User can add it where applicable.

debug

Tool for helping with debugging your application.

Usage:
  stchaind debug [flags]
  stchaind debug [command]

Available Commands:
  pubkey      Decode a ED25519 pubkey from hex, base64, or bech32
  addr        Convert an address between hex and bech32
  raw-bytes   Convert raw bytes output (eg. [10 21 13 255]) to hex

Flags:
  -h, --help   help for debug

pubkey

Decode a pubkey from hex, base64, or bech32.

Usage:
  stchaind debug pubkey <pubkey> [flags]

Flags:
  -h, --help   help for pubkey

pubkey command:

stchaind debug pubkey <pubkey, in hex>

Example::

$ ./stchaind debug pubkey hN3zeGx6LkZcq9lKL+YlakpZLPfGHLPJo2SgrQgDFcs=                                            
   Address: 8768780A615692B07081314B502B3C18340244EB
   Hex: 84DDF3786C7A2E465CABD94A2FE6256A4A592CF7C61CB3C9A364A0AD080315CB
   JSON (base64): {"type":"tendermint/PubKeyEd25519","value":"hN3zeGx6LkZcq9lKL+YlakpZLPfGHLPJo2SgrQgDFcs="}
   Bech32 Acc: stpub1zcjduepqsnwlx7rv0ghyvh9tm99zle39df99jt8hccwt8jdrvjs26zqrzh9smpzk9w
   Bech32 Validator Operator: stvaloperpub1zcjduepqsnwlx7rv0ghyvh9tm99zle39df99jt8hccwt8jdrvjs26zqrzh9s68uwts
   Bech32 Validator Consensus: stvalconspub1zcjduepqsnwlx7rv0ghyvh9tm99zle39df99jt8hccwt8jdrvjs26zqrzh9shdmgyc

addr

Convert an address between hex encoding and bech32.

Usage:
  stchaind debug addr <address> [flags]

Flags:
  -h, --help   help for addr

addr command:

stchaind debug addr <wallet address>

Example:

$ ./stchaind debug addr st1fmdh9vf262qxe5ehmp9jvgkqzaeye4qm372rda
   Address: [78 219 114 177 42 210 128 108 211 55 216 75 38 34 192 23 114 76 212 27]
   Address (hex): 4EDB72B12AD2806CD337D84B2622C017724CD41B
   Bech32 Acc: st1fmdh9vf262qxe5ehmp9jvgkqzaeye4qm372rda
   Bech32 Val: stvaloper1fmdh9vf262qxe5ehmp9jvgkqzaeye4qmxjrr3k

raw-bytes

Convert raw-bytes to hex.

Usage:
  stchaind debug raw-bytes <raw-bytes> [flags]

Flags:
  -h, --help   help for raw-bytes

raw-bytes command:

stchaind debug raw-bytes <byte list>

Example:

$ ./stchaind debug raw-bytes '[78 219 114 177 42 210 128 108 211 55 216 75 38 34 192 23 114 76 212 27]'
   4EDB72B12AD2806CD337D84B2622C017724CD41B

export

Export state to JSON.

Usage:
  stchaind export [flags]

Flags:
      --for-zero-height          Export state to start at height zero (perform preproccessing)
      --height int               Export state from a particular height (-1 means latest height) (default -1)
  -h, --help                     help for export
      --jail-whitelist strings   List of validators to not jail state export

export command:

stchaind export > <file path>

Example:

stchaind export > dump.json

version

Print the app version.

Usage:
  stchaind version [flags]

Flags:
  -h, --help   help for version
      --long   Print long version information

version command:

stchaind version

Example:

$ ./stchaind version
  v0.3.0

start

Run the full node application with Tendermint in or out of process. By default, the application will run with Tendermint in process.

Usage:
  stchaind start [flags]

Flags:
      --abci string                                     Specify abci transport (socket | grpc) (default "socket")
      --address string                                  Listen address (default "tcp://0.0.0.0:26658")
      --consensus.create_empty_blocks                   Set this to false to only produce blocks when there are txs or when the AppHash changes (default true)
      --consensus.create_empty_blocks_interval string   The possible interval between empty blocks (default "0s")
      --cpu-profile string                              Enable CPU profiling and write to the provided file
      --db_backend string                               Database backend: goleveldb | cleveldb | boltdb | rocksdb (default "goleveldb")
      --db_dir string                                   Database directory (default "data")
      --fast_sync                                       Fast blockchain syncing (default true)
      --genesis_hash bytesHex                           Optional SHA-256 hash of the genesis file
      --halt-height uint                                Block height at which to gracefully halt the chain and shutdown the node
      --halt-time uint                                  Minimum block time (in Unix seconds) at which to gracefully halt the chain and shutdown the node
  -h, --help                                            help for start
      --inter-block-cache                               Enable inter-block caching (default true)
      --minimum-gas-prices string                       Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01photino;0.0001stake)
      --moniker string                                  Node Name (default "ubuntu")
      --p2p.laddr string                                Node listen address. (0.0.0.0:0 means any interface, any port) (default "tcp://0.0.0.0:26656")
      --p2p.persistent_peers string                     Comma-delimited ID@host:port persistent peers
      --p2p.pex                                         Enable/disable Peer-Exchange (default true)
      --p2p.private_peer_ids string                     Comma-delimited private peer IDs
      --p2p.seed_mode                                   Enable/disable seed mode
      --p2p.seeds string                                Comma-delimited ID@host:port seed nodes
      --p2p.unconditional_peer_ids string               Comma-delimited IDs of unconditional peers
      --p2p.upnp                                        Enable/disable UPNP port forwarding
      --priv_validator_laddr string                     Socket address to listen on for connections from external priv_validator process
      --proxy_app string                                Proxy app address, or one of: 'kvstore', 'persistent_kvstore', 'counter', 'counter_serial' or 'noop' for local testing. (default "tcp://127.0.0.1:26658")
      --pruning string                                  Pruning strategy (default|nothing|everything|custom) (default "default")
      --pruning-interval uint                           Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom')
      --pruning-keep-every uint                         Offset heights to keep on disk after 'keep-every' (ignored if pruning is not 'custom')
      --pruning-keep-recent uint                        Number of recent heights to keep on disk (ignored if pruning is not 'custom')
      --rpc.grpc_laddr string                           GRPC listen address (BroadcastTx only). Port required
      --rpc.laddr string                                RPC listen address. Port required (default "tcp://127.0.0.1:26657")
      --rpc.unsafe                                      Enabled unsafe rpc methods
      --trace-store string                              Enable KVStore tracing to an output file
      --unsafe-skip-upgrades ints                       Skip a set of upgrade heights to continue the old binary
      --with-tendermint                                 Run abci app embedded in-process with tendermint (default true)

start command:

stchaind start

Example:

$ ./stchaind start
I[2021-12-10|15:02:02.131] starting ABCI with Tendermint                module=main 
I[2021-12-10|15:02:07.161] Executed block                               module=state height=1 validTxs=0 invalidTxs=0
I[2021-12-10|15:02:07.163] Committed state                              module=state height=1 txs=0 appHash=C68CBF3AB3CF91E5A5A8261D1E8D356D9397AAF6FCCAD23BFD9CF40247DBCC92
...

init

Initialize validator's and node's configuration files.

Usage:
  stchaind init [moniker] [flags]

Flags:
      --chain-id string   genesis file chain-id, if left blank will be randomly created
  -h, --help              help for init
  -o, --overwrite         overwrite the genesis.json file

init command:

stchaind init <node name you prefer> --chain-id=<current chain-id>

Example:

$ ./stchaind init node --chain-id=test-chain
{"app_message":{"auth":{"accounts":[],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},
"bank":{"send_enabled":true},
"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},
"distribution":{"delegator_starting_infos":[],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[]},"outstanding_rewards":[],"params":{"base_proposer_reward":"0.010000000000000000","bonus_proposer_reward":"0.040000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"","validator_accumulated_commissions":[],"validator_current_rewards":[],"validator_historical_rewards":[],"validator_slash_events":[]},
"evidence":{"evidence":[],"params":{"max_evidence_age":"120000000000"}},
"genutil":{"gentxs":[]},
"gov":{"deposit_params":{"max_deposit_period":"172800000000000","min_deposit":[{"amount":"10000000","denom":"stake"}]},"deposits":null,"proposals":null,"starting_proposal_id":"1","tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto":"0.334000000000000000"},"votes":null,"voting_params":{"voting_period":"172800000000000"}},
"mint":{"minter":{"annual_provisions":"0.000000000000000000","inflation":"0.130000000000000000"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},
"params":null,
"pot":{"params":{"bond_denom":"ustos","mature_epoch":"2016","mining_reward_params":[{"block_chain_percentage_in_ten_thousand":"2000","meta_node_percentage_in_ten_thousand":"2000",
"mining_reward":"80000000000","resource_node_percentage_in_ten_thousand":"6000","total_mined_valve_end":"16819200000000000","total_mined_valve_start":"0"},
{"block_chain_percentage_in_ten_thousand":"2000","meta_node_percentage_in_ten_thousand":"1800","mining_reward":"40000000000","resource_node_percentage_in_ten_thousand":"6200","total_mined_valve_end":"25228800000000000","total_mined_valve_start":"16819200000000000"},
{"block_chain_percentage_in_ten_thousand":"2000","meta_node_percentage_in_ten_thousand":"1600","mining_reward":"20000000000","resource_node_percentage_in_ten_thousand":"6400","total_mined_valve_end":"29433600000000000","total_mined_valve_start":"25228800000000000"},
{"block_chain_percentage_in_ten_thousand":"2000","meta_node_percentage_in_ten_thousand":"1400","mining_reward":"10000000000","resource_node_percentage_in_ten_thousand":"6600","total_mined_valve_end":"31536000000000000","total_mined_valve_start":"29433600000000000"},
{"block_chain_percentage_in_ten_thousand":"2000","meta_node_percentage_in_ten_thousand":"1200","mining_reward":"5000000000","resource_node_percentage_in_ten_thousand":"6800","total_mined_valve_end":"32587200000000000","total_mined_valve_start":"31536000000000000"},
{"block_chain_percentage_in_ten_thousand":"2000","meta_node_percentage_in_ten_thousand":"1000","mining_reward":"2500000000","resource_node_percentage_in_ten_thousand":"7000","total_mined_valve_end":"40000000000000000","total_mined_valve_start":"32587200000000000"}]}},
"register":{"indexing_nodes":null,"initial_uoz_price":"0.001000000000000000","last_indexing_node_stakes":null,"last_resource_node_stakes":null,"params":{"bond_denom":"ustos","max_entries":16,"unbonding_completion_time":"1209600000000000","unbonding_threashold_time":"15552000000000000"},"resource_nodes":null},
"sds":{},"slashing":{"missed_blocks":{},"params":{"downtime_jail_duration":"600000000000","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":{}},
"staking":{"delegations":null,"exported":false,"last_total_power":"0","last_validator_powers":null,"params":{"bond_denom":"stake","historical_entries":0,"max_entries":7,"max_validators":100,"unbonding_time":"1814400000000000"},"redelegations":null,"unbonding_delegations":null,"validators":null},
"supply":{"supply":[]},"upgrade":{}},"chain_id":"test-chain","gentxs_dir":"","moniker":"node","node_id":"c0e7ae38967680e8500d364ee0a84c2054e25822"}

tendermint

Tendermint subcommands

Usage:
  stchaind tendermint [command]

Available Commands:
  show-node-id   Show this node's ID
  show-validator Show this node's tendermint validator info
  show-address   Shows this node's tendermint validator consensus address
  version        Print tendermint libraries' version

show-node-id

Show this node's ID.

Usage:
  stchaind tendermint show-node-id [flags]

Flags:
  -h, --help   help for show-node-id

show-node-id command:

stchaind tendermint show-node-id

Example:

$ ./stchaind tendermint show-node-id
   0131cec55ef9fe874c55a533a3f857deedc68a7

show-validator

Show this node's tendermint validator info.

Usage:
  stchaind tendermint show-validator [flags]

Flags:
  -h, --help            help for show-validator
  -o, --output string   Output format (text|json) (default "text")

show-validator command:

stchaind tendermint show-validator

Example:

$ ./stchaind tendermint show-validator
  stvalconspub1zcjduepqsvuwa80g8f9av4jgpj5clcvhdgw0hcsa509zncsysdt82378vkcsldmf0x

show-address

Shows this node's tendermint validator consensus address.

Usage:
  stchaind tendermint show-address [flags]

Flags:
  -h, --help            help for show-address
  -o, --output string   Output format (text|json) (default "text")

show-address command:

stchaind tendermint show-address

Example:

$ ./stchaind tendermint show-address 
  stvalcons1xsvax7andy923jpm4f8rl2mfs34kumr8s92sx9

-version

Print protocols' and libraries' version numbers against which this app has been compiled.

Usage:
  stchaind tendermint version [flags]

Flags:
  -h, --help   help for version

version command:

stchaind tendermint version

Example:

$ ./stchaind tendermint version
   tendermint: 0.33.9
   abci: 0.16.2
   blockprotocol: 10
   p2pprotocol: 7

Last updated