Blocks
Get block by hash
Retrieve detailed information about a specific block using its hash.
GET
/
blocks
/
{blockHash}
Get block by hash
curl --request GET \
--url https://public-api.voyager.online/beta/blocks/{blockHash} \
--header 'x-api-key: <api-key>'import requests
url = "https://public-api.voyager.online/beta/blocks/{blockHash}"
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://public-api.voyager.online/beta/blocks/{blockHash}', 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://public-api.voyager.online/beta/blocks/{blockHash}",
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://public-api.voyager.online/beta/blocks/{blockHash}"
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://public-api.voyager.online/beta/blocks/{blockHash}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.voyager.online/beta/blocks/{blockHash}")
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{
"blockNumber": 483249,
"hash": "0x19402ac841080ad4849ac0209265cb6e82856036ffce993e7f583b322c61092",
"timestamp": 1703664798,
"stateRoot": "0x17c8b7b9018634b80f1680e2682779256799b0a7dab1b2bf7ec2d637d802ac9",
"txnCount": 130,
"messageCount": 0,
"eventCount": 738,
"l1VerificationTxHash": "0xca936a77272c3c7eb494654ed8910fcb16bc9edb7f2fa83d98146df396ae74e0",
"status": "Accepted on L1",
"prevBlockHash": "0x51b4e567a96cc66c4be585b2e0a02c38988bbc4fa9cf4c667f58275b1153839",
"nextBlockHash": "0x4e1b608bc2596010e111363904729f92602e2c69b89abcd7b2b76d74462501f",
"confirmations": 1426574,
"sequencerAddress": "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
"totalFee": "0x5a166d429e58d4",
"timeToMine": 41,
"version": "0.12.3",
"ethGasPrice": "0x043ec6fbec",
"strkGasPrice": "0x0",
"l1AcceptTime": 19492
}{
"error": "<string>"
}{
"message": "Forbidden"
}{
"error": "<string>"
}{
"message": "Limit Exceeded"
}Authorizations
API key for authentication. Get your key at https://voyager.online/plans
Path Parameters
Block number, block hash (0x-prefixed hex), or "pre_confirmed" for pending blocks.
Pattern:
^(0x[0-9a-fA-F]{1,66}|[0-9]+|pre_confirmed)$Response
Block details
⌘I
Get block by hash
curl --request GET \
--url https://public-api.voyager.online/beta/blocks/{blockHash} \
--header 'x-api-key: <api-key>'import requests
url = "https://public-api.voyager.online/beta/blocks/{blockHash}"
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://public-api.voyager.online/beta/blocks/{blockHash}', 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://public-api.voyager.online/beta/blocks/{blockHash}",
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://public-api.voyager.online/beta/blocks/{blockHash}"
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://public-api.voyager.online/beta/blocks/{blockHash}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.voyager.online/beta/blocks/{blockHash}")
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{
"blockNumber": 483249,
"hash": "0x19402ac841080ad4849ac0209265cb6e82856036ffce993e7f583b322c61092",
"timestamp": 1703664798,
"stateRoot": "0x17c8b7b9018634b80f1680e2682779256799b0a7dab1b2bf7ec2d637d802ac9",
"txnCount": 130,
"messageCount": 0,
"eventCount": 738,
"l1VerificationTxHash": "0xca936a77272c3c7eb494654ed8910fcb16bc9edb7f2fa83d98146df396ae74e0",
"status": "Accepted on L1",
"prevBlockHash": "0x51b4e567a96cc66c4be585b2e0a02c38988bbc4fa9cf4c667f58275b1153839",
"nextBlockHash": "0x4e1b608bc2596010e111363904729f92602e2c69b89abcd7b2b76d74462501f",
"confirmations": 1426574,
"sequencerAddress": "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
"totalFee": "0x5a166d429e58d4",
"timeToMine": 41,
"version": "0.12.3",
"ethGasPrice": "0x043ec6fbec",
"strkGasPrice": "0x0",
"l1AcceptTime": 19492
}{
"error": "<string>"
}{
"message": "Forbidden"
}{
"error": "<string>"
}{
"message": "Limit Exceeded"
}