getdifficulty - Zcash
Example code for the getdifficulty JSON-RPC method. Complete 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://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "getdifficulty",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'getdifficulty',
params: [],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://shared.eu-central-1.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",
"result": 283406385.74557334,
"id": "getblock.io"
}Response Parameters
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
-32603
Internal error
Node has no blocks in state or failed to compute difficulty
Last updated
Was this helpful?