GetTx
curl --request GET \
--url https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}import requests
url = "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}', 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://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}",
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://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}"
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://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}")
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{
"tx": {
"body": {
"messages": [
{
"@type": "<string>"
}
],
"memo": "<string>",
"timeout_height": "<string>",
"unordered": true,
"timeout_timestamp": "2023-11-07T05:31:56Z",
"extension_options": [
{
"@type": "<string>"
}
],
"non_critical_extension_options": [
{
"@type": "<string>"
}
]
},
"auth_info": {
"signer_infos": [
{
"public_key": {
"@type": "<string>"
},
"mode_info": {
"single": {
"mode": "SIGN_MODE_UNSPECIFIED"
},
"multi": {
"bitarray": {
"extra_bits_stored": 123,
"elems": "aSDinaTvuI8gbWludGxpZnk="
},
"mode_infos": [
{}
]
}
},
"sequence": "<string>"
}
],
"fee": {
"amount": [
{
"denom": "<string>",
"amount": "<string>"
}
],
"gas_limit": "<string>",
"payer": "<string>",
"granter": "<string>"
},
"tip": {
"amount": [
{
"denom": "<string>",
"amount": "<string>"
}
],
"tipper": "<string>"
}
},
"signatures": [
"aSDinaTvuI8gbWludGxpZnk="
]
},
"tx_response": {
"height": "<string>",
"txhash": "<string>",
"codespace": "<string>",
"code": 123,
"data": "<string>",
"raw_log": "<string>",
"logs": [
{
"msg_index": 123,
"log": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>"
}
]
}
]
}
],
"info": "<string>",
"gas_wanted": "<string>",
"gas_used": "<string>",
"tx": {
"@type": "<string>"
},
"timestamp": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>",
"index": true
}
]
}
]
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}tx
GetTx
gRPC: cosmos.tx.v1beta1.Service/GetTx (reference)
GetTx fetches a tx by hash.
GET
/
cosmos
/
tx
/
v1beta1
/
txs
/
{hash}
GetTx
curl --request GET \
--url https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}import requests
url = "https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}', 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://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}",
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://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}"
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://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/{hash}")
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{
"tx": {
"body": {
"messages": [
{
"@type": "<string>"
}
],
"memo": "<string>",
"timeout_height": "<string>",
"unordered": true,
"timeout_timestamp": "2023-11-07T05:31:56Z",
"extension_options": [
{
"@type": "<string>"
}
],
"non_critical_extension_options": [
{
"@type": "<string>"
}
]
},
"auth_info": {
"signer_infos": [
{
"public_key": {
"@type": "<string>"
},
"mode_info": {
"single": {
"mode": "SIGN_MODE_UNSPECIFIED"
},
"multi": {
"bitarray": {
"extra_bits_stored": 123,
"elems": "aSDinaTvuI8gbWludGxpZnk="
},
"mode_infos": [
{}
]
}
},
"sequence": "<string>"
}
],
"fee": {
"amount": [
{
"denom": "<string>",
"amount": "<string>"
}
],
"gas_limit": "<string>",
"payer": "<string>",
"granter": "<string>"
},
"tip": {
"amount": [
{
"denom": "<string>",
"amount": "<string>"
}
],
"tipper": "<string>"
}
},
"signatures": [
"aSDinaTvuI8gbWludGxpZnk="
]
},
"tx_response": {
"height": "<string>",
"txhash": "<string>",
"codespace": "<string>",
"code": 123,
"data": "<string>",
"raw_log": "<string>",
"logs": [
{
"msg_index": 123,
"log": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>"
}
]
}
]
}
],
"info": "<string>",
"gas_wanted": "<string>",
"gas_used": "<string>",
"tx": {
"@type": "<string>"
},
"timestamp": "<string>",
"events": [
{
"type": "<string>",
"attributes": [
{
"key": "<string>",
"value": "<string>",
"index": true
}
]
}
]
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Path Parameters
hash is the tx hash to query, encoded as a hex string.
Was this page helpful?