# Tx Operation Command

These commands are designed to modify a transaction or read transaction from the block.

# Add Credential

# Usage

Usage: miyabi-cli addcredential [Options] <Transaction>

Arguments:
  Transaction         Transaction data in hex

Options:
  --help              Show help information
  --credential <hex>  [Mandatory] Binary credential
  --multiple-lines    Allow tx input with multiple lines (Use Ctrl+z or an empty line to signal end of input)

# Functionality

An offline command that adds one credential to the specific transaction's RequiredCredentials field and returns the new transaction. --credential is a required option that takes the public key as input. This command is usually used along with Sign Transaction or Add Evidence.

# Example


$ ./miyabi-cli.exe addcredential d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c0909090 --credential 03b1c86d2ffcd71deccc5404b2589e0b7339217860f398393209f8f8cd20e95138
d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c09091c42103b1c86d2ffcd71deccc5404b2589e0b7339217860f398393209f8f8cd20e9513890

# Add Evidence

# Usage

Usage: miyabi-cli addevidence [Options] <Transaction>

Arguments:
  Transaction       Transaction data in hex

Options:
  --help            Show help information
  --evidence <hex>  [Mandatory] Binary evidence
  --multiple-lines  Allow tx input with multiple lines (Use Ctrl+z or an empty line to signal end of input)

# Functionality

An offline command that adds an evidence (a signature of the transaction) directly to the transaction and returns the new transaction.

# Example


$ ./miyabi-cli.exe addevidence d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c0909090 --evidence 3001
d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c0909091c4023001

# Get Transaction Id

# Usage

Usage: miyabi-cli gettransactionid [Options] <Transaction>

Arguments:
  Transaction  Transaction data in hex or json format

Options:
  --help       Show help information

# Functionality

An offline command that gets the transaction Id of the specific transaction. Transaction data can be serialized to hex string or JSON string and return the transaction Id.

It can be used as an inner command.

# Example


$ ./miyabi-cli.exe gettransactionid d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c0909090
13a550f77d2a1644639706dd023ce290002baf100462eb6eeb628811869a9914

# Sign Transaction

# Usage

Usage: miyabi-cli signtransaction [Options] <Transaction>

Arguments:
  Transaction       Transaction data in hex

Options:
  --help            Show help information
  -k|--key <hex>    [Mandatory] Private key
  --multiple-lines  Allow tx input with multiple lines (Use Ctrl+z or an empty line to signal end of input)

# Functionality

An offline command that signs one transaction with provided private key and returns the new transaction.

# Example


$ ./miyabi-cli.exe signtransaction d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c09091c42103b1c86d2ffcd71deccc5404b2589e0b7339217860f398393209f8f8cd20e9513890 -k e0a3d561fab5ce263131a4f70a1ac4d365c0853fbf97abd1419b32fedbb4add4
d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c09091c42103b1c86d2ffcd71deccc5404b2589e0b7339217860f398393209f8f8cd20e9513891c4473045022100cd28bf6c9326e37d21fa4ddec080e28c148fc0cf63081c2ccc5face65f6a98870220310889c0202c55ae75f9e5b3ec483d2c21c5727de06ae734f9ff3ff2e2123da2

# Update Transactions

# Usage

Usage: miyabi-cli updatetransactions [Options]

Options:
  --help                  Show help information
  -f|--file <path>        [Mandatory] Transactions list file path
  -i|--identities <path>  [Mandatory] Signers keys list file path
  -o|--out <path>         Updated transactions list output file path

# Functionality

An offline command that signs multiple transactions with multiple private keys. -f specifies the file of transactions should be in a JSON format transaction list like the output of get transaction list. -i specifies the file of private keys should be a 2-dimension array that each privatekey[i] represent a list of private keys that should sign transaction i.

# Example


$ ./miyabi-cli.exe updatetransactions -f txs.txt -i keys.txt -o output.txt

# Jsonify Transaction

# Usage

Usage: miyabi-cli jsonifytransaction [Options] <Transaction>

Arguments:
  Transaction  Transaction data in hex

Options:
  --help       Show help information

# Functionality

An offline command that decodes binary transaction and returns JSON format. It can be used with --pretty option.

# Example


$ ./miyabi-cli.exe --pretty jsonifytransaction d2c03300020196d7ff344f8bf062a28c5dd7ff344f8bf062a28c5dd7ff344f8bf062a29a6d91c426ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c0909091c4023001
{
  "entryDetails": [
    {
      "typeName": "AddEntity",
      "entryDetails": {
        "data": "Tissue box 0",
        "tableName": "bFBcEntities",
        "address": "00",
        "owners": []
      }
    }
  ],
  "timestamp": "2022-06-10T00:12:13.2194071Z",
  "validFrom": "2022-06-10T00:12:13.2194071Z",
  "validTo": "2022-06-10T01:12:13.2194071Z",
  "entries": [
    "ce0e4700410195ac54697373756520626f782030ac62464263456e746974696573c40100c090"
  ],
  "requiredCredentials": [],
  "evidence": [
    "3001"
  ],
  "id": "13a550f77d2a1644639706dd023ce290002baf100462eb6eeb628811869a9914",
  "witId": "5d1f029eff535c5cfce81fa153b990ec31e0d80ca3997b3e37560af4479e96b0"
}

# Get Transactions Info

# Usage

Usage: miyabi-cli gettransactioninfos [Options] <Ids>

Arguments:
  Ids     Transaction Ids separated by space. Duplicated Ids will be ignored.

Options:
  --help  Show help information

# Functionality

Online general command that queries the information of multiple transactions based on their transaction Ids.

It can be used as an inner command.

# Example


$ ./miyabi-cli --pretty gettransactioninfos d671078be9c1c8de4ce31543a7bd431c725755757af0dc700c75e62e497f5a47 29c4cf9c08e6b0fd1dd7b87085c3fde699324c2a21882df9b5953e7552675b27
{
  "value": [
    {
      "tx": {
        "entryDetails": [
          {
            "typeName": "CreateAssetTable",
            "entryDetails": {
              "tokenAdmins": [
                "0286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a1174352"
              ],
              "trustedEntities": [],
              "rules": [
                0,
                1,
                2
              ],
              "voidAddress": "00",
              "granularity": {
                "maximumMove": 10000000000.0,
                "minimumMove": 0.01,
                "unit": 0.01
              },
              "name": "Bossu_coin",
              "tracked": false,
              "supportProofs": false,
              "tableAcl": {
                "tableOwners": [
                  "0286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a1174352"
                ],
                "permissions": [],
                "multiKeyPermissions": []
              },
              "isReadRestricted": false,
              "permissionModel": 1
            }
          }
        ],
        "timestamp": "2021-08-16T08:27:06.7908341Z",
        "validFrom": "2021-08-16T08:27:06.7908341Z",
        "validTo": "2021-08-16T09:27:06.7908341Z",
        "entries": [
          "d2a55e0022029baa426f7373755f636f696ec2c29391c4210286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a11743529090c20191c4210286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a11743529093000102c4010093ab3130303030303030303030a4302e3031a4302e3031"
        ],
        "requiredCredentials": [
          "02e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea2"
        ],
        "evidence": [
          "3045022100e6ee8af68d97cc3239a2e7d11a641d8215c6c9a1fb473994b375252200dc3f74022043e90d46f97cef913bc0c8c056b8e8d6913bc680d9b2f17c913c9071bab7970d"
        ],
        "id": "d671078be9c1c8de4ce31543a7bd431c725755757af0dc700c75e62e497f5a47",
        "witId": "58d50c607261e6593cc5274250a3f091e05fda6a06a77c132e1d35d7430e6933"
      },
      "txPtr": {
        "height": 0,
        "idx": 0
      },
      "result": "Success"
    },
    {
      "tx": {
        "entryDetails": [
          {
            "typeName": "CreateAssetTable",
            "entryDetails": {
              "tokenAdmins": [
                "0286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a1174352"
              ],
              "trustedEntities": [],
              "rules": [
                0,
                1,
                2
              ],
              "voidAddress": "00",
              "granularity": {
                "maximumMove": 10000000000.0,
                "minimumMove": 0.01,
                "unit": 0.01
              },
              "name": "Kuku_coin",
              "tracked": false,
              "supportProofs": false,
              "tableAcl": {
                "tableOwners": [
                  "0286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a1174352"
                ],
                "permissions": [],
                "multiKeyPermissions": []
              },
              "isReadRestricted": false,
              "permissionModel": 1
            }
          }
        ],
        "timestamp": "2021-08-16T08:27:30.819422Z",
        "validFrom": "2021-08-16T08:27:30.819422Z",
        "validTo": "2021-08-16T09:27:30.819422Z",
        "entries": [
          "d2a55e0022029ba94b756b755f636f696ec2c29391c4210286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a11743529090c20191c4210286887e5a0d26844f403d0fdae6435e465ba7a8311429ac5443e65b74a11743529093000102c4010093ab3130303030303030303030a4302e3031a4302e3031"
        ],
        "requiredCredentials": [
          "02e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea2"
        ],
        "evidence": [
          "304502210088a7a42354d01b923485e79a0b0f8ee9d9a14e43db73599006bcadd7b669ec9102200cba4710a14d4528d953154e23ad8e3f4cae32e1609d3f7162f97e2083916cd1"
        ],
        "id": "29c4cf9c08e6b0fd1dd7b87085c3fde699324c2a21882df9b5953e7552675b27",
        "witId": "6b5e79eddf66cfb249537c33799d6bb536c5961a6991972c4ea5bed4dccff2a7"
      },
      "txPtr": {
        "height": 1,
        "idx": 0
      },
      "result": "Success"
    }
  ],
  "atHeight": 2
}

# Get Transaction Info

# Usage

Usage: miyabi-cli gettransactioninfo [Options] <Id>

Arguments:
  Id      Transaction Id

Options:
  --help  Show help information

# Functionality

Online general command that queries the information of one transaction according to its transaction Id.

It can be used as an inner command.

# Example


$ ./miyabi-cli.exe --pretty gettransactioninfo b3e86c2b068a2495ef7cae37c4abb9bd5825283a3e39f6c981da18e09e603fd0
{
  "value": {
    "tx": {
      "entryDetails": [
        {
          "typeName": "AddEntity",
          "entryDetails": {
            ...
          }
        }
      ],
      "timestamp": "2020-03-12T07:13:39Z",
      "validFrom": "2020-03-12T07:13:39Z",
      "validTo": "2020-03-12T08:13:39Z",
      "entries": [
    	...
      ],
      "requiredCredentials": [
        "02be78a7eeb4df09f14fd34980df7f2c672a3252edd8665751101ef12d6debbad9"
      ],
      "evidence": [
        "30450221008e6520523cb759a8b0e586b48459b49113dbbf6ff159c1e5869aa2a029d86d7002206546f881a4b691695741a10d13a04ad2d5a942bb8a413c9e84719089abaca949"
      ],
      "id": "b3e86c2b068a2495ef7cae37c4abb9bd5825283a3e39f6c981da18e09e603fd0",
      "witId": "289242f5b9c30f8ff243e593b1217bd947384e2119259a76cf4694a133032b9d"
    },
    "txPtr": {
      "height": 877,
      "idx": 0
    },
    "result": "InvalidOperation"
  },
  "atHeight": 1241
}

# Get Transaction List

# Usage

Usage: miyabi-cli gettransactionlist [Options]

Options:
  --help             Show help information
  -h|--height <num>  [Mandatory] Block height

# Functionality

Online general command that queries transaction list for a specific height.

# Example


$ ./miyabi-cli.exe --pretty gettransactionlist -h 1
{
  "value": [
    {
      "tx": {
        "timestamp": "2019-11-14T03:18:51.1958708Z",
        "validFrom": "2019-11-14T03:18:51.1958708Z",
        "validTo": "2019-11-14T04:18:51.1958708Z",
        "entries": [
          "d2a55e00410193aa746573745f6173736574a431303030c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
        ],
        "requiredCredentials": [
          "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
        ],
        "evidence": [
          "3045022100a44e85d4db0eef38d0aba2aa8c729a958f1f82ea3be68e1eac78746936e01f390220275c17024f147435b62c6e06f3c60c486a42177e540dafbe2205e8302900b537"
        ],
        "id": "0430dba1b43671ee984a2ee12f1b116ecddd31622c0d3b196232175c17b40c0e",
        "witId": "b725470a278407e89072a0255ee71892737c412009a863126a35f1c0be8c892d"
      },
      "txPtr": {
        "height": 1,
        "idx": 0
      },
      "result": "Success"
    }
  ],
  "atHeight": 6
}

# Get Transaction Result

# Usage

Usage: miyabi-cli gettransactionresult [Options] <Id>

Arguments:
  Id      Transaction Id

Options:
  --help  Show help information

# Functionality

Online general command to get the result of a transaction.

It can be used as an inner command.

# Example


$ ./miyabi-cli.exe gettransactionresult b3e86c2b068a2495ef7cae37c4abb9bd5825283a3e39f6c981da18e09e603fd0
{"resultCode":7,"errorMessage":"Operation is not valid due to the current state of the object."}

# Get Transaction Results

# Usage

Usage: miyabi-cli gettransactionresults [Options] <Ids>

Arguments:
  Ids     Transaction Ids separated by space. Duplicated Ids will be ignored.

Options:
  --help  Show help information

# Functionality

Online general command to get the brief result of multiple transactions.

# Example


$ ./miyabi-cli.exe gettransactionresults b3e86c2b068a2495ef7cae37c4abb9bd5825283a3e39f6c981da18e09e603fd0 42d99951b93b73a11cd2829da124a3eac6af991cc1fd99ae6047247bde8e097c
["InvalidOperation","Success"]

# Wait Transaction

# Usage

Usage: miyabi-cli waittransaction [Options] <ID>

Arguments:
  ID      Transaction ID

Options:
  --help  Show help information

# Functionality

Online general command that tries to get the result of a transaction that is not pending.

It can be used as an inner command.

# Example


$ ./miyabi-cli.exe waittransaction 42d99951b93b73a11cd2829da124a3eac6af991cc1fd99ae6047247bde8e097c
{"resultCode":0}