# CLI Options

The usage of CLI includes the following parts: options, commands, command options, and subcommands. This article introduces the 'options' 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. If specified, it overrides the corresponding value specified in the configuration file.

# Example


$ ./miyabi-cli --host https://10.0.0.8:9010 getinfo
{"value":{"name":"026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568","version":"3.2.1","status":"Running","startTime":"2024-01-11T05:48:52.8022838Z","height":22,"mempoolSize":0,"identity":"026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568","networkIdentity":"03ea7014d880a711d82cb41a53f2df6138739f4fb904aca2fa22998d4efe9db7be","role":"Consensus","connections":[],"dbStats":"\n** DB Stats **\nUptime(secs): 89.6 total, 28.3 interval\nCumulative writes: 23 writes, 620 keys, 23 commit groups, 1.0 writes per commit group, ingest: 0.00 GB, 0.00 MB/s\nCumulative WAL: 23 writes, 0 syncs, 23.00 writes per sync, written: 0.00 GB, 0.00 MB/s\nCumulative stall: 00:00:0.000 H:M:S, 0.0 percent\nInterval writes: 7 writes, 168 keys, 7 commit groups, 0.9 writes per commit group, ingest: 0.02 MB, 0.00 MB/s\nInterval WAL: 7 writes, 0 syncs, 7.00 writes per sync, written: 0.00 MB, 0.00 MB/s\nInterval stall: 00:00:0.000 H:M:S, 0.0 percent\n","extensions":["Miyabi.BLS","Miyabi.Binary","Miyabi.Asset","Miyabi.Entity","Miyabi.Contract","Miyabi.NFT","Miyabi.PrivateData"],"txErrorCacheCapacity":8000,"txErrorCacheCount":0},"atHeight":22}

# 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
{"value":900.0,"atHeight":1000}
getasset -t test_asset -a 2f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
{"value":100.0,"atHeight":1000}

# Batch with Files

# Notation

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

# Functionality

Should be used with --batch. Executes CLI in batch mode and takes the provided file as input.

# Example


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

{"value":900.0,"atHeight":1000}
{"value":100.0,"atHeight":1000}

# Client Certificate

# Notation

-cc|--client-certificate <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. If specified, it overrides the corresponding value specified in the configuration file.

# Example


$ ./miyabi-cli --host https://10.0.0.8:8000 -cc admin.p12 getnodeconfig
{"value": {"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":[]}, "atHeight":566}

# Client Certificate Password

# Notation

-ccp|--client-certificate-password <password>

# Functionality

Used along with -cc if the certificate is protected by a password. Either the actual password or a file containing the password can be set. If specified, it overrides the corresponding value specified in the configuration file.

# Example


$ ./miyabi-cli --host https://10.0.0.8:9010 -cc admin2.p12 -ccp <password> getnodeconfig
{"value": {"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":[]}, "atHeight":566}

# 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 https://10.0.0.8:9010 -ins -cc admin2.p12 -ccp <password> getnodeconfig
{"value": {"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":[]}, "atHeight":566}

# 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
{"value":{"name":"026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568","version":"3.2.1","status":"Running","startTime":"2024-01-11T05:48:52.8022838Z","height":22,"mempoolSize":0,"identity":"026beca06739461a20249fd4b24cf27542013624d18710bc418e8de10d6ef68568","networkIdentity":"03ea7014d880a711d82cb41a53f2df6138739f4fb904aca2fa22998d4efe9db7be","role":"Consensus","connections":[],"dbStats":"\n** DB Stats **\nUptime(secs): 89.6 total, 28.3 interval\nCumulative writes: 23 writes, 620 keys, 23 commit groups, 1.0 writes per commit group, ingest: 0.00 GB, 0.00 MB/s\nCumulative WAL: 23 writes, 0 syncs, 23.00 writes per sync, written: 0.00 GB, 0.00 MB/s\nCumulative stall: 00:00:0.000 H:M:S, 0.0 percent\nInterval writes: 7 writes, 168 keys, 7 commit groups, 0.9 writes per commit group, ingest: 0.02 MB, 0.00 MB/s\nInterval WAL: 7 writes, 0 syncs, 7.00 writes per sync, written: 0.00 MB, 0.00 MB/s\nInterval stall: 00:00:0.000 H:M:S, 0.0 percent\n","extensions":["Miyabi.BLS","Miyabi.Binary","Miyabi.Asset","Miyabi.Entity","Miyabi.Contract","Miyabi.NFT","Miyabi.PrivateData"],"txErrorCacheCapacity":8000,"txErrorCacheCount":0},"atHeight":22}

# Note

The name of the configuration file is not restricted. If the --config option is not specified, the CLI will attempt to locate a file named config.json in the executable folder.

# 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
{"value":900.0,"atHeight":1000}

# 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
{"value":900.0,"atHeight":1000}

# 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.exe --all-outputs sendtransaction createbinarytable -t "lalala" -p 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529 -o 0249a37736e3290729ea5cd12abe5575cc4153f76dbb540b9b94d929e63d1b6077 -- waittransaction
8a28b646504ceba3519e14c9fc4fcbf3a295fadd3e8695caa715e07f0364fc30

{"resultCode":7,"errorCode":7001,"errorMessage":"table lalala already exists"}