eth_hashrate - World Chain RPC Method
Get the legacy eth_hashrate compatibility value on World Chain. Public endpoints may return `0x0` or an unsupported-method error depending on the client.
Returns the legacy eth_hashrate compatibility value on World Chain. Depending on the client behind the endpoint, this call may return a hex quantity like 0x0 or a method-not-found style error.
Why World Chain? Build on the human-first Ethereum L2 powered by World ID with World ID integration for free gas and priority blockspace.
Note: Treat
eth_hashrateas a node-local mining metric and compatibility value. Public endpoints often report0x0or reject the method entirely, so it is not a reliable chain-health or consensus signal.
When to Use This Method
eth_hashrate is relevant for World Chain developers building sybil-resistant applications:
- Node Diagnostics — Check whether the connected client reports a legacy hashrate metric
- Client Capability Checks — Distinguish between
0x0, unsupported-method, and method-not-found responses - Dashboard Integration — Display the metric alongside other node status data when it is available
Request Parameters
This method accepts no parameters.
Response Body
Hexadecimal string representing the reported compatibility value when the client exposes the method
Code Examples
curl -X POST https://api-worldchain-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_hashrate",
"params": [],
"id": 1
}'// Using fetch
const response = await fetch('https://api-worldchain-mainnet.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_hashrate',
params: [],
id: 1
})
});
const payload = await response.json();
if (payload.error) {
console.log('eth_hashrate unsupported:', payload.error.message);
} else {
console.log('World Chain hashrate:', parseInt(payload.result, 16), 'H/s');
}
// Using ethers.js
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-worldchain-mainnet.n.dwellir.com/YOUR_API_KEY');
try {
const hashrate = await provider.send('eth_hashrate', []);
console.log('World Chain hashrate:', parseInt(hashrate, 16), 'H/s');
} catch (error) {
console.log('eth_hashrate unsupported:', error.message);
}import requests
def get_hashrate():
response = requests.post(
'https://api-worldchain-mainnet.n.dwellir.com/YOUR_API_KEY',
json={
'jsonrpc': '2.0',
'method': 'eth_hashrate',
'params': [],
'id': 1
}
)
payload = response.json()
if 'error' in payload:
raise RuntimeError(payload['error']['message'])
return int(payload['result'], 16)
hashrate = get_hashrate()
print(f'World Chain hashrate: {hashrate} H/s')
# Using web3.py
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-worldchain-mainnet.n.dwellir.com/YOUR_API_KEY'))
try:
print(f'World Chain hashrate: {w3.eth.hashrate} H/s')
except Exception as exc:
print(f'eth_hashrate unsupported: {exc}')package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/ethereum/go-ethereum/rpc"
)
func main() {
client, err := rpc.Dial("https://api-worldchain-mainnet.n.dwellir.com/YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
var result string
err = client.CallContext(context.Background(), &result, "eth_hashrate")
if err != nil {
log.Println("eth_hashrate unsupported:", err)
return
}
fmt.Printf("World Chain hashrate: %s\n", result)
}Common Use Cases
1. Compatibility-Aware Status Dashboard
Display the reported compatibility value alongside other client status signals without assuming the method is always available:
async function getMiningStats(provider) {
const blockNumber = await provider.getBlockNumber();
let hashrate = null;
let supported = true;
try {
hashrate = await provider.send('eth_hashrate', []);
} catch (error) {
supported = false;
}
return {
supported,
hashrate: hashrate ? parseInt(hashrate, 16) : null,
currentBlock: blockNumber
};
}2. Capability Check
Check whether the connected client reports eth_hashrate at all:
async function getHashrateStatus(provider) {
try {
const hashrate = await provider.send('eth_hashrate', []);
return { supported: true, raw: hashrate, isZero: hashrate === '0x0' };
} catch (error) {
return { supported: false, message: error.message };
}
}
console.log(await getHashrateStatus(provider));Error Handling
Common errors and solutions:
| Error Code | Description | Solution |
|---|---|---|
| -32603 | Internal error | Node may be initializing — retry after delay |
| -32601 | Method not found | Node client may not support this method |
| -32005 | Rate limit exceeded | Reduce polling frequency |
Related Methods
eth_mining— Check if the node is actively miningeth_coinbase— Get the mining/coinbase addresseth_blockNumber— Get the current block height
eth_mining
Check the legacy eth_mining compatibility method on World Chain. Public endpoints often return a client-specific unsupported-method response instead of a boolean.
eth_coinbase
Check the legacy eth_coinbase compatibility method on World Chain. Public endpoints may return an address, `unimplemented`, or another unsupported-method response depending on the client.