Skip to main content

MOIPod CLI

This section details the commands, sub-commands and command flags for the moipod executable

Startup Commands

CommandDescription
bootnodeThe command to initialize and start a moipod bootnode
genesisThe command to generate genesis file
serverThe command that starts the moipod client
registerThe command registers guardian information

Register Command

This command registers the guardian information with MOI protocol.

moipod register --data-dir <DATA_DIR_PATH> --mnemonic-keystore-path <KEYSTORE_PATH> --mnemonic-keystore-password <MNEMONIC_KEYSTORE_PASSWORD> --local-rpc-url <LOCAL_RPC_URL> --network-rpc-url <RPC_URL> --node-index <NODE_INDEX> --node-password <NODE_PASSWORD> --wallet-address <ADDRESS> --watchdog-url <WATCHDOG_URL>
info

You can store the mnemonic keystore password (MNEMONIC_KEYSTORE_PASSWORD) and the node password (NODE_PASSWORD)as environment variables, without the need to configure them as separate command-line flags.

Flags

FlagTypeDescription
data-dirstringPath to node data directory.
mnemonic-keystore-pathstringPath to keystore.
mnemonic-keystore-passwordstringPasscode to decrypt the mnemonic keystore.
local-rpc-urlstringLocal JSON RPC end point.
network-rpc-urlstringNetwork JSON RPC end point. (default "http://localhost:1600/")
node-indexint32Validator node index.
node-passwordstringPasscode to encrypt the node keystore.
wallet-addressstringIncentive wallet address.
watchdog-urlstringWatchDog service url

Server Command

This command initializes and starts the moipod client.

moipod server --genesis-path <GENESIS_FILE_NAME> --config-path <CONFIG_FILE_NAME> --data-dir <DATA_DIR_PATH> --babylon --operator-slots <OPERATOR_SLOTS> --validator-slots <VALIDATOR_SLOTS> --enable-tracing <ENABLE_TRACING> --bootnodes <BOOTNODES_ADDRESS> --allow-origins <METHOD> --clean-db <CLEAN_DB> --log-level <LOG_LEVEL> --log-dir <LOG_DIR> --node-password <NODE_PASSWORD> --discovery-interval <TIME_INTERVAL>
info

You can skip passing node password as a separate command-line flag if you have set it as an environment variable already.

Flags

FlagTypeDescription
genesis-pathstringPath to the genesis file. Default: "genesis.json"
config-pathstringPath to the config file.
babylonboolConnect to babylon network by downloading its genesis file.
operator-slotsintMaximum number of operator slots. Default: -1
validator-slotsintMaximum number of validator slots. Default: -1
data-dirstringPath to the data directory.
enable-tracingboolEnables jaeger tracing to track moichain performance.
bootnodesstringsThe list of multiaddr URL for p2p discovery bootstrap.
allow-originsstringsThe CORS header determines if the specified origin is allowed to receive any JSON-RPC response.
clean-dbboolDeletes the data stored in the database.
log-levelstringThe logger level. Default: "INFO"
log-dirstringPath to the log directory.
node-passwordstringNode password which is used to decrypt keystore.
discovery-intervalstringTime interval for discovering nodes.

Debug Mode

Warning!

Do not use in production environment.

The moipod server command can also be used to initialize and start the moipod client in debug mode with the following additional flag:

moipod server --genesis-path <GENESIS_FILE_NAME> --config-path <CONFIG_FILE_NAME> --data-dir <DATA_DIR_PATH> --babylon --operator-slots <OPERATOR_SLOTS> --validator-slots <VALIDATOR_SLOTS> --enable-tracing <ENABLE_TRACING> --bootnodes <BOOTNODES_ADDRESS> --allow-origins <METHOD> --clean-db <CLEAN_DB> --log-level <LOG_LEVEL> --log-dir <LOG_DIR> --node-password <NODE_PASSWORD> --discovery-interval <TIME_INTERVAL> --enable-debug-mode <ENABLE_DEBUG_MODE>

Flags

FlagTypeDescription
enable-debug-modeboolEnables the debug mode

Bootnode Command

This command starts a moipod bootnode, assigning ports, managing connections, and utilizing unique keys and data store paths.

moipod bootnode --port <PORT_NUMBER> --ip-address <IP_ADDRESS> --key-path <FILE_NAME> --store-path <DATA_STORE_DIR> --max-conn <CONNECTION_REQUEST> --min-conn <CONNECTION_REQUEST> --peer-list <MULTIADDR>

Flags

FlagTypeDescription
portintSets the port for the bootnode to listen and serve. Default: 4001
ip-addressstringThe listener ip address is provided to the bootnode. Default: "0.0.0.0"
key-pathstringPath to the key file. Default: "file.key"
store-pathstringPath to the badger datastore.
max-connintSets the maximum number of connections allowed. Default: 400
min-connintSets the minimum number of connections allowed. Default: 200
peer-liststringComma-separated list of peers to connect. Format: <peerAddress1,peerAddress2,...>

Genesis Command

This command creates a genesis file, defining initial ledger state of moipod via genesis and instances file paths.

SubcommandDescription
Init AccountInitializes account
PredeployAdds genesis logics
PremineAllocates given asset info to given addresses with respective balances
moipod genesis --genesis-path <FILE_NAME> --instances-path <FILE_NAME>

Global Flags

FlagTypeDescription
genesis-pathstringPath to the genesis file. Default: "genesis.json"
instances-pathstringPath to instances file. Default: "instances.json"

Init Account Subcommand

This command adds accounts to the genesis file with specified account details including type, address, moi-id, behavior nodes, and random nodes.

moipod genesis init-account --account-type <ACCOUNT_TYPE> --address <ACCOUNT_ADDRESS> --behaviour-nodes <KRAMA_IDS> --moi-id <ACCOUNT_MOI_ID> --random-nodes <KRAMA_IDS> 

Flags

FlagTypeDescription
account-typeintType of account. SargaAccount = 1, RegularAccount = 2, LogicAccount = 3, AssetAccount = 4. Default: 2
addressstringAddress of the account in hexadecimal.
moi-idstringMoi-id of the account.
behaviour-nodesstringsKrama ids for behavioural context of an account. List of krama ids format (kramaID1,kramaID2,...)
random-nodesstringsKrama ids for random context of an account. List of krama ids format (kramaID1,kramaID2,...)

Predeploy Subcommand

This command will add a logic account to the genesis file, along with other attributes it reads the logic manifest, callsite and calldata from the artifacts.json

moipod genesis predeploy --moi-id <ACCOUNT_MOI_ID> --random-nodes <KRAMA_IDS> --artifact-path <ARTIFACT_FILE_NAME> --behaviour-nodes <KARMA_IDS>

Flags

FlagTypeDescription
artifact-pathstringPath to the logic artifact file. Default: "artifact.json"
behaviour-nodesstringsKrama ids for behavioural context of an account. List of krama ids format (kramaID1,kramaID2,...)
moi-idstringmoi-id of the account.
random-nodesstringsKrama ids for random context of an account. List of krama ids format (kramaID1,kramaID2,...)

Premine Subcommand

This command adds an asset account to the genesis file, by utilizing the provided asset-info metadata and allocates assets to the address provided.

moipod genesis premine --asset-info <SYMBOL:DIMENSION:STANDARD:isLOGICAL:isSTATEFUL:OWNER> --allocations <ACCOUNT_ADDRESS:BALANCE> --behaviour-nodes <KRAMA_ID> --random-nodes <KRAMA_ID>

Flags

FlagTypeDescription
allocationsstringsBalance allocation of addresses. Format (address:balance,address:balance...)
asset-infostringAsset information. Format (symbol:dimension:standard:isLogical:isStateful:owner)
behaviour-nodesstringsKrama ids for behavioural context of an account. List of krama ids format (kramaID1,kramaID2,...)
random-nodesstringsKrama ids for random context of an account. List of krama ids format (kramaID1,kramaID2,...)