getBlocksWithLimit - Solana
Example code for the getBlocksWithLimit JSON-RPC method. Complete guide on how to use getBlocksWithLimit JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Config Object
Field
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": "getBlocksWithLimit",
"params": [397234556, 5],
"id": "getblock.io"
}'const { Connection } = require('@solana/web3.js');
const connection = new Connection('https://go.getblock.io/<ACCESS-TOKEN>/', 'confirmed');
const blocks = await connection.getBlocksWithLimit(397234556, 5);
console.log(blocks);import requests
response = requests.post(
'https://go.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'getBlocksWithLimit',
'params': [397234556, 5],
'id': 'getblock.io'
}
)
print(response.json()['result'])Response
Response Parameters
Parameter
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Was this helpful?