Trait ckb_rpc::module::StatsRpc

source ·
pub trait StatsRpc {
    // Required methods
    fn get_blockchain_info(&self) -> Result<ChainInfo>;
    fn get_deployments_info(&self) -> Result<DeploymentsInfo>;
}
Expand description

RPC Module Stats for getting various statistic data.

Required Methods§

source

fn get_blockchain_info(&self) -> Result<ChainInfo>

Returns statistics about the chain.

§Examples

Request

{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "get_blockchain_info",
  "params": []
}

Response

{
  "id": 42,
  "jsonrpc": "2.0",
  "result": {
    "alerts": [
      {
        "id": "0x2a",
        "message": "An example alert message!",
        "notice_until": "0x24bcca57c00",
        "priority": "0x1"
      }
    ],
    "chain": "ckb",
    "difficulty": "0x1f4003",
    "epoch": "0x7080018000001",
    "is_initial_block_download": true,
    "median_time": "0x5cd2b105"
  }
}
source

fn get_deployments_info(&self) -> Result<DeploymentsInfo>

Returns statistics about the chain.

§Examples

Request

{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "get_deployments_info",
  "params": []
}

Response

{
  "id": 42,
  "jsonrpc": "2.0",
  "result": {
    "epoch": "0x1",
    "hash": "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40",
       "deployments": {
           "testdummy": {
               "bit": 1,
               "min_activation_epoch": "0x0",
               "period": "0xa",
               "since": "0x0",
               "start": "0x0",
               "state": "failed",
               "timeout": "0x0",
               "threshold": {
                    "numer": "0x3",
                    "denom": "0x4"
                }
           }
       }
  }
}

Implementors§