Get transaction
curl --request GET \
--url https://api.chainbase.online/v1/tx/detail \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.chainbase.online/v1/tx/detail"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://api.chainbase.online/v1/tx/detail', 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.chainbase.online/v1/tx/detail",
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: <x-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.chainbase.online/v1/tx/detail"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-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.chainbase.online/v1/tx/detail")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chainbase.online/v1/tx/detail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"type": 123,
"status": 123,
"block_number": 123,
"block_timestamp": "2023-11-07T05:31:56Z",
"transaction_hash": "<string>",
"transaction_index": 123,
"from_address": "<string>",
"to_address": "<string>",
"value": "<string>",
"input": "<string>",
"nonce": 123,
"contract_address": "<string>",
"gas": 123,
"gas_price": 123,
"gas_used": 123,
"effective_gas_price": 123,
"cumulative_gas_used": 123,
"max_fee_per_gas": 123,
"max_priority_fee_per_gas": 123,
"tx_fee": 123,
"saving_fee": 123,
"burnt_fee": 123
},
"code": 0,
"message": "ok"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Basic API
Get transaction
Get the detail of a transaction given the transaction hash.
Provide the param “hash” or (“block_number” and “tx_index”). If both params are provided, “hash” will be used.
GET
/
v1
/
tx
/
detail
Get transaction
curl --request GET \
--url https://api.chainbase.online/v1/tx/detail \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.chainbase.online/v1/tx/detail"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://api.chainbase.online/v1/tx/detail', 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.chainbase.online/v1/tx/detail",
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: <x-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.chainbase.online/v1/tx/detail"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-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.chainbase.online/v1/tx/detail")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chainbase.online/v1/tx/detail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"type": 123,
"status": 123,
"block_number": 123,
"block_timestamp": "2023-11-07T05:31:56Z",
"transaction_hash": "<string>",
"transaction_index": 123,
"from_address": "<string>",
"to_address": "<string>",
"value": "<string>",
"input": "<string>",
"nonce": 123,
"contract_address": "<string>",
"gas": 123,
"gas_price": 123,
"gas_used": 123,
"effective_gas_price": 123,
"cumulative_gas_used": 123,
"max_fee_per_gas": 123,
"max_priority_fee_per_gas": 123,
"tx_fee": 123,
"saving_fee": 123,
"burnt_fee": 123
},
"code": 0,
"message": "ok"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Headers
Example:
"demo"
Query Parameters
chain network id, see list of details
The transaction hash
Block number of the transaction
Index of the transaction
⌘I