# CLI Options

The usage of CLI includes the following parts: option, commands, command options, and subcommands. This article introduces the 'option' part.

# Help Info

# Notation

--help

# Functionality

Show help information.

# Example


$ ./miyabi-cli --help
Usage: miyabi-cli [Options] [Command, [Command Options]]
Options:
  --help                                         Show help information
  --host <hostname>                              Specify general/admin/private hosts
  ...
  ...
  ...
Commands:
  addcredential                                Add a required credential to a transaction
  addevidence                                  Add evidence to a tx
  ...
  ...
  ...
  waittransaction                              Wait for transaction execution and output status
Run 'miyabi-cli [command] --help' for more information about the subcommand and command options.

# Note

--help can also be used for commands and subcommands as shown in the following example.


$ ./miyabi-cli createtransaction moveasset --help
Usage: miyabi-cli createtransaction moveasset [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
  --help                 Show help information
  -p|--privatekey <key>  Private key of signer(table owner/trusted address/asset owner)
  --from <address>       [Mandatory] From address
  --to <address>         [Mandatory] To address
  -t|--table <name>      [Mandatory] Asset table name
  -m|--amount <decimal>  [Mandatory] Asset amount to move
  --memo <string>        Memo text for the operation

# Server Specification

# Notation

--host <host name>

# Functionality

Specifies the server to connect to. The host name may need to contain the port number.

# Example


$ ./miyabi-cli --host <NodeIPAddress>:<Port> getinfo
{"status":"Running","height":1228,"mempoolSize":0,"identity":"026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568","role":0,"extensions":["Miyabi.BLS","Miyabi.Binary","Miyabi.Asset","Miyabi.Entity","Miyabi.Contract"]}

# JSON Formatting

# Notation

--pretty

# Functionality

Formats the output result in standard JSON.


$ ./miyabi-cli --pretty createtransaction -j deletetable -t tablename
{
  "entryDetails": [
    {
      "typeName": "DeleteTable",
      "entryDetails": {
        "tableName": "tablename"
      }
    }
  ],
  "timestamp": "2022-08-23T02:05:41.9919764Z",
  "validFrom": "2022-08-23T02:05:41.9919764Z",
  "validTo": "2022-08-23T03:05:41.9919764Z",
  "entries": [
    "d2c03304050191a97461626c656e616d65"
  ],
  "requiredCredentials": [],
  "evidence": [],
  "id": "aaf5c8cf73d02dd2cfa1b2a2d46c0583c595c9fd1d41984e0e843cd86dd969c9",
  "witId": "aaf5c8cf73d02dd2cfa1b2a2d46c0583c595c9fd1d41984e0e843cd86dd969c9"
}

# Batch Operation

# Notation

--batch

# Functionality

Executes CLI in batch mode, all inputs will be automatically executed by CLI until the cancellation token signal (ctrl+c in windows) is signaled.

# Example


$ ./miyabi-cli --batch
getasset -t test_asset -a
2c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
900.0
getasset -t test_asset -a 2f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
100.0

# Batch with Files

# Notation

-f <path>|--file <path>

# Functionality

Should be used with --batch. Executes CLI in batch mode and passes the given file as an input to CLI.

# Example


$ ./miyabi-cli --batch -f batch.txt // same command as example in batch operation
900.0
100.0

# Client Certificate

# Notation

-cc|--clientcertificate <path>

# Functionality

Specifies the client certificate for communicating with the server. The certificate should be in a PKCS12 format. The most common use case is to specify the admin certificate for executing admin commands. Any other command which requires client authentication will need this option to be set.

# Example


$ ./miyabi-cli --host <NodeIPAddress>:<Port> -ins -cc admin.p12 getnodeconfig
{"bindings":["0.0.0.0:3820"],"initialNodes":[],"nodeAdmin":"03046bf1185537b4fc97fd8eab74c5e08cbe306aa7c394de812a8c1b6abcc2e5a4","sslKeyStorePath":"c:\\ssl.p12","consensusKeyStorePath":"c:\\consensuskey.p12","dbConfig":{"baseLocation":"c:\\_configs\\node_000","storageCacheSizeMb":64,"storageCompressedCacheSizeMb":64,"storagePointLookupBlockCacheSizeMb":8},"generalWebApiConfig":{"webApiEndPoint":"https://+:9010/","serverKeyStorePath":"c:\\server.p12"},"adminWebApiConfig":{"webApiEndPoint":"https://+:8000/","serverKeyStorePath":"c:\\server.p12"},"consensus":{"timeout":"00:00:10","interval":"00:00:04"},"busyWaitTransactions":false,"waitForTx":"00:00:00","memoryPoolCapacity":1048576,"maxGetBlockSize":5,"maxBlockDepth":100,"extensions":[]}

# Client Certificate Password

# Notation

--ccp|--clientcertificatepassword <password>

# Functionality

Used along with -cc if the certificate is protected by a password.

# Example


$ ./miyabi-cli --host <NodeIPAddress>:<Port> -cc admin2.p12 -ccp <password> getnodeconfig
{"bindings":["0.0.0.0:3820"],"initialNodes":[],"nodeAdmin":"03046bf1185537b4fc97fd8eab74c5e08cbe306aa7c394de812a8c1b6abcc2e5a4","sslKeyStorePath":"c:\\ssl.p12","consensusKeyStorePath":"c:\\consensuskey.p12","dbConfig":{"baseLocation":"c:\\_configs\\node_000","storageCacheSizeMb":64,"storageCompressedCacheSizeMb":64,"storagePointLookupBlockCacheSizeMb":8},"generalWebApiConfig":{"webApiEndPoint":"https://+:9010/","serverKeyStorePath":"c:\\server.p12"},"adminWebApiConfig":{"webApiEndPoint":"https://+:8000/","serverKeyStorePath":"c:\\server.p12"},"consensus":{"timeout":"00:00:10","interval":"00:00:04"},"busyWaitTransactions":false,"waitForTx":"00:00:00","memoryPoolCapacity":1048576,"maxGetBlockSize":5,"maxBlockDepth":100,"extensions":[]}

# Insecure Mode

# Notation

-ins|--insecure

# Functionality

Skips the verification of the server's certificate during https communication. Used if the current machine cannot install or verify the certificate's service.

# Example


$ ./miyabi-cli --host <NodeIPAddress>:<Port> -ins -cc admin2.p12 -ccp <password> getnodeconfig
{"bindings":["0.0.0.0:3820"],"initialNodes":[],"nodeAdmin":"03046bf1185537b4fc97fd8eab74c5e08cbe306aa7c394de812a8c1b6abcc2e5a4","sslKeyStorePath":"c:\\ssl.p12","consensusKeyStorePath":"c:\\consensuskey.p12","dbConfig":{"baseLocation":"c:\\_configs\\node_000","storageCacheSizeMb":64,"storageCompressedCacheSizeMb":64,"storagePointLookupBlockCacheSizeMb":8},"generalWebApiConfig":{"webApiEndPoint":"https://+:9010/","serverKeyStorePath":"c:\\server.p12"},"adminWebApiConfig":{"webApiEndPoint":"https://+:8000/","serverKeyStorePath":"c:\\server.p12"},"consensus":{"timeout":"00:00:10","interval":"00:00:04"},"busyWaitTransactions":false,"waitForTx":"00:00:00","memoryPoolCapacity":1048576,"maxGetBlockSize":5,"maxBlockDepth":100,"extensions":[]}

# Refresh Cache

# Notation

-rcm|--refreshconfigmetadata

# Functionality

Refreshes the local blockchain config metadata by fetching the latest from the node. -rcm only take effects with Transaction Creation Commands.

# Example


$ ./miyabi-cli -rcm createtransaction deletetable -t DummyTable

# Specify Configuration File

# Notation

--config <path>

# Functionality

Specifies the configuration file of the Miyabi service to be used in the following command.

# Example


$ ./miyabi-cli --config config.json getinfo
{"status":"Running","height":1228,"mempoolSize":0,"identity":"026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568","role":0,"extensions":["Miyabi.BLS","Miyabi.Binary","Miyabi.Asset","Miyabi.Entity","Miyabi.Contract"]}

# Note

The name of the configuration file is not restricted. If the --config and --host options are not used, CLI will try to find config.json from the folder. Otherwise, only the offline commands can be executed.

hosts field in the file can contain multiple addresses like:

{
  "hosts": [
    "123.456.789.012:60001",
    "223.456.789.012:60002",
    "323.456.789.012:60003"
  ],
  "fallback": true
}

# Module Specification

# Notation

-m <module name>|--module <module name>

# Functionality

Specifies the module needed in the following command(s). Usually, modules are loaded according to the configuration file. If the configuration file is not provided, the user needs to specify modules to use module commands.

# Example


$ ./miyabi-cli --module asset getasset -t test_asset -a 02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
900.0

# Stop Auto-loading Modules

# Notation

--no-auto-module

# Functionality

If the configuration file is not provided, the user can use this option to avoid searching the executable directory for module specific libraries to load modules as it may affect the performance if the directory is big. This option is usually used with -m for specific module commands.

# Example


$ ./miyabi-cli --no-auto-module --module asset getasset -t test_asset -a 02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
900.0

# Get All Outputs

# Notation

--all-outputs

# Functionality

This option should be used with an inner command which follows --. An Inner command will take the output of external command as argument. If this option is applied, the external command's output will be displayed. Otherwise, only the result of the inner command will be displayed.

# Example


$ ./miyabi-cli --all-outputs sendtransaction deletetable -t "lalala" -- waittransaction
1750c700fc38f6e355c92aa0902de5d085c14bb07c8382f4beb01c11c9260189

{"resultCode":7,"errorMessage":"lalala does not exist or does not support deletion"}