Api reference
Get Receipt
Get transaction receipts by transaction hash.
Get transaction receipts by transaction hash.
Endpoint
POST /receiptDescription
Retrieves transaction receipts from the blockchain by transaction hash. Includes decoded logs and event data.
Request Body
{
"txHashes": [
"0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938"
],
"rpc": "https://polygon-amoy.infura.io/v3/{key}"
}Response
{
"requestStatus": 200,
"receipts": [
{
"status": 1,
"txHash": "0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938",
"gasUsed": 34111,
"cumulativeGasUsed": 17033026,
"effectiveGasPrice": "1136849215",
"logs": []
}
]
}Response Fields
requestStatus(integer): HTTP status code of the requestreceipts(array): Array of transaction receiptsstatus(integer): Transaction status (0 - failed, 1 - success)txHash(string): Transaction hashgasUsed(integer): Gas used by the transactioncumulativeGasUsed(integer): Cumulative gas used in the blockeffectiveGasPrice(string): Effective gas pricelogs(array): Decoded event logs from the transaction
Example Request
curl -X POST https://api.msa.omnes.tech/receipt \
-H "Content-Type: application/json" \
-d '{
"txHashes": [
"0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938"
],
"rpc": "https://polygon-amoy.infura.io/v3/{key}"
}'const response = await fetch('https://api.msa.omnes.tech/receipt', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
txHashes: [
'0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938',
],
rpc: 'https://polygon-amoy.infura.io/v3/{key}',
}),
});
const result = await response.json();
console.log('Transaction status:', result.receipts[0].status === 1 ? 'Success' : 'Failed');
console.log('Gas used:', result.receipts[0].gasUsed);import requests
url = "https://api.msa.omnes.tech/receipt"
payload = {
"txHashes": [
"0x066a0269a55aa42498da9993f01b9bfc82517330669c240807ed1b94b2acd938"
],
"rpc": "https://polygon-amoy.infura.io/v3/{key}"
}
response = requests.post(url, json=payload)
result = response.json()
print(f"Transaction status: {'Success' if result['receipts'][0]['status'] == 1 else 'Failed'}")
print(f"Gas used: {result['receipts'][0]['gasUsed']}")Use Cases
- Transaction tracking: Monitor transaction status and completion
- Event logging: Retrieve decoded event logs from transactions
- Gas analysis: Analyze gas usage for optimization
- Batch verification: Verify multiple transactions at once
Best Practices
- Wait for confirmation: Wait for transaction confirmation before fetching receipt
- Handle multiple receipts: Process array of receipts for batch operations
- Check status codes: Verify transaction status before processing logs
- Decode logs: Use decoded logs for event tracking
Related Endpoints
- Execute Operation - Execute transactions
- Filter Events - Filter events from blockchain
💡 Tip: Receipts include decoded event logs, making it easy to track contract events without manual decoding.