sync_state - Nervos
Example code for the sync_state JSON-RPC method. Complete guide on how to use sync_state 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": "sync_state",
"params": [],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "sync_state",
"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": {
"best_known_block_number": "0xe5a45f",
"best_known_block_timestamp": "0x18f3b8d2a3c",
"fast_time": "0x1f4",
"ibd": false,
"inflight_blocks_count": "0x0",
"low_time": "0x9c4",
"normal_time": "0x3e8",
"orphan_blocks_count": "0x0",
"tip_hash": "0x02530b25ad0ff677acc365cb73de3e8cc09c7ddd58272e879252e199d08df83b",
"tip_number": "0xe5a45f",
"unverified_tip_hash": "0x02530b25ad0ff677acc365cb73de3e8cc09c7ddd58272e879252e199d08df83b",
"unverified_tip_number": "0xe5a45f"
}
}Response Parameters
Field
Type
Description
Use Cases
Error Handling
Status Code
Error Message
Cause
SDK Integration
Was this helpful?