# CLI Options

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

# Help Info

# Notation

--help

# Functionality

Show help information

# Example

$ ./miyabi-cli.exe --help
Usage:  [miyabi-cli options] [Command, [Command Options]]
Options:
  --help                                       Show help information
  --host <hostname>                            Specify general/admin hosts
  --pretty                                     Pretty print JSON
  --batch                                      Execute in batch mode cmds from STDIN if -f is not specified
  ...
Commands:
  addcredential                                Add a required credential to a transaction
  addevidence                                  Add evidence to a tx
  ...
  waittransaction                              Wait for transaction executionand 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.exe createtransaction moveasset --help
Usage: miyabi-cli createtransaction moveasset [options]
Options:
  --help                 Show help information
  -p|--privatekey <key>  Private key of signer(table owner/trusted address/assetowner)
  --from <address>       From address
  --to <address>         To address
  -t|--table <name>      Asset table name
  -m|--amount <decimal>  Asset amount to move
  --memo <string>        Memo text for the operation
  --permissioned <key>   Private key of permissioned admin(update admin/tableowner in permissioned asset table)

# Server Specification

# Notation

--host < host name>

# Functionality

Specifies the server to connect to. If the command is an admin command, the host name may need to contain the port number.

# Example

$ ./miyabi-cli.exe --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.exe --host <NodeIPAddress>:<Port> --pretty getinfo
{
  "status": "Running",
  "height": 4,
  "mempoolSize": 0,
  "identity": "026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568",
  "role": 0,
  "extensions": [
    "Miyabi.BLS",
    "Miyabi.Binary",
    "Miyabi.Asset",
    "Miyabi.Entity",
    "Miyabi.Contract"
  ]
}

# 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.exe --batch
getasset -t test_asset -a
2c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
900.0
getasset -t test_asset -a 2f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
100.0

# Batch with Files

# Notation

-f |--file

# Functionality

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

# Example

$ ./miyabi-cli.exe --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.exe --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.exe --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

Jumps 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.exe --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":[]}

# 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.exe --batch -f batch.txt // same command as example in batch operation
900.0
100.0

# 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.exe --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 command.

# Example

$ ./miyabi-cli.exe --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 configuration file in case the folder is big enough that it may affect performance. 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

--alloutputs

# 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.exe --alloutputs sendtransaction createbinarytable -p 01 -t "lalala" -- waittransaction
034188bde6b56f8d08bd57eb1e7d3ddd945c9cde374a8dd959845ff775a71762
{"resultCode":6,"errorMessage":"System error."}