eth_getBlockByHash
Returns information about a block by hash.
Parameters#
- Block Hash - Hash of a block
- Boolean - If
truereturns full transaction objects, iffalseonly hashes
{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae", false],
"id": 1
}
Returns#
Block object or null if no block found.
Implementation Examples#
JSON-RPC endpoint format
Use https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/jsonrpc for all TRON JSON-RPC methods (eth_*, net_*, web3_*). Send POST requests with a JSON-RPC body and remember to replace YOUR_API_KEY.
- cURL
- JavaScript
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/jsonrpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae", false],
"id": 1
}'
// Using ethers.js
const block = await provider.getBlock('0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae');
console.log('Block:', block);