# 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]

Arguments:
Transaction         Transaction data in hex

Options:
--help                    Show help information
--credential <hex>        Binary credential
--multiple-lines <bool>   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 RequiredCredential field and returns the new transaction. --credential is a required option that takes the public key as input. This command usually use along with Sign Transaction or Add evidence.

# Example

$ ./miyabi-cli.exe addcredential d2c03300020196d7ff776d5d405dca5d32d7ff776d5d405dca5d32d7ff776d5d405dca6b4291c45cd2a55e00420194aa746573745f6173736574a3313030c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5c42102f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f991c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee591c4463044022005c6fdc572f4289cc1f703ecfa1d04bdcfba822f1743a44260361d54788069a002202da75cfe3b455f3524607d4e5b9b6b9ec186ddc71593d85496974439ed56237b --credential 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
d2c03300020196d7ff776d5d405dca5d32d7ff776d5d405dca5d32d7ff776d5d405dca6b4291c45cd2a55e00420194aa746573745f6173736574a3313030c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5c42102f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f992c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5c4210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179891c4463044022005c6fdc572f4289cc1f703ecfa1d04bdcfba822f1743a44260361d54788069a002202da75cfe3b455f3524607d4e5b9b6b9ec186ddc71593d85496974439ed56237b 

# Add Evidence

# Usage

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

Arguments:
Transaction       Transaction data in hex

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

# Functionality

An offline command adds evidence(a signature of the transaction) direct to the transaction and returns the new transaction. --evidence is required.

# Example

$ ./miyabi-cli.exe addevidence d2c03300020196d7ff776d5d405dca5d32d7ff776d5d405dca5d32d7ff776d5d405dca6b4291c45cd2a55e00420194aa746573745f6173736574a3313030c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5c42102f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f991c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee591c4463044022005c6fdc572f4289cc1f703ecfa1d04bdcfba822f1743a44260361d54788069a002202da75cfe3b455f3524607d4e5b9b6b9ec186ddc71593d85496974439ed56237b --evidence 3001
d2c03300020196d7ff776d5d405dca5d32d7ff776d5d405dca5d32d7ff776d5d405dca6b4291c45cd2a55e00420194aa746573745f6173736574a3313030c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5c42102f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f991c42102c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee592c4463044022005c6fdc572f4289cc1f703ecfa1d04bdcfba822f1743a44260361d54788069a002202da75cfe3b455f3524607d4e5b9b6b9ec186ddc71593d85496974439ed56237bc4023001

# Get Transaction Id

# Usage

Usage: miyabi-cli gettransactionid [options] <TxData>

Arguments:
Transaction     Transaction data in hex

Options:
--help                         Show help information

# Functionality

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

# Example

$ ./miyabi-cli.exe gettransactionid d2c03300020196d7ffe8a947805dccdae9d7ffe8a947805dccdae9d7ffe8a947805dcce8f991c447d2c03304010191d2a55e00210197aa746573745f6173736574c2c291c4210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179893000102c401009091c42102e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea291c446304402203aaced00e6f5bf878d4bd4a5f4d43ad7648578212c5008d2c16aafbc6a15b9fa02206668e4fec49fae5ac11c993796f78c5654f3e0e350cf82d0c439180f96b5ccf7
1724270ab7faa87f6cd7a2d4c6e47151a84461304b896be8ec14b4393d916f35

# Sign Transaction

# Usage

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

Arguments:
Transaction     Transaction data in hex

Options:
--help          Show help information
-k|--key <hex>  Private key

# Functionality

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

# Example

$ ./miyabi-cli.exe signtransaction d2c03300020196d7ffe8a947805dccdae9d7ffe8a947805dccdae9d7ffe8a947805dcce8f991c447d2c03304010191d2a55e00210197aa746573745f6173736574c2c291c4210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179893000102c401009091c42102e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea291c446304402203aaced00e6f5bf878d4bd4a5f4d43ad7648578212c5008d2c16aafbc6a15b9fa02206668e4fec49fae5ac11c993796f78c5654f3e0e350cf82d0c439180f96b5ccf7 -k 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529
d2c03300020196d7ffe8a947805dccdae9d7ffe8a947805dccdae9d7ffe8a947805dcce8f991c447d2c03304010191d2a55e00210197aa746573745f6173736574c2c291c4210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179893000102c401009091c42102e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea291c446304402203aaced00e6f5bf878d4bd4a5f4d43ad7648578212c5008d2c16aafbc6a15b9fa02206668e4fec49fae5ac11c993796f78c5654f3e0e350cf82d0c439180f96b5ccf7 

# Update Transactions

# Usage

Usage: miyabi-cli updatetransactions [Options]

Options:
--help                  Show help information
-f|--file <path>        Transactions list file path
-i|--identities <path>  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 specified the file of transactions should be in a JSON format transaction list like the output of get transaction list. -i specify 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 d2c03300020196d7ffe8a947805dccdae9d7ffe8a947805dccdae9d7ffe8a947805dcce8f991c447d2c03304010191d2a55e00210197aa746573745f6173736574c2c291c4210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179893000102c401009091c42102e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea291c446304402203aaced00e6f5bf878d4bd4a5f4d43ad7648578212c5008d2c16aafbc6a15b9fa02206668e4fec49fae5ac11c993796f78c5654f3e0e350cf82d0c439180f96b5ccf7
{
  "entryDetails": [
    {
      "typeName": "CreateTable",
      "entryDetails": {
        ...
       }
    }
  ],
  "timestamp": "2019-11-14T04:41:13.975852Z",
  "validFrom": "2019-11-14T04:41:13.975852Z",
  "validTo": "2019-11-14T05:41:13.975852Z",
  "entries": [     "d2c03304010191d2a55e00210197aa746573745f6173736574c2c291c4210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179893000102c4010090"
  ],
  "requiredCredentials": [
    "02e3c13b6862eda179ac49d03b334ef17cf654c05bd3fa6dc0cf6078fefe82aea2"
  ],
  "evidence": [    "304402203aaced00e6f5bf878d4bd4a5f4d43ad7648578212c5008d2c16aafbc6a15b9fa02206668e4fec49fae5ac11c993796f78c5654f3e0e350cf82d0c439180f96b5ccf7"
  ],
  "id": "1724270ab7faa87f6cd7a2d4c6e47151a84461304b896be8ec14b4393d916f35",
  "witId": "d3a4fea0ddc508e6385f0d958845e2bcbee701fdbe2442e4ac38369eddd32405"
} 

# Get Transactions Info

# Usage

Usage: miyabi-cli gettransactioninfos [options] <ids>

Arguments:
ids      Transaction IDs separated by space

Options:
--help  Show help information

# Functionality

Online reference general command that query the information of multiple transactions based on their transaction ids ids.

# 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 reference general Command that query the information of one transaction according to its transaction Id.

# 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>  Block height

# Functionality

Online reference general command that query transaction list of a specific height. -h is required.

# 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 reference general command to get the result of a transaction.

# 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

Options:
--help  Show help information

# Functionality

Online reference 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 reference command that will try to get the result of a transaction that is not pending.

# Example

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