Get blocks
curl --request POST \
--url https://api.kas.fyi/v1/rpc/getBlocks \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"includeBlocks": true,
"includeTransactions": true,
"lowHash": "fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41"
}
'import requests
url = "https://api.kas.fyi/v1/rpc/getBlocks"
payload = {
"includeBlocks": True,
"includeTransactions": True,
"lowHash": "fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
includeBlocks: true,
includeTransactions: true,
lowHash: 'fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41'
})
};
fetch('https://api.kas.fyi/v1/rpc/getBlocks', 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/getBlocks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'includeBlocks' => true,
'includeTransactions' => true,
'lowHash' => 'fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kas.fyi/v1/rpc/getBlocks"
payload := strings.NewReader("{\n \"includeBlocks\": true,\n \"includeTransactions\": true,\n \"lowHash\": \"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kas.fyi/v1/rpc/getBlocks")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"includeBlocks\": true,\n \"includeTransactions\": true,\n \"lowHash\": \"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kas.fyi/v1/rpc/getBlocks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"includeBlocks\": true,\n \"includeTransactions\": true,\n \"lowHash\": \"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41\"\n}"
response = http.request(request)
puts response.read_body{
"blockHashes": [
"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41",
"21e4944392af43783de33dd076c65dd3f5fd57ddaf6fd9f68674d33b54f1b575"
],
"blocks": [
{
"header": {
"hash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"version": 1,
"parentsByLevel": [
[
"0x1234567890abcdef..."
],
[
"0x9876543210fedcba..."
]
],
"hashMerkleRoot": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"acceptedIdMerkleRoot": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"utxoCommitment": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"timestamp": "1638360000000",
"bits": 393216,
"nonce": "12345678901234567890",
"daaScore": "1234567",
"blueWork": "123456789012345",
"blueScore": "1234567",
"pruningPoint": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6"
},
"transactions": [
{
"version": 1,
"inputs": [
{
"previousOutpoint": {
"transactionId": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"index": 0
},
"sequence": "4294967295",
"sigOpCount": 1,
"signatureScript": "0x473044..."
}
],
"outputs": [
{
"value": "1000000000",
"scriptPublicKey": "<string>",
"verboseData": {
"scriptPublicKeyType": "pubkeyhash",
"scriptPublicKeyAddress": "kaspa:qpzpfwcsqsxhxwup26r55fd0ghqlhyugz8cp6y3wxuddc02vcxtjg75pspnwz"
}
}
],
"lockTime": "0",
"subnetworkId": "0100000000000000000000000000000000000000",
"gas": "0",
"payload": "0x",
"mass": "1000",
"verboseData": {
"transactionId": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"hash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"computeMass": "1000",
"blockHash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"blockTime": "1638360000000"
}
}
],
"verboseData": {
"hash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"difficulty": 1.5,
"selectedParentHash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"transactionIds": [
"34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
],
"isHeaderOnly": false,
"blueScore": 1234567,
"childrenHashes": [
"34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6"
],
"mergeSetBluesHashes": [
"34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6"
],
"mergeSetRedsHashes": [
"0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
],
"isChainBlock": true
}
}
]
}Block Operations
Get blocks
Retrieves multiple blocks based on specified criteria.
POST
/
v1
/
rpc
/
getBlocks
Get blocks
curl --request POST \
--url https://api.kas.fyi/v1/rpc/getBlocks \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"includeBlocks": true,
"includeTransactions": true,
"lowHash": "fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41"
}
'import requests
url = "https://api.kas.fyi/v1/rpc/getBlocks"
payload = {
"includeBlocks": True,
"includeTransactions": True,
"lowHash": "fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
includeBlocks: true,
includeTransactions: true,
lowHash: 'fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41'
})
};
fetch('https://api.kas.fyi/v1/rpc/getBlocks', 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/getBlocks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'includeBlocks' => true,
'includeTransactions' => true,
'lowHash' => 'fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kas.fyi/v1/rpc/getBlocks"
payload := strings.NewReader("{\n \"includeBlocks\": true,\n \"includeTransactions\": true,\n \"lowHash\": \"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kas.fyi/v1/rpc/getBlocks")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"includeBlocks\": true,\n \"includeTransactions\": true,\n \"lowHash\": \"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kas.fyi/v1/rpc/getBlocks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"includeBlocks\": true,\n \"includeTransactions\": true,\n \"lowHash\": \"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41\"\n}"
response = http.request(request)
puts response.read_body{
"blockHashes": [
"fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41",
"21e4944392af43783de33dd076c65dd3f5fd57ddaf6fd9f68674d33b54f1b575"
],
"blocks": [
{
"header": {
"hash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"version": 1,
"parentsByLevel": [
[
"0x1234567890abcdef..."
],
[
"0x9876543210fedcba..."
]
],
"hashMerkleRoot": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"acceptedIdMerkleRoot": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"utxoCommitment": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"timestamp": "1638360000000",
"bits": 393216,
"nonce": "12345678901234567890",
"daaScore": "1234567",
"blueWork": "123456789012345",
"blueScore": "1234567",
"pruningPoint": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6"
},
"transactions": [
{
"version": 1,
"inputs": [
{
"previousOutpoint": {
"transactionId": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"index": 0
},
"sequence": "4294967295",
"sigOpCount": 1,
"signatureScript": "0x473044..."
}
],
"outputs": [
{
"value": "1000000000",
"scriptPublicKey": "<string>",
"verboseData": {
"scriptPublicKeyType": "pubkeyhash",
"scriptPublicKeyAddress": "kaspa:qpzpfwcsqsxhxwup26r55fd0ghqlhyugz8cp6y3wxuddc02vcxtjg75pspnwz"
}
}
],
"lockTime": "0",
"subnetworkId": "0100000000000000000000000000000000000000",
"gas": "0",
"payload": "0x",
"mass": "1000",
"verboseData": {
"transactionId": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"hash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"computeMass": "1000",
"blockHash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"blockTime": "1638360000000"
}
}
],
"verboseData": {
"hash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"difficulty": 1.5,
"selectedParentHash": "34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"transactionIds": [
"34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6",
"0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
],
"isHeaderOnly": false,
"blueScore": 1234567,
"childrenHashes": [
"34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6"
],
"mergeSetBluesHashes": [
"34e9538fd3225652553930657c3d767d5ccab0fcd545038a69c202e45929dcd6"
],
"mergeSetRedsHashes": [
"0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
],
"isChainBlock": true
}
}
]
}Cost
This endpoint costs 0.5 RU (Request Units) per call.Authorizations
API key required for authentication. Get your API key at https://developer.kas.fyi
Body
application/json
Response
200 - application/json
Blocks retrieved successfully
Array of block hashes
Example:
[ "fc4c90a646687ba6f862e6089285dd7a610ef4d7f7614d25295f65aceb02bc41", "21e4944392af43783de33dd076c65dd3f5fd57ddaf6fd9f68674d33b54f1b575" ]
Array of complete block data (if includeBlocks was true)
Show child attributes
Show child attributes
⌘I