CLI Commands

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

This section details the present commands, command flags in the alveychain, and how they're used.

:::tip JSON output support

The --json flag is supported on some commands. This flag instructs the command to print the output in JSON format

:::

Reference Version

v1.1.3

Startup Commands

Command

Description

server

The default command that starts the blockchain client, by bootstrapping all modules together

genesis

Generates a genesis.json file, which is used to set a predefined chain state before starting the client. The structure of the genesis file is described below

server flags

seal

server [--seal SHOULD_SEAL]
server --seal
server --seal=false

Sets the flag indicating that the client should seal blocks. Default: true.

Turn it off by explicitly setting it false.


data-dir

Used to specify the data directory used for storing Alveychain-Lab Alveychain client data. Default: ./alveychain-chain.


jsonrpc

Sets the address and port for the JSON-RPC service address:port. If only port is defined :10001 it will bind to all interfaces 0.0.0.0:10001. If omitted the service will bind to the default address:port. Default address: 0.0.0.0:8545.


json-rpc-batch-request-limit

Sets the max length to be considered when handling json-rpc batch requests. Default 1.

Turn it off by setting 0.


json-rpc-block-range-limit

Sets the max block range to be considered when executing json-rpc requests that consider fromBlock/toBlock values. Default 100.

Turn it off by setting 0.


enable-ws

Sets the flag indicating that node enable WebSocket service. Default: false.


grpc

Sets the address and port for the gRPC service address:port. Default address: 127.0.0.1:9632.


libp2p

Sets the address and port for the libp2p service address:port. Default address: 127.0.0.1:1478.


prometheus

Sets the address and port for the prometheus server address:port. If only port is defined :5001 the service will bind to all interfaces 0.0.0.0:5001. If omitted the service will not be started.


block-gas-target

Sets the target block gas limit for the chain. If omitted, the value of the parent block is used. Default (not enforced): 0.

A more detailed explanation on the block gas target can be found in the TxPool section.


max-peers

Sets the client's maximum peer count. Default: 40.

Peer limit should be specified either by using max-peers or max-inbound/outbound-peers flag.


max-inbound-peers

Sets the client's maximum inbound peer count. If max-peers is set, max-inbound-peer limit is calculated using the following formulae.

max-inbound-peer = InboundRatio * max-peers, where InboundRatio is 0.8.


max-outbound-peers

Sets the client's maximum outbound peer count. If max-peers is set, max-outbound-peer count is calculated using the following formulae.

max-outbound-peer = OutboundRatio * max-peers, where OutboundRatio is 0.2.


log-level

Sets the log level for console output. Default: INFO.


chain

Specifies the genesis file used for starting the chain. Default: ./genesis.json.


join

Specifies the address of the peer that should be joined.


nat

Sets the external address (address:port), as can be seen by peers.


dns

Sets the host DNS address. This can be used to advertise an external DNS. Supports dns,dns4,dns6.


price-limit

Sets minimum gas price limit to enforce for acceptance into the pool. Default: 0.


max-slots

Sets maximum slots in the pool. Default: 4096.


config

Specifies the path to the CLI config. Supports .json and .hcl.


secrets-config

Sets the path to the SecretsManager config file. Used for Hashicorp Vault and GCP SSM. If omitted, the local FS secrets manager is used.


dev

Sets the client to dev mode. Default: false.


dev-interval

Sets the client's dev notification interval in seconds. Default: 0.


no-discover

Prevents the client from discovering other peers. Default: false.


restore

Sets the path to the archive blockchain data to restore on initialization.


block-time

Sets minimum block time in seconds (at least 1 s). Default: 2


access-control-allow-origins

Sets the authorized domains to be able to share responses from JSON-RPC requests. Add multiple flags --access-control-allow-origins "https://example1.com" --access-control-allow-origins "https://example2.com" to authorize multiple domains. If omitted Access-Control-Allow-Origins header will be set to * and all domains will be authorized.


daemon

Sets the flag indicating that the server ran as daemon. Default: false. Once the flag set, node would not use local secret files, but accept the private keys on the first start up.


log-to

Sets the flag to write all logs to the file at specified location instead of writing them to console. If omitted, logs would be written to console.


enable-graphql

Sets the flag indicating that node enable graphql service. Default: false.


graphql-address

The GraphQL interface. Default: 127.0.0.1:9898.


promote-outdate-seconds

Account in the pool not promoted for a long time would be pruned. Default: 3600.


prune-tick-seconds

Tick seconds for pruning account future transactions in the pool. Default: 300. Should not be larger than promote-outdate-seconds flag, otherwise, unknown errors might happen.


leveldb.bloom-bits

Sets the bits of leveldb bloom filters. Default: 2048.


leveldb.cache-size

Sets the size of the leveldb cache in MB. Default: 1024.


leveldb.handles

Sets the number of handles to leveldb open files. Default: 512.


leveldb.table-size

Sets the leveldb 'sorted table' size in MB. Default: 8.


leveldb.total-table-size

Sets limits leveldb total size of 'sorted table' for each level in MB. Default: 32.


pprof

Enables the pprof server. Default: false.


pprof-address

Sets the address and port for the pprof service. Default address: 127.0.0.1:6060.


genesis flags

dir

Sets the directory for the alveychain genesis data. Default: ./genesis.json.


name

Sets the name for the chain. Default: alveychain.


pos

Sets the flag indicating that the client should use Proof of Stake IBFT. Defaults to Proof of Authority if flag is not provided or false.


epoch-size

Sets the epoch size for the chain. Default 100000.


premine

Sets the premined accounts and balances in the format address:amount. The amount can be in either decimal or hex. Default premined balance: 0x3635C9ADC5DEA00000.


chain-id

Sets the ID of the chain. Default: 2000.


ibft-validators-prefix-path

Prefix path for validator folder directory. Needs to be present if the flag ibft-validator is omitted.


ibft-validator

Sets passed in addresses as IBFT validators. Needs to be present if the flag ibft-validators-prefix-path is omitted.


block-gas-limit

Refers to the maximum amount of gas used by all operations in a block. Default: 5242880.


consensus

Sets consensus protocol. Default: pow.


bootnode

Multiaddr URL for p2p discovery bootstrap. This flag can be used multiple times. Instead of an IP address, the DNS address of the bootnode can be provided.


bridge-owner

Sets the system bridge contract owner address.


bridge-signer

Sets the system bridge contract signer address. This flag can be used multiple times.


validatorset-owner

Sets the system ValidatorSet contract owner address.


vault-owner

Sets the system vault contract owner address.


Operator Commands

Peers Commands

Command

Description

peers add

Adds a new peer using their libp2p address

peers list

Lists all the peers the client is connected to through libp2p

peers status

Returns the status of a specific peer from the peers list, using the libp2p address

peers add flags

addr

Peer's libp2p address in the multiaddr format.


grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

peers list flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

peers status flags

peer-id

Libp2p node ID of a specific peer within p2p network.


grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

IBFT Commands

Command

Description

ibft snapshot

Returns the IBFT snapshot

ibft candidates

Queries the current set of proposed candidates, as well as candidates that have not been included yet

ibft propose

Proposes a new candidate to be added/removed from the validator set

ibft status

Returns the overall status of the IBFT client

ibft switch

Add fork configurations into genesis.json file to switch IBFT type

ibft snapshot flags

number

The block height (number) for the snapshot.


grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

ibft candidates flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

ibft propose flags

vote

Proposes a change to the validator set. Possible values: [auth, drop].


addr

Address of the account to be voted for.


grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

ibft status flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

ibft switch flags

chain

Specifies the genesis file to update. Default: test.

type

Specifies the IBFT type to switch. Possible values: [PoA, PoS].

deployment

Specifies the height of contract deployment. Only available with PoS.

from

Specifies the beginning height of the fork.

Transaction Pool Commands

Command

Description

txpool status

Returns the number of transactions in the pool

txpool subscribe

Subscribes for events in the transaction pool

txpool status flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

txpool subscribe flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.


promoted

Subscribes for promoted tx events in the TxPool.


dropped

Subscribes for dropped tx events in the TxPool.


demoted

Subscribes for demoted tx events in the TxPool.


added

Subscribes for added tx events to the TxPool.


enqueued

Subscribes for enqueued tx events in the account queues.


Blockchain commands

Command

Description

status

Returns the status of the client. The detailed response can be found below

monitor

Subscribes to a blockchain event stream. The detailed response can be found below

version

Returns the current version of the client

status flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.

monitor flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.


Secrets Commands

Command

Description

secrets init

Initializes the private keys to the corresponding secrets manager

secrets generate

Generates a secrets manager configuration file which can be parsed by the alveychain

secrets init flags

config

Sets the path to the SecretsManager config file. Used for Hashicorp Vault. If omitted, the local FS secrets manager is used.


data-dir

Sets the directory for the alveychain data if the local FS is used.

secrets generate flags

dir

Sets the directory for the secrets manager configuration file Default: ./secretsManagerConfig.json


type

Specifies the type of the secrets manager [hashicorp-vault]. Default: hashicorp-vault


token

Specifies the access token for the service


server-url

Specifies the server URL for the service


name

Specifies the name of the node for on-service record keeping. Default: alveychain-node


namespace

Specifies the namespace used for the Hashicorp Vault secrets manager. Default: admin


Responses

Status Response

The response object is defined using Protocol Buffers.

Monitor Response

Utilities

loadbot flags

tps

The number of transactions per second to send. Default: 100.


mode

Sets the loadbot run mode [transfer, deploy]. Default: transfer.


chain-id

Sets the network chain ID for transactions. Default: 2000.


gas-price

The gas price that should be used for the transactions. If omitted, the average gas price is fetched from the network.


gas-limit

The gas limit that should be used for the transactions. If omitted, the gas limit is estimated before starting the loadbot.


grpc-address

The GRPC endpoint used to send transactions


detailed

Flag indicating if the error logs should be shown. Default: false.


contract

The path to the contract JSON artifact containing the bytecode. If omitted, a default contract is used.


sender

Address of the sender account.


receiver

Address of the receiver account.


jsonrpc

A JSON RPC endpoint used to send transactions.


count

The total number of transactions to send. Default: 1000.


value

The value to send in each transaction.


max-conns

Sets the maximum no.of connections allowed per host. Default: 2*tps.


backup flags

grpc-address

Address of the gRPC API. Default: 127.0.0.1:9632.


out

Path of archive file to save.


from

The beginning height of blocks in archive. Default: 0.


to

The end height of blocks in archive.


Genesis Template

The genesis file should be used to set the initial state of the blockchain (ex. if some accounts should have a starting balance).

The following ./genesis.json file is generated:

Data Directory

When executing the data-dir flag, a test-chain folder is generated. The folder structure consists of the following sub-folders:

  • blockchain - Stores the LevelDB for blockchain objects

  • trie - Stores the LevelDB for the Merkle tries

  • keystore - Stores private keys for the client. This includes the libp2p private key and the sealing/validator private key

  • consensus - Stores any consensus information that the client might need while working

Resources

Last updated