MOIPod CLI
This section details the commands, sub-commands and command flags for the moipod
executable
Startup Commands
Command | Description |
---|---|
bootnode | The command to initialize and start a moipod bootnode |
genesis | The command to generate genesis file |
server | The command that starts the moipod client |
register | The command registers guardian information |
Register Command
This command registers the guardian information with MOI protocol.
- Syntax
- Example
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>
moipod register --data-dir test_0 --mnemonic-keystore-path keystore.json --mnemonic-keystore-password xyz --local-rpc-url http://localhost:1601 --network-rpc-url http://localhost:1600/ --node-index 7 --node-password test123 --wallet-address 0xbadcadae193f2c548d9391efd3f63c138e111a3b70fb2de5b5898be36fd95fa5 --watchdog-url https://babylon-watchdog.moi.technology/add
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
Flag | Type | Description |
---|---|---|
data-dir | string | Path to node data directory. |
mnemonic-keystore-path | string | Path to keystore. |
mnemonic-keystore-password | string | Passcode to decrypt the mnemonic keystore. |
local-rpc-url | string | Local JSON RPC end point. |
network-rpc-url | string | Network JSON RPC end point. (default "http://localhost:1600/") |
node-index | int32 | Validator node index. |
node-password | string | Passcode to encrypt the node keystore. |
wallet-address | string | Incentive wallet address. |
watchdog-url | string | WatchDog service url |
Server Command
This command initializes and starts the moipod client.
- Syntax
- Example
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>
moipod server --genesis-path genesis.json --config-path config.json --data-dir test_0 --babylon --operator-slots 2 --validator-slots 3 --enable-tracing true --bootnodes /ip4/0.0.0.0/tcp/4001/p2p/16Uiu2HAkvxbPb5bWGPWQuju7GXerrCs767XoXwqxN44z6skVXsa1 --allow-origins https://myclient.com --clean-db true --log-level INFO --log-dir logDir --node-password test123 --discovery-interval 1m0s
You can skip passing node password
as a separate command-line flag if you have set it as an environment variable already.
Flags
Flag | Type | Description |
---|---|---|
genesis-path | string | Path to the genesis file. Default: "genesis.json" |
config-path | string | Path to the config file. |
babylon | bool | Connect to babylon network by downloading its genesis file. |
operator-slots | int | Maximum number of operator slots. Default: -1 |
validator-slots | int | Maximum number of validator slots. Default: -1 |
data-dir | string | Path to the data directory. |
enable-tracing | bool | Enables jaeger tracing to track moichain performance. |
bootnodes | strings | The list of multiaddress for p2p discovery bootstrap. |
allow-origins | strings | The CORS header determines if the specified origin is allowed to receive any JSON-RPC response. |
clean-db | bool | Deletes the data stored in the database. |
log-level | string | The logger level. Default: "INFO" |
log-dir | string | Path to the log directory. |
node-password | string | Node password which is used to decrypt keystore. |
discovery-interval | string | Time interval for discovering nodes. |
public-p2p-addresses | strings | List of public multi address advertised by libp2p host. |
allow-ipv6-addresses | bool | Enable IPv6 communication for the p2p host. |
Debug Mode
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:
- Syntax
- Example
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>
moipod server --genesis-path genesis.json --config-path config.json --data-dir test_0 --babylon --operator-slots 2 --validator-slots 3 --enable-tracing true --bootnodes /ip4/0.0.0.0/tcp/4001/p2p/16Uiu2HAkvxbPb5bWGPWQuju7GXerrCs767XoXwqxN44z6skVXsa1 --allow-origins https://myclient.com --clean-db true --log-level INFO --log-dir logDir --node-password test123 --discovery-interval 1m0s --enable-debug-mode true
Flags
Flag | Type | Description |
---|---|---|
enable-debug-mode | bool | Enables the debug mode |
Bootnode Command
This command starts a moipod
bootnode, assigning ports, managing connections, and utilizing unique keys and data store paths.
- Syntax
- Example
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>
moipod bootnode --port 4001 --ip-address 0.0.0.0 --key-path file.key --store-path bootnodeData --max-conn 500 --min-conn 100 --peer-list /ip4/0.0.0.0/tcp/5050/p2p/16Uiu2HAm35hvPBbX5Xh7KvkZjU7SnKWiZeJwzdAGTZjGH9KCjpp1
Flags
Flag | Type | Description |
---|---|---|
port | int | Sets the port for the bootnode to listen and serve. Default: 4001 |
ipv4-address | string | The listener ipv4 address is provided to the bootnode. Default: "0.0.0.0" |
ipv6-address | string | The listener ipv6 address is provided to the bootnode. Default: "::" |
key-path | string | Path to the key file. Default: "file.key" |
store-path | string | Path to the badger datastore. |
max-conn | int | Sets the maximum number of connections allowed. Default: 400 |
min-conn | int | Sets the minimum number of connections allowed. Default: 200 |
peer-list | string | Comma-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.
Subcommand | Description |
---|---|
Init Account | Initializes account |
Predeploy | Adds genesis logics |
Premine | Allocates given asset info to given addresses with respective balances |
- Syntax
- Example
moipod genesis --genesis-path <FILE_NAME> --instances-path <FILE_NAME>
moipod genesis --genesis-path genesis.json --instances-path instances.json
Global Flags
Flag | Type | Description |
---|---|---|
genesis-path | string | Path to the genesis file. Default: "genesis.json" |
instances-path | string | Path 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.
- Syntax
- Example
moipod genesis init-account --account-type <ACCOUNT_TYPE> --address <ACCOUNT_ADDRESS> --behaviour-nodes <KRAMA_IDS> --moi-id <ACCOUNT_MOI_ID> --random-nodes <KRAMA_IDS>
moipod genesis init-account --account-type 1 --address 0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649 --behaviour-nodes a5PrYcUcrPHxJQn9XsgQFCFLdLpSZdTJ6V4NjkWVpCYNi2akV5.16Uiu2HAm5GdNN6bmfRWnSDTPPxoDp2dkHWRyz6vdsKGPhbsAb9sS --moi-id 11deb8441455880046b1f789ee3a5263caa45026ed44ac62fae83274a30778be --random-nodes a5PrYcUcrPHxJQn9XsgQFCFLdLpSZdTJ6V4NjkWVpCYNi2akV5.16Uiu2HAm5GdNN6bmfRWnSDTPPxoDp2dkHWRyz6vdsKGPhbsAb9sS
Flags
Flag | Type | Description |
---|---|---|
account-type | int | Type of account. SargaAccount = 1, RegularAccount = 2, LogicAccount = 3, AssetAccount = 4. Default: 2 |
address | string | Address of the account in hexadecimal. |
moi-id | string | Moi-id of the account. |
behaviour-nodes | strings | Krama ids for behavioural context of an account. List of krama ids format (kramaID1,kramaID2,...) |
random-nodes | strings | Krama 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
- Syntax
- Example
moipod genesis predeploy --moi-id <ACCOUNT_MOI_ID> --random-nodes <KRAMA_IDS> --artifact-path <ARTIFACT_FILE_NAME> --behaviour-nodes <KARMA_IDS>
moipod genesis predeploy --moi-id 11deb8441455880046b1f789ee3a5263caa45026ed44ac62fae83274a30778be --random-nodes a5PrYcUcrPHxJQn9XsgQFCFLdLpSZdTJ6V4NjkWVpCYNi2akV5.16Uiu2HAm5GdNN6bmfRWnSDTPPxoDp2dkHWRyz6vdsKGPhbsAb9sS --artifact-path artifact.json --behaviour-nodes a5PrYcUcrPHxJQn9XsgQFCFLdLpSZdTJ6V4NjkWVpCYNi2akV5.16Uiu2HAm5GdNN6bmfRWnSDTPPxoDp2dkHWRyz6vdsKGPhbsAb9sS,a4eAtAgviqahx7MRmonrDaySgUwNzdSJoqFL2Ee7L5FmRDT4N3.16Uiu2HAmQ9KxRh7ujGJ5DyG1bnxGeN9CBwf1qREbnEYiD4RJ2Lhp
Flags
Flag | Type | Description |
---|---|---|
artifact-path | string | Path to the logic artifact file. Default: "artifact.json" |
behaviour-nodes | strings | Krama ids for behavioural context of an account. List of krama ids format (kramaID1,kramaID2,...) |
moi-id | string | moi-id of the account. |
random-nodes | strings | Krama 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.
- Syntax
- Example
moipod genesis premine --asset-info <SYMBOL:DIMENSION:STANDARD:isLOGICAL:isSTATEFUL:OWNER> --allocations <ACCOUNT_ADDRESS:BALANCE> --behaviour-nodes <KRAMA_ID> --random-nodes <KRAMA_ID>
moipod genesis premine --asset-info MOI:0:0:false:true:0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649 --allocations 0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649:10000000 --behaviour-nodes 5HphAZBc9frVCimKkUfnTqufaViU75fACBHpneTYwr6qp3AHV.16Uiu2HAkwjeyUzoMFUq36wm4wLNVXiGDL5mxXNobofcU1H44Vewr --random-nodes a5CmHxfvh41vTzQ7sororVBUuBx6waWThrQd9raVLwzHHeiX7u.16Uiu2HAmQsSJkkbeGSPV5CtvRgmLrdGpyykLQLXdQ6sqGLdcAvYL,a5HphAZBc9frVCimKkUfnTqufaViU75fACBHpneTYwr6qp3AHV.16Uiu2HAkwjeyUzoMFUq36wm4wLNVXiGDL5mxXNobofcU1H44Vewr
Flags
Flag | Type | Description |
---|---|---|
allocations | strings | Balance allocation of addresses. Format (address:balance,address:balance...) |
asset-info | string | Asset information. Format (symbol:dimension:standard:isLogical:isStateful:owner) |
behaviour-nodes | strings | Krama ids for behavioural context of an account. List of krama ids format (kramaID1,kramaID2,...) |
random-nodes | strings | Krama ids for random context of an account. List of krama ids format (kramaID1,kramaID2,...) |