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

getdifficulty - Zcash

Example code for the getdifficulty JSON-RPC method. Сomplete guide on how to use the getdifficulty JSON-RPC method in GetBlock.io Web3 documentation.

This method returns the current proof-of-work difficulty as a floating-point multiple of the minimum difficulty. Zcash uses the Equihash proof-of-work algorithm; difficulty adjusts every block via a digishield-derived algorithm to target 75-second block times.

Parameters

This method takes no parameters.

Request

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

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

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

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

print(response.json())

Response

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

Response Parameters

Parameter
Type
Description

result

number

Difficulty as a multiplier over the minimum difficulty target

Use Cases

  • Mining Pool Statistics: Display current difficulty on mining dashboards and calculators

  • Historical Analysis: Track difficulty over time to visualize network hashrate trends

  • Reward Calculation: Input to expected-reward calculations for miners choosing between chains

Error Handling

Error Code
Message
Description

-32603

Internal error

Node has no blocks in state or failed to compute difficulty

Last updated

Was this helpful?