eth_getBlockByHash
Retrieve detailed block information by its hash on the Unichain network. This method returns comprehensive block data including transactions, block metadata, and DeFi-specific properties for the Unichain blockchain ecosystem.
Parameters​
Parameter | Type | Required | Description |
---|---|---|---|
blockHash | string | Yes | The hash of the block to retrieve (32-byte hex string with 0x prefix) |
fullTransactionObjects | boolean | Yes | If true , returns full transaction objects; if false , returns only transaction hashes |
Returns​
Returns a block object with the following fields:
Field | Type | Description |
---|---|---|
number | string | Block number (hex-encoded) |
hash | string | Block hash (32 bytes) |
parentHash | string | Hash of the parent block (32 bytes) |
nonce | string | Proof-of-work nonce (8 bytes) |
sha3Uncles | string | SHA3 hash of the uncles data in the block |
logsBloom | string | Bloom filter for block logs (256 bytes) |
transactionsRoot | string | Root of the transaction trie (32 bytes) |
stateRoot | string | Root of the final state trie (32 bytes) |
receiptsRoot | string | Root of the receipts trie (32 bytes) |
miner | string | Address of the block producer/validator |
difficulty | string | Difficulty level for this block |
totalDifficulty | string | Total difficulty of the chain until this block |
extraData | string | Extra data field of this block |
size | string | Size of this block in bytes |
gasLimit | string | Maximum gas allowed in this block |
gasUsed | string | Total gas used by all transactions in this block |
timestamp | string | Unix timestamp for when the block was collated |
transactions | array | Array of transaction objects or hashes (depending on fullTransactionObjects parameter) |
uncles | array | Array of uncle hashes |
baseFeePerGas | string | Base fee per gas (EIP-1559, if applicable) |
mixHash | string | 256-bit hash for proof-of-work verification |
withdrawalsRoot | string | Root hash of withdrawals (if applicable) |
Implementation Example​
- cURL
- JavaScript
- Python
curl -X POST https://api-unichain-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x9c6e4f2a8b7d1e5c3f8a2b9d6e4f7a0c3e6b9f2a5d8c1b4e7f0a3c6d9e2f5a8",
true
],
"id": 1
}'
const response = await fetch('https://api-unichain-mainnet.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getBlockByHash',
params: [
'0x9c6e4f2a8b7d1e5c3f8a2b9d6e4f7a0c3e6b9f2a5d8c1b4e7f0a3c6d9e2f5a8',
true
],
id: 1
})
});
const data = await response.json();
console.log('Unichain block data:', data.result);
import requests
import json
url = 'https://api-unichain-mainnet.n.dwellir.com/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
payload = {
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x9c6e4f2a8b7d1e5c3f8a2b9d6e4f7a0c3e6b9f2a5d8c1b4e7f0a3c6d9e2f5a8",
True
],
"id": 1
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
block_data = response.json()
print("Unichain block data:", json.dumps(block_data['result'], indent=2))
Response Example​
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x3a8",
"hash": "0x9c6e4f2a8b7d1e5c3f8a2b9d6e4f7a0c3e6b9f2a5d8c1b4e7f0a3c6d9e2f5a8",
"parentHash": "0x1f4c8e2a5d7b0e3f9c6a4d8b1e5f2c9a6d3b7e0f4c8a1e5d9b2f6c0a4e7b1d5",
"nonce": "0x0000000000000456",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot": "0x6b9f3d7a2c5e8b1f4d7a0c3e6f9b2a5d8c1b4e7f0a3c6d9e2f5a8b1c4d7e0f3",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner": "0x0000000000000000000000000000000000000000",
"difficulty": "0x0",
"totalDifficulty": "0x0",
"extraData": "0x556e696368616e",
"size": "0x2c0",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"timestamp": "0x650a1b2c",
"transactions": [],
"uncles": [],
"baseFeePerGas": "0x5",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
Use Cases​
- DeFi Analytics: Analyze decentralized finance transactions and protocols on Unichain
- Liquidity Tracking: Monitor liquidity pool transactions and AMM activity
- MEV Analysis: Track Maximum Extractable Value opportunities and transactions
- Cross-Chain Bridge: Analyze bridge transactions and asset transfers
- Protocol Integration: Integrate Unichain block data into DeFi applications
Unichain-Specific Features​
The Unichain network includes DeFi-optimized characteristics:
- Low Gas Fees: Optimized for high-frequency DeFi transactions with minimal fees
- MEV Protection: Built-in mechanisms to protect users from MEV exploitation
- Fast Finality: Quick block confirmation times for better user experience
- DeFi-Native: Designed specifically for decentralized finance applications
- Cross-Chain Compatibility: Seamless integration with other blockchain networks
Network Performance​
- Block Time: Optimized for fast transaction processing
- Throughput: High transaction per second capability for DeFi operations
- Scalability: Built to handle high-volume trading and DeFi interactions
- Security: Robust validation mechanisms for financial transactions
Need help? Contact our support team or check the Unichain documentation.