Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

This doc introduce the usage of CovenantSQL block producer chain explorer server.

Prerequisites

Make sure the $GOPATH/bin is in your $PATH, download/build the explorer binary.

$ go get github.com/CovenantSQL/CovenantSQL/cmd/cql-explorer

Adapter requires a CovenantSQL config.yaml which can by generated by configuration generator.

Generating Default Config File

Generate the main configuration file. Same as Generating Default Config File in Golang Client Doc. An existing configuration file can also be used.

Explorer Usage

Start

Start the explorer by following commands:

$ cql-explorer

The available options are:

$ cql-explorer --help
Usage of cql-explorer:
  -config string
    	Config file path (default "~/.cql/config.yaml")
  -interval duration
    	New block check interval for explorer (default 2s)
  -listen string
    	Listen address for http explorer api (default "127.0.0.1:4665")
  -password string
    	Master key password for covenantsql

API

Query Synced Head Block

GET /v1/head

Request
Response
{
   "success" : true,
   "status" : "ok",
   "data" : {
      "block" : {
         "txs" : [],
         "hash" : "20ba21af54da3e17252fb4b6b7331fb6f36aca1b9b793597af6ef46faad34dea",
         "timestamp" : 1540278575120.34,
         "version" : 1,
         "count" : 561,
         "producer" : "8d7604acfdb391891a4c795f0939425b6d58bd50a81e579d15f06ecd381ad549",
         "height" : 3040488,
         "parent" : "f9c4f9c7a1dcbcf14a13eb91a007b33672f1f8a261738f5a25fee27c3ccaa584"
      }
   }
}

Query Block by COUNT

GET /v1/count/{count}

Request

count: count of specified block, 0 for genesis block

Response
{
   "success" : true,
   "status" : "ok",
   "data" : {
      "block" : {
         "version" : 1,
         "height" : 0,
         "count" : 0,
         "timestamp" : 1534197599120,
         "hash" : "f745ca6427237aac858dd3c7f2df8e6f3c18d0f1c164e07a1c6b8eebeba6b154",
         "txs" : [],
         "parent" : "0000000000000000000000000000000000000000000000000000000000000001",
         "producer" : "0000000000000000000000000000000000000000000000000000000000000001"
      }
   }
}

Query Block by HASH

GET /v1/block/{hash}

Request

hash: hash of specified block

Response
{
   "success" : true,
   "status" : "ok",
   "data" : {
      "block" : {
         "version" : 1,
         "height" : 0,
         "count" : 0,
         "timestamp" : 1534197599120,
         "hash" : "f745ca6427237aac858dd3c7f2df8e6f3c18d0f1c164e07a1c6b8eebeba6b154",
         "txs" : [],
         "parent" : "0000000000000000000000000000000000000000000000000000000000000001",
         "producer" : "0000000000000000000000000000000000000000000000000000000000000001"
      }
   }
}

Query Block by HEIGHT

GET /v1/height/{height}

Request

height: height of specified block, 0 for genesis block (height is related to block produce time and interval)

Response
{
   "success" : true,
   "status" : "ok",
   "data" : {
      "block" : {
         "version" : 1,
         "height" : 0,
         "count" : 0,
         "timestamp" : 1534197599120,
         "hash" : "f745ca6427237aac858dd3c7f2df8e6f3c18d0f1c164e07a1c6b8eebeba6b154",
         "txs" : [],
         "parent" : "0000000000000000000000000000000000000000000000000000000000000001",
         "producer" : "0000000000000000000000000000000000000000000000000000000000000001"
      }
   }
}

Query Transaction by HASH

GET /v1/tx/{hash}

Request

hash: hash of specified tx

Response
{
    "success": true,
    "status": "ok",
    "data": {
        "tx": {
            "nonce": 11616,
            "amount": 1225,
            "sender": "00000bef611d346c0cbe1beaa76e7f0ed705a194fdf9ac3a248ec70e9c198bf9",
            "receiver": "676b12fef8732ac78a97ea5dba0977bbbabc48f64eee66f09be89a589297e567",
            "type": "Transfer"
        }
    }
}