# CLI Command Types

The miyabi-cli tool offers a wide range of commands. The commands can be generally categorized on the basis of whether:

  1. The command needs access to running a Miyabi instance or not
  2. The command has the ability to update the world state of Miyabi or not
  3. The command is by default provided by Miyabi or it belongs to a module which extends the miyabi-cli functionality
  4. The command is available for admins only or not

These categories are defined and differentiated below.

# Offline and Online Commands

# Offline Commands

Offline commands can be executed without connecting to any Miyabi nodes. The output of the offline commands, such as transaction IDs, cryptographic keys, smart contract assembly IDs etc, are mostly useful for working with other online commands.

Example:
$ ./miyabi-cli.exe createtransaction createassettable -t bFBC_coin -o 034cdae9dd567b23d29c9affef3ce7ff5c1d16d35512bb72a9008ac32839116118 -p 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529
d2c03300020196d7ffcaefb2605e900724d7ffcaefb2605e900724d7ffcaefb2605e90153491c446d2c03304010191d2a55e00210197a9624642435f636f696ec2c291c421034cdae9dd567b23d29c9affef3ce7ff5c1d16d35512bb72a9008ac3283911611893000102c401009091c42102e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea291c44730450221009a06118ccfd63d011520caf16fdfb99e3499c5981cc578ffdc401b95e21d066b0220106415ed6245f220f06659828ace4fed5b8f7913c3e9bab93db7669c5ee79c7f

# Online Commands

Online commands require connecting to an actively running Miyabi node. The host information can be provided by any of the following methods:

  1. Specifying the IP Address/Port in the --host ` input parameter
  2. Specifying the configuration file with --config input parameter
  3. Placing the configuration file with default name config.json in the current directory

If the host information can not be found using the methods above, the default value will be used.

Example:
$ ./miyabi-cli.exe --config config.json sendtransaction createassettable -t bFBC_coin -o 034cdae9dd567b23d29c9affef3ce7ff5c1d16d35512bb72a9008ac32839116118 -p 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529
9a5c098f99674fed94213909542bab4bc963c9c916669aa862eca6e5631331cd
$ ./miyabi-cli.exe --host <NodeIPAddress>:<Port> sendtransaction createassettable -t bFBC_coin -o 034cdae9dd567b23d29c9affef3ce7ff5c1d16d35512bb72a9008ac32839116118 -p 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529
9a5c098f99674fed94213909542bab4bc963c9c916669aa862eca6e5631331cd

# Default and Module Commands

The miyabi-cli tool is extensible. Miyabi provides a core set of commands out of the box. The Miyabi modules can extend this core set of CLI commands by defining their own new commands. These module-provided sets of commands are referred to as module commands

# Default Commands

Commands that are supported by Miyabi core.

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

# Module Commands

These commands are supported by specific modules. To execute these commands, modules are either specified by -m|--module or registered inside the config file.

Example:
$ ./miyabi-cli.exe --module contract --config config.json getassemblies
{"value":["09e87e0921869507bec81e0578d26f5b3338ba42cad0cf3713eadb1e9a356ac3","0f71271c032c653b1aee757641c005003d20956f742213a63a862dc9bbcff80f"],"atHeight":1221}

# Query and Update Commands

Query commands and update commands are two classifications of online commands.

# Query Commands

Query commands are used to query Miyabi without modifying its world state.

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"]}

# Update Commands

Update commands can be used to update Miyabi's world state. For a non-admin user, only sendtransaction can be used to update Miyabi's world state by sending transactions which are generated from subcommands. For the owner of a Miyabi node, setnodeconfig is an additional update command to override the node config.

Example:
$ ./miyabi-cli.exe --config config.json sendtransaction createassettable -t bFBC_coin -o 034cdae9dd567b23d29c9affef3ce7ff5c1d16d35512bb72a9008ac32839116118 -p 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529
9a5c098f99674fed94213909542bab4bc963c9c916669aa862eca6e5631331cd

# General and Admin Commands

# General Commands

General commands are those commands which can be used by any non-admin users. Most of Miyabi's CLI commands are general commands.

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"]}

# Admin Commands

Admin commands are those commands which require being signed by the private key of the corresponding node's admin and specify the IP/port of the admin endpoint. These commands are online commands.

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