getdifficulty - Zcash
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
bashcurl --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"
}'example.js
javascriptconst 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);example.py
pythonimport 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())example.rs
rustuse reqwest::Client;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&json!({
"jsonrpc": "2.0",
"method": "getdifficulty",
"params": [],
"id": "getblock.io"
}))
.send()
.await?
.json::<Value>()
.await?;
println!("Result: {}", response["result"]);
Ok(())
}Response
json{
"jsonrpc": "2.0",
"result": 283406385.74557334,
"id": "getblock.io"
}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 |