# State Query Commands

The state query commands query the world state to get information. As these commands need to fetch world state data from the node, these are all online general commands.

# Get Tables

# Usage

Usage: miyabi-cli gettables [Options]

Options:
  --help  Show help information

# Functionality

Return TableDescriptor of all tables.

# Example


$ ./miyabi-cli --pretty gettables
[
  {
    "tableAcl": {
      "tableOwners": [
        "020000000000000000000000000000000000000000000000000000000000000000"
      ],
      "permissions": [],
      "multiKeyPermissions": []
    },
    "isReadRestricted": false,
    "permissionModel": 2,
    "name": "ContractAssemblies",
    "tracked": false,
    "supportProofs": false,
    "type": "BinaryTable"
  },
  {
    "name": "BLOCKCHAIN_PARAMETERS",
    "tracked": false,
    "supportProofs": true,
    "type": "BlockchainParametersTable"
  },
  {
    "admins": [
      "02556b8f72dcf64b99a4c5daab87a9af5bd9d3e8922e0373eab8471521178e53f2",
      "0368c948e1aebfc264fcb1f0e0e600b9e7264ccb38be00fd3770e6e9df3d075db8",
      "029203d09335e102c6c5fd871fc478d1291c62b2722b822dcb81d4e487605c69d3",
      "03e42e0355eca87d5fbd506288ca7b90254921ea0b230e4308018274e4f2b14789",
      "035c43df1be2f74c11021d1dca3880e8ae117d6481ace6db02ff69eb2dc77a3144",
      "03a5e9962538bf8d7b31afe78cc470cba01b026579b633682a0734b34de842b2f8",
      "0229e33ced4f187b87b41f823dad363bdd117fb25ff672dcf231c58d8cadf97ad4",
      "02ff93893a3d4a73b8d5e277321a4342b0342a61f3983c43017dc8937d202dbef5",
      "037444f4d10efb7ce71365e47eea4e0610daa0170ec5349f46a3529c0233dff04d",
      "0331079993eea7e9adfe54f3fbcc3ff16c048abc9550a16176d04adaa764df313d"
    ],
    "multiSigThreshold": 3,
    "name": "CONSENSUS_CREDENTIALS",
    "tracked": false,
    "supportProofs": true,
    "type": "ConsensusCredentialsTable"
  },
  ...
]

# Get History

# Usage

Usage: miyabi-cli gethistory [Options]

Options:
  --help             Show help information
  -t|--table <name>  [Mandatory] Table name
  -k|--key <hex>     [Mandatory] Key of the entry
  -d|--detail        Show details

# Functionality

Return the historical transaction ids that have updated the entry specified by -t and -k.

# Example


$ ./miyabi-cli --pretty gethistory -t MyTable -k 00 -s 0
[
  "1d25ca4e849ea47de915513583ab1536ba6e011ddaca713ed36699213ddc73a0",
  "0999d6fa89c42b8774a95a34e1b66ec7596ecaed0a924909320715f0727a2aa8"
]

# Get State Proof

# Usage

Usage: miyabi-cli getstateproof [Options]

Options:
  --help             Show help information
  -t|--table <name>  [Mandatory] Table name
  -k|--key <hex>     [Mandatory] Entry key
  -h|--hash <hex>    Value hash

# Functionality

Return the state proof of entry. The result contains two paths for the existence of table and the existence of table entry. -h can be used to specify the hash of the value -t and -k suggested.

The hash should be calculated by RIPEMD160. Users can use proof hash to calculate it. If the hash is incorrect, table entry proof will not be generated. However, if the hash is not specified, CLI will automatically calculate it.

# Example


$ ./miyabi-cli --pretty getstateproof -t AssetTable -k 03b1c86d2ffcd71deccc5404b2589e0b7339217860f398393209f8f8cd20e95138
{
  "atHeight": 40,
  "proof": {
    "tableProof": {
      "paths": [
        {
          "key": "c778fca326bc4e9e8a750054f8d77b39eb0e853b5aaf0eb8b73ddd0414fe2110",
          "valueHash": "357b3d62694c585d1c59925369cab6dacfec5a7c",
          "steps": [
            1,
            0,
            1
          ]
        }
      ],
      "neighbours": [
        "017e0562b204b7d4b2ecd17d74c9025a81b713af",
        "9fb0e4797f04c6a826fc2cf21911441ea5f530cb",
        "fce1179c4e96ae19851c5a3bb8ff721876ce26d4"
      ]
    },
    "tableEntryProof": {
      "paths": [
        {
          "key": "03b1c86d2ffcd71deccc5404b2589e0b7339217860f398393209f8f8cd20e95138",
          "valueHash": "ea396e7c36884c60316caa5dc5132148aaa2b2b7",
          "steps": [
            1
          ]
        }
      ],
      "neighbours": [
        "72ba6ea0d756739ed85a93550a4f4d3b687697fd"
      ]
    }
  },
  "proofRoot": "9eaa8865d04ce077dae716dcb90e093b0cfa7ed4"
}