# eth_getTransactionReceipt - Tempo RPC Method

Returns the receipt of a transaction by transaction hash on Tempo. Receipt is only available for mined transactions.

> **Why Tempo?** Build on a payments-first EVM chain with deterministic settlement and stablecoin-native fees with no native gas token, fees denominated in supported USD stablecoins, and full EVM RPC compatibility.

## When to Use This Method

`eth_getTransactionReceipt` is essential for payment application developers, wallet teams, stablecoin issuers, and treasury automation builders:

- **Transaction confirmation with success/failure status**: Verify that a transaction has been mined on Tempo and determine whether it succeeded or reverted
- **Gas usage analysis**: Compare actual gas consumed against pre-transaction estimates for merchant settlement, treasury operations, payout automation, and stablecoin-native financial applications
- **Event log parsing from emitted events**: Extract and decode contract events for indexing, analytics, and notification systems
- **Contract deployment detection**: Identify newly deployed contracts on a payments-first EVM chain with deterministic settlement and stablecoin-native fees by checking the `contractAddress` field

## Request Parameters

- `transactionHash` (`DATA, required`): 32-byte transaction hash

## Request Example

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionReceipt",
  "params": ["0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28"],
  "id": 1
}
```

## Response Fields

- `status` (`QUANTITY, required`): 1 (success) or 0 (failure)
- `transactionHash` (`DATA, required`): Transaction hash
- `blockHash` (`DATA, required`): Block hash
- `blockNumber` (`QUANTITY, required`): Block number
- `gasUsed` (`QUANTITY, required`): Gas used by this transaction
- `cumulativeGasUsed` (`QUANTITY, required`): Total gas used in block up to this tx
- `logs` (`Array, required`): Array of log objects
- `contractAddress` (`DATA, required`): Created contract address (if deployment)

## Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "status": "0x1",
    "transactionHash": "<value>",
    "blockHash": "<value>",
    "blockNumber": "0x1",
    "gasUsed": "0x1",
    "cumulativeGasUsed": "0x1",
    "logs": [],
    "contractAddress": "<value>"
  }
}
```

## Common Use Cases

### 1. Confirm Transaction Success and Parse Emitted Events

Poll `eth_getTransactionReceipt` after submitting a transaction to confirm it was mined successfully on Tempo. Once available, iterate through the `logs` array to decode and process events emitted by the transaction.

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY');

async function confirmAndParse(txHash) {
  let receipt = null;

  while (!receipt) {
    receipt = await provider.getTransactionReceipt(txHash);
    if (!receipt) {
      console.log('Waiting for confirmation...');
      await new Promise(r => setTimeout(r, 2000));
    }
  }

  const status = receipt.status === 1 ? 'Success' : 'Failed';
  console.log(`Transaction ${status} in block #${receipt.blockNumber}`);
  console.log(`Gas used: ${receipt.gasUsed.toString()}`);
  console.log(`Events emitted: ${receipt.logs.length}`);

  for (const log of receipt.logs) {
    console.log(`  Event from ${log.address} with topics:`, log.topics);
  }

  return receipt;
}

confirmAndParse('0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28');
```

### 2. Detect Contract Deployments by Checking contractAddress

When monitoring the chain for new contract deployments on Tempo, check the `contractAddress` field in transaction receipts. A non-null value indicates a contract creation transaction.

```python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY'))

def detect_deployment(tx_hash):
    receipt = w3.eth.get_transaction_receipt(tx_hash)

    if not receipt:
        print(f'Transaction {tx_hash} not yet mined')
        return None

    if receipt['contractAddress']:
        print(f'Contract deployed at: {receipt["contractAddress"]}')
        print(f'Deployer: {receipt["from"]}')
        print(f'Gas used: {receipt["gasUsed"]}')
        return receipt['contractAddress']
    else:
        print(f'Transaction {tx_hash} is not a contract deployment')
        return None

detect_deployment('0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28')
```

### 3. Compute Effective Gas Price Paid by the Sender

Use the `effectiveGasPrice` field from the receipt (available on EIP-1559 chains) to calculate the actual cost of a transaction on a payments-first EVM chain with deterministic settlement and stablecoin-native fees. Compare this against the gas price from the transaction object for fee analysis.

```go
package main

import (
    "context"
    "fmt"
    "log"
    "math/big"

    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/ethclient"
)

func main() {
    client, _ := ethclient.Dial("https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY")

    txHash := common.HexToHash("0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28")
    receipt, _ := client.TransactionReceipt(context.Background(), txHash)

    if receipt == nil {
        log.Fatal("Transaction not yet mined")
    }

    status := "Success"
    if receipt.Status == 0 {
        status = "Failed"
    }

    fmt.Printf("Status: %s\n", status)
    fmt.Printf("Block: %d\n", receipt.BlockNumber.Uint64())
    fmt.Printf("Gas used: %d\n", receipt.GasUsed)

    // Calculate total cost: gasUsed * effectiveGasPrice
    totalCost := new(big.Int).Mul(
        big.NewInt(int64(receipt.GasUsed)),
        receipt.EffectiveGasPrice,
    )
    fmt.Printf("Total cost: %s wei\n", totalCost.String())

    if receipt.ContractAddress != (common.Address{}) {
        fmt.Printf("Contract deployed at: %s\n", receipt.ContractAddress.Hex())
    }
}
```

## Best Practices

- **Receipt is only available after mining; poll until non-null**: A `null` response means the transaction is pending or not found; implement a polling loop with exponential backoff to wait for confirmation
- **Check the `status` field**: `0x1` indicates a successful execution; `0x0` means the transaction reverted and may have consumed all provided gas
- **Parse the `logs` array for events using known topic hashes**: Each log entry contains up to 4 indexed topics and a data field; use ABI definitions to decode them into readable event parameters
- **For frontrunning detection, compare effective gas price across similar transactions**: Monitoring the `effectiveGasPrice` across transactions in a block can reveal priority gas auction dynamics on a payments-first EVM chain with deterministic settlement and stablecoin-native fees
- **`contractAddress` is non-null only for contract deployment transactions**: Use this field to distinguish regular transfers from contract create operations

## Code Examples

cURL
JavaScript
Python
Go

```bash
curl -X POST https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": ["0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28"],
    "id": 1
  }'
```

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY');

const txHash = '0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28';
const receipt = await provider.getTransactionReceipt(txHash);

if (receipt) {
  console.log('Status:', receipt.status === 1 ? 'Success' : 'Failed');
  console.log('Gas Used:', receipt.gasUsed.toString());
  console.log('Block:', receipt.blockNumber);
  console.log('Logs:', receipt.logs.length);

  // Parse specific events
  for (const log of receipt.logs) {
    console.log('Event from:', log.address);
  }
}
```

```python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY'))

tx_hash = '0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28'
receipt = w3.eth.get_transaction_receipt(tx_hash)

if receipt:
    status = 'Success' if receipt['status'] == 1 else 'Failed'
    print(f'Status: {status}')
    print(f'Gas Used: {receipt["gasUsed"]}')
    print(f'Block: {receipt["blockNumber"]}')
    print(f'Logs: {len(receipt["logs"])}')
```

```go
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/ethclient"
)

func main() {
    client, err := ethclient.Dial("https://api-tempo-mainnet.n.dwellir.com/YOUR_API_KEY")
    if err != nil {
        log.Fatal(err)
    }

    txHash := common.HexToHash("0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28")
    receipt, err := client.TransactionReceipt(context.Background(), txHash)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Status: %d\n", receipt.Status)
    fmt.Printf("Gas Used: %d\n", receipt.GasUsed)
    fmt.Printf("Logs: %d\n", len(receipt.Logs))
}
```

## Related Methods

- [`eth_getTransactionByHash`](https://www.dwellir.com/docs/tempo/eth_getTransactionByHash) - Get transaction details
- [`eth_getLogs`](https://www.dwellir.com/docs/tempo/eth_getLogs) - Query logs by filter
