Block

APIs to obtain block related details

1. Get latest block list

url: /v2/latest-blocks?count=10, 
method: GET, 
params: {
}, 
successResponse: {
    "code":0, 
    "msg":"SUCCESS", 
    "result":[
        {
            "block_hash":"63355f8e80...6c8108e4e56b264d2a", 
            "block_height":112, 
            "txs_root":"472af7d21a83156...75b4c0e0b1b4576531", 
            "bookkeepers":"AMvXn7U9...HyqNr&AL4CDqBikrj...ZAQf2fg1AC", 
            "consensus_data":"12156079575032856115", 
            "block_size":532, 
            "block_time":1522205080, 
            "tx_count":12
        }
    ]
}

2. Get block list by page

url:/v2/blocks?page_size=1&page_number=10, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "records":[
            {
                "block_hash":"63355f8e80...6c8108e4e56b264d2a", 
                "block_height":112, 
                "txs_root":"472af7d21a83156...75b4c0e0b1b4576531", 
                "bookkeepers":"AMvXn7U9...HyqNr&AL4CDqBikrj...ZAQf2fg1AC", 
                "consensus_data":"12156079575032856115", 
                "block_size":532, 
                "block_time":1522205080, 
                "tx_count":12
            }
        ], 
        "total":23449
    }
}

3. Get block detail by height or hash

url:/v2/blocks/{param}
method:GET
successResponse:
{
	"code":0, 
	"msg":"SUCCESS", 
	"result":{
        "block_hash":"63355f8e80...6c8108e4e56b264d2a", 
        "block_height":112, 
        "txs_root":"472af7d21a83156...75b4c0e0b1b4576531", 
        "bookkeepers":"AL4CDqBikr...Qf2fg1AC&AL...g1AC", 
        "consensus_data":"12156079575032856115", 
        "block_size":532, 
        "block_time":1522205080, 
        "tx_count":12, 
        "txs":[
        	{
        		"tx_hash":"000062c6fe4...9a1c33721", 
        		"tx_type":209, 
        		"tx_time":1522205080, 
        		"confirm_flag":1
        	}
        ]
	}
}

4. Get latest blocks

url:/v2/blocks/generate-time?count=10, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":[
		{
			"block_height":1, 
			"generate_time":6
		}, 
		{
			"block_height":2, 
			"generate_time":1
		}
	]
}

Last updated