Skip to main content
GET
/
header
header
curl --request GET \
  --url https://rpc.cosmos.directory/cosmoshub/header
import requests

url = "https://rpc.cosmos.directory/cosmoshub/header"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://rpc.cosmos.directory/cosmoshub/header', 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://rpc.cosmos.directory/cosmoshub/header",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$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://rpc.cosmos.directory/cosmoshub/header"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://rpc.cosmos.directory/cosmoshub/header")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://rpc.cosmos.directory/cosmoshub/header")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "version": {
    "block": "10",
    "app": "0"
  },
  "chain_id": "cosmoshub-2",
  "height": "12",
  "time": "2019-04-22T17:01:51.701356223Z",
  "last_block_id": {
    "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
    "parts": {
      "total": 1,
      "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
    }
  },
  "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
  "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
  "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
  "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
  "last_results_hash": "",
  "evidence_hash": "",
  "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
}
{
  "id": 0,
  "jsonrpc": "2.0",
  "error": "Description of failure"
}

Query Parameters

height
integer
default:0

height to return. If no height is provided, it will fetch the latest header.

Example:

1

Response

Header informations.

version
object
required
chain_id
string
required
Example:

"cosmoshub-2"

height
string
required
Example:

"12"

time
string
required
Example:

"2019-04-22T17:01:51.701356223Z"

last_block_id
object
required
last_commit_hash
string
required
Example:

"21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812"

data_hash
string
required
Example:

"970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73"

validators_hash
string
required
Example:

"D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0"

next_validators_hash
string
required
Example:

"D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0"

consensus_hash
string
required
Example:

"0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8"

app_hash
string
required
Example:

"223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C"

last_results_hash
string
required
Example:

""

evidence_hash
string
required
Example:

""

proposer_address
string
required
Example:

"D540AB022088612AC74B287D076DBFBC4A377A2E"