chain_getBlock - Neuroweb RPC Method
Retrieve block data by hash on Neuroweb. Essential for accessing block headers and extrinsics on the decentralized AI blockchain powering 125M+ Knowledge Assets with MIT-awarded technology.
Retrieves complete block information from Neuroweb, including the block header, extrinsics, and justifications.
Why Neuroweb? Build on the decentralized AI blockchain powering 125M+ Knowledge Assets with MIT-awarded technology with OriginTrail DKG V8 with 500-1000x scalability, 40% of US imports secured, EVM compatibility, and Best Decentralized AI Project (MIT).
Use Cases
The chain_getBlock method is essential for:
- Block explorers - Display complete block information
- Chain analysis - Analyze block production patterns
- Transaction verification - Confirm extrinsic inclusion for decentralized knowledge graphs (DKG), verifiable AI, supply chain audits, and knowledge mining
- Data indexing - Build historical blockchain databases
Request Parameters
Hex-encoded block hash. If omitted, returns latest block
Response Body
Complete block data
Block header information
Hash of the parent block
Block number (hex-encoded)
Root of the state trie
Root of the extrinsics trie
Array of extrinsics in the block
Block justifications (if available)
Code Examples
# Get latest block
curl https://api-neuroweb.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [],
"id": 1
}'
# Get specific block
curl https://api-neuroweb.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": ["0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3"],
"id": 1
}'import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-neuroweb.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
// Get latest block
const latestHash = await api.rpc.chain.getBlockHash();
const latestBlock = await api.rpc.chain.getBlock(latestHash);
console.log('Latest block:', {
number: latestBlock.block.header.number.toNumber(),
hash: latestHash.toHex(),
extrinsicsCount: latestBlock.block.extrinsics.length
});
// Get specific block
const blockHash = '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3';
const block = await api.rpc.chain.getBlock(blockHash);
console.log('Block extrinsics:', block.block.extrinsics.length);
await api.disconnect();import requests
import json
def get_block(block_hash=None):
url = 'https://api-neuroweb.n.dwellir.com/YOUR_API_KEY'
params = [block_hash] if block_hash else []
payload = {
'jsonrpc': '2.0',
'method': 'chain_getBlock',
'params': params,
'id': 1
}
response = requests.post(url, json=payload)
data = response.json()
if 'error' in data:
raise Exception(f"RPC Error: {data['error']}")
return data['result']
# Get latest block
latest_block = get_block()
block_number = int(latest_block['block']['header']['number'], 16)
print(f'Latest block number: {block_number}')
# Get specific block
specific_block = get_block('0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3')
print(f"Extrinsics count: {len(specific_block['block']['extrinsics'])}")Related Methods
chain_getBlockHash- Get block hash by numberchain_getHeader- Get block header onlychain_getFinalizedHead- Get finalized block hash
NeuroWeb
Complete JSON-RPC API documentation for NeuroWeb blockchain integration. Learn how to interact with NeuroWeb nodes using WebSocket and HTTPS endpoints.
chain_getBlockHash - Neuroweb RPC Method
Get block hash by number on Neuroweb. Essential for historical queries on the decentralized AI blockchain powering 125M+ Knowledge Assets with MIT-awarded technology.