Get block DAG information
curl --request GET \
--url https://api.kas.fyi/v1/rpc/getBlockDagInfo \
--header 'x-api-key: <api-key>'import requests
url = "https://api.kas.fyi/v1/rpc/getBlockDagInfo"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.kas.fyi/v1/rpc/getBlockDagInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kas.fyi/v1/rpc/getBlockDagInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kas.fyi/v1/rpc/getBlockDagInfo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.kas.fyi/v1/rpc/getBlockDagInfo")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kas.fyi/v1/rpc/getBlockDagInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"network": "mainnet",
"blockCount": "1234567",
"headerCount": "1234567",
"tipHashes": [
"0x1234567890abcdef..."
],
"difficulty": 1.234567,
"pastMedianTime": "1638360000000",
"virtualParentHashes": [
"0x1234567890abcdef..."
],
"pruningPointHash": "0x1234567890abcdef...",
"virtualDaaScore": "12345678",
"sink": "0x1234567890abcdef..."
}Network Information
Get block DAG information
Provides information about the Directed Acyclic Graph (DAG) structure of the Kaspa BlockDAG. Returns number of blocks in the DAG, number of tips in the DAG, hash of the selected parent block, difficulty of the selected parent block, selected parent block blue score, selected parent block time.
GET
/
v1
/
rpc
/
getBlockDagInfo
Get block DAG information
curl --request GET \
--url https://api.kas.fyi/v1/rpc/getBlockDagInfo \
--header 'x-api-key: <api-key>'import requests
url = "https://api.kas.fyi/v1/rpc/getBlockDagInfo"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.kas.fyi/v1/rpc/getBlockDagInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kas.fyi/v1/rpc/getBlockDagInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kas.fyi/v1/rpc/getBlockDagInfo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.kas.fyi/v1/rpc/getBlockDagInfo")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kas.fyi/v1/rpc/getBlockDagInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"network": "mainnet",
"blockCount": "1234567",
"headerCount": "1234567",
"tipHashes": [
"0x1234567890abcdef..."
],
"difficulty": 1.234567,
"pastMedianTime": "1638360000000",
"virtualParentHashes": [
"0x1234567890abcdef..."
],
"pruningPointHash": "0x1234567890abcdef...",
"virtualDaaScore": "12345678",
"sink": "0x1234567890abcdef..."
}Cost
This endpoint costs 0.1 RU (Request Units) per call.Authorizations
API key required for authentication. Get your API key at https://developer.kas.fyi
Response
200 - application/json
Block DAG information retrieved successfully
Network identifier
Example:
"mainnet"
Number of blocks in the DAG
Example:
"1234567"
Number of headers in the DAG
Example:
"1234567"
Array of tip hashes in the DAG
Example:
["0x1234567890abcdef..."]
Current difficulty
Example:
1.234567
Past median time
Example:
"1638360000000"
Virtual parent hashes
Example:
["0x1234567890abcdef..."]
Pruning point hash
Example:
"0x1234567890abcdef..."
Virtual DAA score
Example:
"12345678"
Sink hash
Example:
"0x1234567890abcdef..."
⌘I