getchaintips - Dogecoin

This method returns information about all known tips in the block tree, including the main chain and any orphaned branches.

Parameters

This method does not accept any 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": "getchaintips",
    "params": [],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');
const { data } = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
  jsonrpc: '2.0', method: 'getchaintips', params: [], id: 'getblock.io'
});
console.log(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': 'getchaintips',
        'params': [],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

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": "getchaintips",
            "params": [],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "error": null,
    "id": "getblock.io",
    "result": [
        {
            "height": 6378959,
            "hash": "7d6f509b16de07844787f97b50778d032eb026a470eb0e0fb5b42a73290e7848",
            "branchlen": 0,
            "status": "active"
        },
        {
            "height": 6378812,
            "hash": "9f0e7a1c4b2d8e3f5a6c9b0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f",
            "branchlen": 1,
            "status": "valid-fork"
        }
    ]
}

Response Parameters

ParameterTypeDescription
errornull|objectError object when the call fails, otherwise null
idstringRequest identifier matching the request
result[].heightnumericHeight of the branch tip
result[].hashstringHash of the branch tip
result[].branchlennumericLength of the branch. 0 for the main chain
result[].statusstringactive, valid-fork, valid-headers, headers-only, or invalid

Use Cases

  • Reorg Monitoring: Watch for competing branches near the tip
  • Fork Analysis: Inspect how long an orphaned branch ran
  • Node Health: Confirm exactly one tip reports active

Error Handling

Error CodeMessageDescription
-32700Parse errorRequest body is not valid JSON
-32600Invalid requestThe JSON sent is not a valid request object
-32603Internal errorNode failed to read the requested chain state