getblock - Bitcoin Cash
Example code for the getblock JSON-RPC method. Complete guide on how to use getblock JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getblock",
"params": ["0000000000000000023a561e1ea370153aac5d1504726d1a039032831c05fcfc", 1],
"id": "getblock.io"
}'const axios = require('axios');
const { data } = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0', method: 'getblock',
params: ['0000000000000000023a561e1ea370153aac5d1504726d1a039032831c05fcfc', 1], id: 'getblock.io'
});
console.log(data.result.height, data.result.nTx);import requests
response = requests.post(
'https://go.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'getblock',
'params': ["0000000000000000023a561e1ea370153aac5d1504726d1a039032831c05fcfc", 1],
'id': 'getblock.io'
}
)
print(response.json()['result'])Response
{
"error": null,
"id": "getblock.io",
"result": {
"hash": "0000000000000000023a561e1ea370153aac5d1504726d1a039032831c05fcfc",
"confirmations": 1197,
"height": 684634,
"version": 1073733632,
"versionHex": "3fffe000",
"merkleroot": "d14c9f467c4bdd5135837696150ab5f52f3f5043de324ca4e5766b195b9f8f37",
"time": 1617180599,
"mediantime": 1617176373,
"nonce": 3669423616,
"bits": "170cdf6f",
"difficulty": 21865558044610.55,
"chainwork": "00000000000000000000000000000000000000001b633a711a2334c78a29bb40",
"nTx": 2815,
"previousblockhash": "000000000000000001d3a318372df5d1eec54462a0d7471ae1cdf49838f793dd",
"nextblockhash": "000000000000000000006d8e1eb870bd281b30ed621acf6b8d6af2a3c7ab61f1",
"size": 1350854,
"tx": [
"10b54fd708ab2e5703979b4ba27ca0339882abc2062e77fbe51e625203a49642",
"780791bb2d5a8ccda4b5a707967a8e15b412814852c58c77299e85579bb65587"
]
}
}Response Parameters
Parameter
Type
Description
Result Object
Field
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Was this helpful?