Get Transaction Receipt
After calling a contract method, you can retrieve the transaction receipt to check status, gas used, logs, and other result metadata. This guide shows you how to fetch it.
Prerequisites
Section titled “Prerequisites”Before you begin, ensure:
- You’ve successfully called a contract method
- You have the
txId
returned from the call
Endpoint
Section titled “Endpoint”GET /v2/contract/tx/{txId}/receipt
Example Request
curl -X GET https://api.fsco.io/v2/contract/tx/{{transactionId}}/receipt \ -H "Authorization: Bearer $FSCO_API_KEY"
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;
const getTxReceipt = async () => { const response = await axios.get( 'https://api.fsco.io/v2/contract/tx/{{transactionId}}/receipt', { headers: { Authorization: `Bearer ${FSCO_API_KEY}`, 'Content-Type': 'application/json' } } );
console.log('Transaction receipt:', response.data);};
getTxReceipt();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")
headers = { "Authorization": f"Bearer {FSCO_API_KEY}", "Content-Type": "application/json",}
response = requests.get( "https://api.fsco.io/v2/contract/tx/{{transactionId}}/receipt", headers=headers,)
print("Transaction receipt:", 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/contract/tx/{{transactionId}}/receipt"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Transaction receipt: " + responseString); }}
Response
{ "response": { "to": "0xContractAddress", "from": "0xSenderAddress", "value": "0", "gas": { "used": "21000", "price": "50000000000" }, "block": { "hash": "0xabcde123456789...", "number": 19385732 }, "tx": { "hash": "0xdeadbeef123456...", "index": 5, "status": 1 }, "execution": { "logs": [ { "address": "0xContractAddress", "topics": ["0x123456789abcdef..."], "data": "0x7465737464617461" } ] } }}
Important Notes
Section titled “Important Notes”- The receipt contains execution details such as
status
,gasUsed
,logs
, and more - Some chains may introduce a delay between transaction submission and receipt availability
- If
status
is false, the transaction was reverted