GoldRush SDK
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.BaseService.getBlock({chainName: "chainName", walletAddress: "walletAddress"});
console.log(resp.data);
};
ApiServices();curl --request GET \
--url https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/', 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.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"updated_at": "2023-11-07T05:31:56Z",
"chain_id": 123,
"chain_name": "<string>",
"items": [
{
"block_hash": "<string>",
"signed_at": "2023-11-07T05:31:56Z",
"height": 123,
"block_parent_hash": "<string>",
"extra_data": "<string>",
"miner_address": "<string>",
"mining_cost": 123,
"gas_used": 123,
"gas_limit": 123,
"transactions_link": "<string>"
}
]
}Utility
Get a block
Commonly used to fetch and render a single block for a block explorer.
GET
/
v1
/
{chainName}
/
block_v2
/
{blockHeight}
/
GoldRush SDK
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.BaseService.getBlock({chainName: "chainName", walletAddress: "walletAddress"});
console.log(resp.data);
};
ApiServices();curl --request GET \
--url https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/', 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.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.covalenthq.com/v1/{chainName}/block_v2/{blockHeight}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"updated_at": "2023-11-07T05:31:56Z",
"chain_id": 123,
"chain_name": "<string>",
"items": [
{
"block_hash": "<string>",
"signed_at": "2023-11-07T05:31:56Z",
"height": 123,
"block_parent_hash": "<string>",
"extra_data": "<string>",
"miner_address": "<string>",
"mining_cost": 123,
"gas_used": 123,
"gas_limit": 123,
"transactions_link": "<string>"
}
]
}Credit Cost
1 per call
Processing
Realtime
Estimate your monthly cost for this API using the Pricing Calculator.
Authorizations
Bearer authentication header of the form: Bearer <token>, where <token> is your GoldRush API Key.
Path Parameters
The chain name eg: eth-mainnet.
The block height or latest for the latest block available.
Response
200 - application/json
Successful response
⌘I