githubEdit

getdifficulty - Bitcoin

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

This method returns the proof-of-work difficulty as a multiple of the minimum difficulty.

Parameters

  • None

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"
}'

Response

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

Response Parameters

Field
Type
Description

result

number

The proof-of-work difficulty as a multiple of the minimum difficulty.

Use Case

The getdifficulty method is essential for:

  • Monitoring mining difficulty trends

  • Calculating expected block times

  • Estimating mining profitability

  • Building difficulty adjustment dashboards

  • Tracking network security metrics

  • Analyzing hashrate implications

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN.

Integration Notes

The getdifficulty method helps developers:

  • Build mining profitability calculators

  • Create difficulty tracking dashboards

  • Implement mining pool analytics

  • Monitor network security

  • Track difficulty adjustment cycles

Last updated

Was this helpful?