# Utility Commands

Utility commands are used to transform data to satisfy the requirement of different options. All commands are offline commands except invoke API.

# Decode From Hex

# Usage

Arguments:
Input   Input data in hex

Options:
--help  Show help information

# Functionality

Decode the input byte string to utf-8 string.

# Example

$ ./miyabi-cli.exe decodefromhex 616263
abc

# Note

Display of utf-8 string depends on the bash or cmd, but correctness is guaranteed.

# Encode To Hex

# Usage

Usage: miyabi-cli encodetohex [Options] <Input>

Arguments:
Input   Input data in string

Options:
--help  Show help information

# Functionality

Encode the input utf-8 string to a byte string.

# Example

$ ./miyabi-cli.exe encodetohex abc
616263

# Generate Multi-Signature

# Usage

Usage: miyabi-cli generatemultisig [Options] <Public keys>

Arguments:
Public keys             Number of required keys (M)

Options:
--help                  Show help information
-r|--required <number>  Required number of keys (M)

# Functionality

Generate a public key of a naïve n of m multi-signature schema. -r specified the number n and m is determined by the number of arguments.

# Example

$ ./miyabi-cli.exe generatemultisig 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5 02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9 -r 2
90028559d2e5156b49ef3e2981bdad76846c49c9b479bcefc001b429ca5f738f5ebc15591c21aa03af7ee1c903c0d8d2b6458ffbe8e936cf395ef18b9c89

# Proof Hash

# Usage

Usage: miyabi-cli proofhash [Options] <Data>

Arguments:
Data          Data (default hex)

Options:
--help        Show help information
-d|--decimal  Data is decimal

# Functionality

Return the RIPEMD160 hash of the given data, if the data is decimal should be specified by -d otherwise it will be treated as a byte string. The result is used by state proof.

# Example

$ ./miyabi-cli.exe proofhash 1234
c39867e393cb061b837240862d9ad318c176a96d

# Invoke API

# Usage

Usage: miyabi-cli invokeapi <Endpoints>

Arguments:
Endpoint  Endpoint path

Options:
--help    Show help information

# Functionality

Online general reference command that directly sends a get request to the API. Url is <host>\<Endpoint> where the host is defined by --host or configuration file.

# Example

$ ./miyabi-cli.exe invokeapi blocks
[{"txCount":1,"sizeBytes":926,"height":5,"id":"438042096c7244ec6e9d68ff14f6459771abe5340bba62a18ea9f003fe14e573","header":{"previousBlock":"a4b0664ab9cd0fbf3ce06957978e2c025b5a81b45be814f267c0cfb650b7ed6f","transactionsMerkleRoot":"f64737390385c91f4ea662bcb14bcdfc1387f7bfef39ffe219047fd1d79f45c2","eventsMerkleRoot":"5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456","stateHash":"48a68eff365ef486954640ce75f2bac165faa56d","eventFilter":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","timestamp":"2019-11-14T03:36:40.6493447Z"},"evidence":{"acceptStatement":{"height":5,"round":0,"proposalDigest":"438042096c7244ec6e9d68ff14f6459771abe5340bba62a18ea9f003fe14e573"},"evidence":["3045022100fea97a00f28982cdfd58aa7d59727e30bad4510c6ba0356d3a9d223a61649d5a02205c8de88b2f47ff851091e97ee7faa1bdf5f348df5f5f21c81c6d330f9822d3ca"]}},...