# Block Related Commands

Block related commands are all online general commands.

# Get Height

# Usage

Usage: miyabi-cli getheight [Options]

Options:
  --help  Show help information

# Functionality

Return the current height of the blockchain stored in the connected node.

# Example


$ ./miyabi-cli getheight 
8

# Get Block [Obsolete]

# Usage

Usage: miyabi-cli getblock [options]

Options:

--help             Show help information
-h|--height <num>  Block height 
-i|--id <hex>      Block id 

# Functionality

Return the specific block information of the given height or block Id. -i or-h options need to be specified.

Obsolete: Please use getblockbyid or getblockbyheight

# Example


$ ./miyabi-cli --pretty getblock -h 2 
{ 
  "value": { 
    "txCount": 1, 
    "sizeBytes": 920, 
    "height": 2, 
    "id": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d", 
    "header": { 
      "previousBlock": "cb4717e95d5a971628209e5abc6745085c2b9c7f06ca2718cb84b2c89795499f", 
      "transactionsMerkleRoot": "74f07b7c678f380e2341fcffedb01f14f2d097da0450cd5d40061605c0580c3e", 
      "eventsMerkleRoot": "5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456", 
      "stateHash": "a96e5095636bb074ab59f3495db4bfb16ea68146", 
      "eventFilter": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 
	  "timestamp": "2019-11-12T06:27:10.073411Z" 
    }, 
    "evidence": { 
      "acceptStatement": { 
        "height": 2, 
        "round": 39, 
        "proposalDigest": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d" 
      }, 
      "evidence": [ 
        "3045022100cb851abedb839db98e64e5fbbbb7a785d843faa25502f0a50aa16fde1df42b900220161e7797061eb4e876f196b51ad38035d9e234ff753756dd66caeb0f19a309b8" 
      ] 
    } 
  }, 
  "atHeight": 4 
}

# Get Block By Height

# Usage

Usage: miyabi-cli getblockbyheight [Options] <Height>

Arguments:
  Height  Block height

Options:
  --help  Show help information

# Functionality

Return the specific block information at the given height.

# Example


$ ./miyabi-cli --pretty getblockbyheight 2
{ 
  "value": { 
    "txCount": 1, 
    "sizeBytes": 920, 
    "height": 2, 
    "id": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d", 
    "header": { 
      "previousBlock": "cb4717e95d5a971628209e5abc6745085c2b9c7f06ca2718cb84b2c89795499f", 
      "transactionsMerkleRoot": "74f07b7c678f380e2341fcffedb01f14f2d097da0450cd5d40061605c0580c3e", 
      "eventsMerkleRoot": "5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456", 
      "stateHash": "a96e5095636bb074ab59f3495db4bfb16ea68146", 
      "eventFilter": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 
	  "timestamp": "2019-11-12T06:27:10.073411Z" 
    }, 
    "evidence": { 
      "acceptStatement": { 
        "height": 2, 
        "round": 39, 
        "proposalDigest": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d" 
      }, 
      "evidence": [ 
        "3045022100cb851abedb839db98e64e5fbbbb7a785d843faa25502f0a50aa16fde1df42b900220161e7797061eb4e876f196b51ad38035d9e234ff753756dd66caeb0f19a309b8" 
      ] 
    } 
  }, 
  "atHeight": 4 
}

# Get Block By Id

# Usage

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

Arguments:
  Id      Block id

Options:
  --help  Show help information

# Functionality

Return the specific block information for the given block Id.

# Example


$ ./miyabi-cli --pretty getblockbyid adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d
{ 
  "value": { 
    "txCount": 1, 
    "sizeBytes": 920, 
    "height": 2, 
    "id": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d", 
    "header": { 
      "previousBlock": "cb4717e95d5a971628209e5abc6745085c2b9c7f06ca2718cb84b2c89795499f", 
      "transactionsMerkleRoot": "74f07b7c678f380e2341fcffedb01f14f2d097da0450cd5d40061605c0580c3e", 
      "eventsMerkleRoot": "5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456", 
      "stateHash": "a96e5095636bb074ab59f3495db4bfb16ea68146", 
      "eventFilter": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 
	  "timestamp": "2019-11-12T06:27:10.073411Z" 
    }, 
    "evidence": { 
      "acceptStatement": { 
        "height": 2, 
        "round": 39, 
        "proposalDigest": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d" 
      }, 
      "evidence": [ 
        "3045022100cb851abedb839db98e64e5fbbbb7a785d843faa25502f0a50aa16fde1df42b900220161e7797061eb4e876f196b51ad38035d9e234ff753756dd66caeb0f19a309b8" 
      ] 
    } 
  }, 
  "atHeight": 4 
}

# Get Blocks

# Usage

Usage: miyabi-cli getblocks [Options]

Options:
  --help                  Show help information
  -d|--depth <num>        Depth
  -s|--startheight <num>  Start height

# Functionality

Return blocks from startheight to min(startheight + depth, current height). depth's default value is 10, and there is an upper bound defined in the node config. The default value of startheight is max(0, current height - depth).

# Example


$ ./miyabi-cli --pretty getblocks  
{
  "value": [
    {
      "txCount": 1,
      "sizeBytes": 852,
      ...
      "height": 1234,
      "id": "69531d13c100b9fda288c62660a8e5d4c5974f47571f6ac1bef49c0d505ce7ba",
      "header": {
        "previousBlock": "739e7a84618fdb03accb5aa22d6cf6a4ff0bc2d77de1c677c4a5bbc3525a5d64",
        "transactionsMerkleRoot": "4772b0ba878425f0386a50672642499ebef41b40a6dc3040dea199577ecf0621",
        ...
   "evidence": {
        "acceptStatement": {
          "height": 1225,
          "round": 0,
          "proposalDigest": "1893d3e4f753e45dcfede90e8113d1ddd564796dc54f76a65def92b98518508c"
        },
        ...
  "atHeight": 1235
}

# Get Header [Obsolete]

# Usage

Usage: miyabi-cli getheader [Options]

Options:
  --help             Show help information
  -h|--height <num>  Block height
  -i|--id <hex>      Block id

# Functionality

Return the block header of a specific height or block Id. -i or-h option need to be specified.

Obsolete: Please use getheaderbyid or getheaderbyheight

# Example


$ ./miyabi-cli --pretty getheader -h 2  
{ 
  "value": { 
    "height": 2, 
    "id": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d", 
    "header": { 
      "previousBlock": "cb4717e95d5a971628209e5abc6745085c2b9c7f06ca2718cb84b2c89795499f", 
     ...
    "evidence": { 
      "acceptStatement": { 
        "height": 2, 
        "round": 39, 
        "proposalDigest": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d" 
      }, 
      "evidence": [  "3045022100cb851abedb839db98e64e5fbbbb7a785d843faa25502f0a50aa16fde1df42b900220161e7797061eb4e876f196b51ad38035d9e234ff753756dd66caeb0f19a309b8" 
      ]
    } 
  }, 
  "atHeight": 8 
}

# Get Header By Height

# Usage

Usage: miyabi-cli getheaderbyheight [Options] <Height>

Arguments:
  Height  Block height

Options:
  --help  Show help information

# Functionality

Return the block header at a specific block height.

# Example


$ ./miyabi-cli --pretty getheaderbyheight 2  
{ 
  "value": { 
    "height": 2, 
    "id": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d", 
    "header": { 
      "previousBlock": "cb4717e95d5a971628209e5abc6745085c2b9c7f06ca2718cb84b2c89795499f", 
     ...
    "evidence": { 
      "acceptStatement": { 
        "height": 2, 
        "round": 39, 
        "proposalDigest": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d" 
      }, 
      "evidence": [  "3045022100cb851abedb839db98e64e5fbbbb7a785d843faa25502f0a50aa16fde1df42b900220161e7797061eb4e876f196b51ad38035d9e234ff753756dd66caeb0f19a309b8" 
      ]
    } 
  }, 
  "atHeight": 8 
}

# Get Header By Id

# Usage

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

Arguments:
  Id      Block id

Options:
  --help  Show help information

# Functionality

Return the block header for a specific block Id.

# Example


$ ./miyabi-cli --pretty getheaderbyid adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d
{ 
  "value": { 
    "height": 2, 
    "id": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d", 
    "header": { 
      "previousBlock": "cb4717e95d5a971628209e5abc6745085c2b9c7f06ca2718cb84b2c89795499f", 
     ...
    "evidence": { 
      "acceptStatement": { 
        "height": 2, 
        "round": 39, 
        "proposalDigest": "adff51c544a6c76256a5679b00ab02a2ef1ec9f48d3ae5c30ba652a87132579d" 
      }, 
      "evidence": [  "3045022100cb851abedb839db98e64e5fbbbb7a785d843faa25502f0a50aa16fde1df42b900220161e7797061eb4e876f196b51ad38035d9e234ff753756dd66caeb0f19a309b8" 
      ]
    } 
  }, 
  "atHeight": 8 
}

# Get Headers

# Usage

Usage: miyabi-cli getheaders [Options]

Options:
  --help                  Show help information
  -d|--depth <num>        Depth
  -s|--startheight <num>  Start height

# Functionality

Return the specific block headers. Usage of -d and -s is the same as getblocks

# Example


$ ./miyabi-cli  --pretty getheaders -s 1 -d 2 
{
  "value": [
    {
      "height": 2,
      "id": "c999e807740129f0ab077357148fd9d8219d78ac9f00aca99e9ff2627d5a3f51",
      "header": {
        "previousBlock": "a5af0fd90d426437e29d46628b8cf3740b0ec92d1d06dba3f30bf98c61690c35",
        "transactionsMerkleRoot": "314112692a5f677cbf20e38c0715697d8ce5f87ea9cb7936b712dd953f2f69f0",
        "eventsMerkleRoot": "5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456",
        "stateHash": "d0018f34a0fdf78d18e67efbb0e19c259425f315",
        ...
    },
    {
      "height": 1,
      "id": "a5af0fd90d426437e29d46628b8cf3740b0ec92d1d06dba3f30bf98c61690c35",
      "header": {
        "previousBlock": "3fa99c2cbeb82352f455846fddcda8ed0fdf196aa259cd895fe0d77b4d21c54e",
        "transactionsMerkleRoot": "0b5f7086580ab12718bc2b107c449c27f627c2ad999d4e65205cd6a0ad981462",
        ...
    }
  ],
  "atHeight": 1239
}

# Get Block Events [Obsolete]

# Usage

Usage: miyabi-cli getblockevents [Options]

Options:
  --help                Show help information
  -i|--id <hex>         Block id
  -h|--height <height>  Block height

# Functionality

Return the block events of a specific height or block Id. -i or -h options need to be specified.

Obsolete: Please use getblockeventsbyid or getblockeventsbyheight

# Example


$ ./miyabi-cli --pretty getblockevents -h 2  
{ 
  "value": { 
    "id": "cb67466866056d64230948078b806140fab4e6bb4ed9cdb561cf125ac72bb1c4", 
    "events": [ 
      { 
        "txIndex": 0, 
        "txId": "f76f01358d9f04f9982dced015d68f0762e3f87e60d9bf6c033e56f0aa596181", 
        "events": [ 
          { 
            "eventDataType": "ContractEventData", 
            "originatingEntry": "ContractInvoke", 
            "eventData": { 
              "eventName": "SampleEvent", 
              "originatingContract": "808215076d034831981017cbe4882d28b87ab6a76cdd78c678e0fca9b356a19497", 
              "eventValue": "{\"message\":\"Write is called\"}", 
              "filterData": [ 
                "53616d706c654576656e74", 
     "808215076d034831981017cbe4882d28b87ab6a76cdd78c678e0fca9b356a19497" 
              ], 
              "type": "ContractEventData" 
            } 
          } 
        ], 
        "filterData": "00000000000000000000010000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400002000200000000000000000000000000000000000000000000000000001000000000000000000000000400000000000000000000000000000000000000000000000000000000010000000000000000000000" 
      } 
    ] 
  }, 
"atHeight": 3
}

# Get Block Events By Height

# Usage

Usage: miyabi-cli getblockeventsbyheight [Options] <Height>

Arguments:
  Height  Block height

Options:
  --help  Show help information

# Functionality

Return the block events at a specific height.

# Example


$ ./miyabi-cli --pretty getblockeventsbyheight 2  
{ 
  "value": { 
    "id": "cb67466866056d64230948078b806140fab4e6bb4ed9cdb561cf125ac72bb1c4", 
    "events": [ 
      { 
        "txIndex": 0, 
        "txId": "f76f01358d9f04f9982dced015d68f0762e3f87e60d9bf6c033e56f0aa596181", 
        "events": [ 
          { 
            "eventDataType": "ContractEventData", 
            "originatingEntry": "ContractInvoke", 
            "eventData": { 
              "eventName": "SampleEvent", 
              "originatingContract": "808215076d034831981017cbe4882d28b87ab6a76cdd78c678e0fca9b356a19497", 
              "eventValue": "{\"message\":\"Write is called\"}", 
              "filterData": [ 
                "53616d706c654576656e74", 
     "808215076d034831981017cbe4882d28b87ab6a76cdd78c678e0fca9b356a19497" 
              ], 
              "type": "ContractEventData" 
            } 
          } 
        ], 
        "filterData": "00000000000000000000010000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400002000200000000000000000000000000000000000000000000000000001000000000000000000000000400000000000000000000000000000000000000000000000000000000010000000000000000000000" 
      } 
    ] 
  }, 
"atHeight": 3
}

# Get Block Events By Id

# Usage

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

Arguments:
  Id      Block id

Options:
  --help  Show help information

# Functionality

Return the block events for a specific block Id.

# Example


$ ./miyabi-cli --pretty getblockeventsbyid cb67466866056d64230948078b806140fab4e6bb4ed9cdb561cf125ac72bb1c4  
{ 
  "value": { 
    "id": "cb67466866056d64230948078b806140fab4e6bb4ed9cdb561cf125ac72bb1c4", 
    "events": [ 
      { 
        "txIndex": 0, 
        "txId": "f76f01358d9f04f9982dced015d68f0762e3f87e60d9bf6c033e56f0aa596181", 
        "events": [ 
          { 
            "eventDataType": "ContractEventData", 
            "originatingEntry": "ContractInvoke", 
            "eventData": { 
              "eventName": "SampleEvent", 
              "originatingContract": "808215076d034831981017cbe4882d28b87ab6a76cdd78c678e0fca9b356a19497", 
              "eventValue": "{\"message\":\"Write is called\"}", 
              "filterData": [ 
                "53616d706c654576656e74", 
     "808215076d034831981017cbe4882d28b87ab6a76cdd78c678e0fca9b356a19497" 
              ], 
              "type": "ContractEventData" 
            } 
          } 
        ], 
        "filterData": "00000000000000000000010000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400002000200000000000000000000000000000000000000000000000000001000000000000000000000000400000000000000000000000000000000000000000000000000000000010000000000000000000000" 
      } 
    ] 
  }, 
"atHeight": 3
}

# Get Blockchain Parameters

# Usage

Usage: miyabi-cli getblockchainparameters [Options]

Options:
  --help                Show help information
  -h|--height <height>  Specify the height for which the Blockchain Parameters are requested. If not specified, returns
                        Blockchain Parameters for the current height.

# Functionality

Returns the Blockchain Parameters for the blockchain at a given height h. The default value is the current height of the blockchain

# Example


$ ./miyabi-cli --pretty getblockchainparameters -h 34
{
  {
  "maxtpb": 8000,
  "emptyBlocks": false,
  "transactionLifetime": "01:00:00",
  "byzantineAssumption": true,
  "evidenceValidatorType": "",
  "maxClockDrift": "00:00:10",
  "networkName": "",
  "initScript": "[{\"type\": \"CreateAssetTable\", \"name\": \"TestInitAssetTable\", \"tracked\": \"false\", \"supportProofs\": \"false\", \"tableAcl\": {\"tableOwners\": [\"03b25c2a2e3793e14797dd100b668da2023e2bb03cf7b9a25d0b1f28487b856054\"]}, \"isReadRestricted\": \"false\", \"permissionModel\": \"CheckRowOnly\", \"tokenAdmins\": [\"03b25c2a2e3793e14797dd100b668da2023e2bb03cf7b9a25d0b1f28487b856054\"]}, {\"type\": \"ContractInitialize\", \"contractAdmins\": [\"0315ebc05445e3f9936732210aefb03781fe38558582666082571d4d6901c18cb9\", \"02284ecf010803f287dee92b8403ab6bdba590dcb0e5434b97fb3dcecfbab6ca34\", \"039dd634a89c706057df02b2491257d542970ac0776b58d9881dffd3af88004106\", \"02031868856c8bb0f1c8fdbc1acb728dc7dca5e7560ce68225c540bdd0dd077aef\", \"029666b7cb79a26111a7ec73471a2dcf848737e63d2a861d741b6cc5f9d04013e0\", \"023313b277629f6168febbaea102ca1f86be1b954570312b9b5725c4d7f997e766\", \"037e9e76c4ca5f777d4a9fed89e94b7febfa3e2959e105fc80ef708242b0cc76f6\", \"03ec41bba53d90ccaa12ee5d432d4d6179d465e97ecdaa716dbf67170cfe1d1620\", \"029d549131d0c2cee9de4b81e6d0f9f9b441adc7ec33434aa74503f554dd158423\", \"029bba801c2bf5574f79b767404a29c6ffaaf551e762ca9a630ddcc24d4dd1f361\"], \"contractDebug\": true}]",
  "extensions": [
    {
      "name": "Miyabi.BLS",
      "publicKey": ""
    },
    {
      "name": "Miyabi.Binary",
      "publicKey": ""
    },
    {
      "name": "Miyabi.Asset",
      "publicKey": ""
    },
    {
      "name": "Miyabi.Entity",
      "publicKey": ""
    },
    {
      "name": "Miyabi.Contract",
      "publicKey": ""
    },
    {
      "name": "Miyabi.NFT",
      "publicKey": ""
    }
  ],
  "blockLimit": {
    "MaxEntriesPerTransaction": 100,
    "MaxTransactionByteSize": 1000000
  }
}
}