getblockchaininfo - Bitcoin
Example code for the getblockchaininfo JSON RPC method. Сomplete guide on how to use getblockchaininfo JSON RPC in GetBlock Web3 documentation.
Parameters
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getblockchaininfo",
"params": [],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "getblockchaininfo",
"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)))
.catch(error => console.log(error));Response
{
"result": {
"chain": "main",
"blocks": 928556,
"headers": 928556,
"bestblockhash": "000000000000000000006d2c2d0fd10aad6475f2e93698cc2618d78a0668d06e",
"difficulty": 148195306640204.7,
"time": 1766147618,
"mediantime": 1766146969,
"verificationprogress": 0.999996294840767,
"initialblockdownload": false,
"chainwork": "0000000000000000000000000000000000000000ff4d32eb9db38dc0f4b538e7",
"size_on_disk": 805983801428,
"pruned": false,
"warnings": ""
},
"error": null
}Response Parameters
Field
Type
Description
Use Case
Error Handling
Status Code
Error Message
Cause
Integration Notes
Last updated
Was this helpful?