# Utility Commands

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

# Decode From Hex

# Usage

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

Arguments:
  Input   Input data in hex

Options:
  --help  Show help information

# Functionality

Decode the input ByteString 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 ByteString.

# Example


$ ./miyabi-cli.exe encodetohex abc
616263

# 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 -d should be specified otherwise it will be treated as a ByteString. The result is used by state proof.

# Example


$ ./miyabi-cli.exe proofhash 1234
c39867e393cb061b837240862d9ad318c176a96d

# Invoke API

# Usage

Usage: miyabi-cli invokeapi [Options] <Endpoint>

Arguments:
  Endpoint  Endpoint path

Options:
  --help    Show help information

# Functionality

Online general 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"]}},...