consensus_getLatest - Tempo
Example code for the consensus_getLatest JSON-RPC method. Complete guide on how to use consensus_getLatest JSON-RPC in GetBlock Web3 documentation.
Parameters
Request Example
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "consensus_getLatest",
"params": [],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "consensus_getLatest",
"params": [],
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data, null, 2)))
.catch(error => console.log(error));Response Example
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"finalized": {
"epoch": 42,
"view": 387213,
"digest": "0x6baa8fa86b9a7e5d3f1c8a4b6e9d2f5a8c3e7b1d4f9a6c2e5b8d3f7a1c4e9b2d",
"certificate": "0xc4b5a6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6",
"block": {
"number": "0x9c40",
"hash": "0x6baa8fa86b9a7e5d3f1c8a4b6e9d2f5a8c3e7b1d4f9a6c2e5b8d3f7a1c4e9b2d"
}
},
"notarized": {
"epoch": 42,
"view": 387214,
"digest": "0x4f3a1d6e8c2b9a7e5d3f1c8a4b6e9d2f5a8c3e7b1d4f9a6c2e5b8d3f7a1c4e9b",
"certificate": "0xa1b2c3d4...",
"block": {
"number": "0x9c41",
"hash": "0x4f3a1d6e8c2b9a7e..."
}
}
}
}Response Parameters
Field
Type
Description
Use Cases
Error Handling
Status Code
Error Message
Cause
Last updated
Was this helpful?