Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_mining - Ethereum Classic

Example code for the eth_mining JSON-RPC method. Complete guide to using eth_mining JSON-RPC in GetBlock Web3 documentation.

This method returns whether the node is actively mining new blocks. On a shared RPC node this is typically false, since mining is performed by dedicated miners.

Parameters

This method does not require any parameters. Send the request with an empty params array.

Request

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_mining",
    "params": [],
    "id": "getblock.io"
}'
example.js
const axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_mining',
    params: [],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);
example.py
import requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'eth_mining',
        'params': [],
        'id': 'getblock.io'
    }
)

print(response.json())

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": false
}

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC version ("2.0")

id

string

Request identifier

result

boolean

true if the node is mining, otherwise false

Use Cases

  • Node Role: Detect whether an endpoint is a mining node

  • Monitoring: Confirm a miner is producing blocks

  • Diagnostics: Report node mining state

Error Handling

Error Code
Message
Description

-32603 / Internal error

Internal error

The node failed to report mining state

403 / RBAC: access denied

Access denied

The GetBlock access token is missing or incorrect

Last updated

Was this helpful?