getblock - Litecoin
Example code for the getblock JSON-RPC method. Complete guide on how to use getblock JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
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": ["a1b2c3d4e5f6...blockhash...", 1],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "getblock",
"params": ["a1b2c3d4e5f6...blockhash...", 1],
"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
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"hash": "a1b2c3d4e5f6...blockhash...",
"confirmations": 100,
"strippedsize": 228,
"size": 264,
"weight": 948,
"height": 2750000,
"version": 536870912,
"versionHex": "20000000",
"merkleroot": "4a5b6c7d8e9f...",
"tx": ["txid1", "txid2"],
"time": 1640000000,
"mediantime": 1639999000,
"nonce": 123456789,
"bits": "1a0fffff",
"difficulty": 12345678.90,
"chainwork": "0000000000000000000000000000000000000000000000000000000000000001",
"nTx": 2,
"previousblockhash": "0000000000000000000000000000000000000000000000000000000000000000",
"nextblockhash": "1111111111111111111111111111111111111111111111111111111111111111"
}
}Response Parameters
Field
Type
Description
Use Case
Error Handling
Status Code
Error Message
Cause
Integration Notes
Last updated
Was this helpful?