Get Transaction Details
FSCO lets you retrieve transaction details in two ways: using a queryId
returned from a chain execution, or using a native txHash
and chainId
. Both methods return full metadata including status, gas usage, logs, and return data.
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have:
- Either a
queryId
from a previous/execute
request - Or a blockchain
txHash
and correspondingchainId
Method 1: Get by FSCO Query ID
Section titled “Method 1: Get by FSCO Query ID”Endpoint
Section titled “Endpoint”GET /v2/chain/tx/{txId}
Example Request
Section titled “Example Request”curl -X GET https://api.fsco.io/v2/chain/tx/12345678-1234-1234-1234-123456789012 \ -H "Authorization: Bearer $FSCO_API_KEY"
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;
const getTransactionById = async () => { const response = await axios.get( 'https://api.fsco.io/v2/chain/tx/12345678-1234-1234-1234-123456789012', { headers: { Authorization: `Bearer ${FSCO_API_KEY}` } } );
console.log('Transaction details:', response.data);};
getTransactionById();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")
headers = {"Authorization": f"Bearer {FSCO_API_KEY}"}
response = requests.get( "https://api.fsco.io/v2/chain/tx/12345678-1234-1234-1234-123456789012", headers=headers,)
print("Transaction details:", response.json())
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class Program{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY");
var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var response = await client.GetAsync("https://api.fsco.io/v2/chain/tx/12345678-1234-1234-1234-123456789012"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Transaction details: " + responseString); }}
Response
Section titled “Response”Method 2: Get by Blockchain Hash
Section titled “Method 2: Get by Blockchain Hash”Endpoint
Section titled “Endpoint”GET /v2/chain/chain/{chainId}/tx/{txHash}
Example Request
Section titled “Example Request”curl -X GET https://api.fsco.io/v2/chain/{chainId}/tx/0xtxhash123... \ -H "Authorization: Bearer $FSCO_API_KEY"
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;
const getTransactionByHash = async () => { const response = await axios.get( 'https://api.fsco.io/v2/chain/{chainId}/tx/0xtxhash123...', { headers: { Authorization: `Bearer ${FSCO_API_KEY}` } } );
console.log('Transaction details:', response.data);};
getTransactionByHash();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")
headers = {"Authorization": f"Bearer {FSCO_API_KEY}"}
response = requests.get( "https://api.fsco.io/v2/chain/{chainId}/tx/0xtxhash123...", headers=headers)
print("Transaction details:", response.json())
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class Program{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY");
var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var response = await client.GetAsync("https://api.fsco.io/v2/chain/{chainId}/tx/0xtxhash123..."); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Transaction details: " + responseString); }}
Response
Section titled “Response”{ "txData": "0xabcdef...", "chainId": 137, "to": "0xReceiver...", "from": "0xSender...", "contractAddress": null, "hash": "0xtxhash123...", "index": 2, "blockHash": "0xblockhash...", "blockNumber": 12345678, "gasUsed": "21000", "gasPrice": "1000000000", "logs": [], "type": 2, "status": 1, "returnData": "0x" }
Next Steps
Section titled “Next Steps”- Execute a Transaction to change on-chain state
- Call a Chain Method to read data from a contract
- Learn more in the Chain module overview
- View the complete Chain API reference