eth_getBlockByHash - Hyperliquid RPC Method
Retrieve complete block data by block hash on Hyperliquid. Essential for derivatives traders, DeFi protocols, and teams building high-frequency trading applications building on the dominant perpetuals DEX with 70% market share, $2.7T+ lifetime volume, and $2B TVL.
Returns information about a block by hash on Hyperliquid.
Why Hyperliquid? Build on the dominant perpetuals DEX with 70% market share, $2.7T+ lifetime volume, and $2B TVL with 200K orders/second throughput, zero gas fees, sub-second finality, and fully onchain Central Limit Order Book (CLOB).
Use Cases
The eth_getBlockByHash method is essential for:
- Block verification - Verify block data using its unique hash
- Chain reorganization handling - Track blocks during reorgs
- Cross-chain bridges - Verify block finality for perpetual futures trading, onchain order books, and institutional-grade derivatives
- Deterministic queries - Get consistent block data regardless of chain state
Request Parameters
32-byte block hash
If true, returns full transaction objects; if false, returns transaction hashes
Response Body
Block number
32-byte block hash
32-byte parent block hash
Unix timestamp
Total gas used
Transaction objects or hashes
Code Examples
curl -X POST https://api-hyperliquid-mainnet-evm.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x749f10b5acfaa7240d49fe6356f8b2a62991aeea630831d13fda8c99d28dd6af",
false
],
"id": 1
}'import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-hyperliquid-mainnet-evm.n.dwellir.com/YOUR_API_KEY');
const blockHash = '0x749f10b5acfaa7240d49fe6356f8b2a62991aeea630831d13fda8c99d28dd6af';
const block = await provider.getBlock(blockHash);
console.log('Block number:', block.number);
console.log('Timestamp:', new Date(block.timestamp * 1000));from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-hyperliquid-mainnet-evm.n.dwellir.com/YOUR_API_KEY'))
block_hash = '0x749f10b5acfaa7240d49fe6356f8b2a62991aeea630831d13fda8c99d28dd6af'
block = w3.eth.get_block(block_hash)
print(f'Block number: {block.number}')
print(f'Timestamp: {block.timestamp}')package main
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
client, err := ethclient.Dial("https://api-hyperliquid-mainnet-evm.n.dwellir.com/YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
blockHash := common.HexToHash("0x749f10b5acfaa7240d49fe6356f8b2a62991aeea630831d13fda8c99d28dd6af")
block, err := client.BlockByHash(context.Background(), blockHash)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Block number: %d\n", block.Number().Uint64())
}Error Handling
| Error Code | Message | Description |
|---|---|---|
| -32602 | Invalid params | Invalid block hash format |
| -32000 | Block not found | Block with this hash does not exist |
Related Methods
eth_getBlockByNumber- Get block by numbereth_blockNumber- Get latest block number
eth_getBlockByNumber - Hyperliquid RPC Method
Retrieve complete block data by block number on Hyperliquid. Perfect for derivatives traders, DeFi protocols, and teams building high-frequency trading applications building on the dominant perpetuals DEX with 70% market share, $2.7T+ lifetime volume, and $2B TVL.
eth_getBalance - Hyperliquid RPC Method
Query account balance on Hyperliquid. Essential for wallet applications and perpetual futures trading, onchain order books, and institutional-grade derivatives on the dominant perpetuals DEX with 70% market share, $2.7T+ lifetime volume, and $2B TVL.