---
title: "trace_transaction"
description: "Returns trace for a single transaction (Erigon format) (Polygon Amoy)"
url: "https://blockreq.com/docs/build/api-reference/polygon-amoy/trace_transaction/"
---

# trace_transaction

> **API key required.** This Polygon Amoy method is documented for keyed private endpoints. It is not available on `/v1/rpc/public`. [Create an endpoint](https://blockreq.com/docs/getting-started/create-endpoint/index.md) to get an API key.

**Network:** Polygon Amoy · Testnet · Chain ID `80002` (`0x13882`)

**Counts as 5 requests.** See [Request Counting](https://blockreq.com/docs/pricing/request-counting/index.md).

> **Tier**: Paid plan required. Not available on Free.

## Description

Returns trace for a single transaction (Erigon format).

## Parameters

| Parameter         | Type  | Required | Description      |
| ----------------- | ----- | -------- | ---------------- |
| `transactionHash` | `hex` | Yes      | Transaction hash |

## Request

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

## Code Examples

**cURL**

```bash
curl -X POST https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"trace_transaction","params":["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e"],"id":1}'
```

**TypeScript**

```typescript
const response = await fetch("https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "method": "trace_transaction",
  "params": [
    "0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e"
  ],
  "id": 1
}),
});
const data = await response.json();
console.log(data.result);
```

**Python**

```python
import requests

response = requests.post(
    "https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000",
    json={
  "jsonrpc": "2.0",
  "method": "trace_transaction",
  "params": [
    "0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e"
  ],
  "id": 1
}
)
print(response.json()["result"])
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	payload := []byte(`{"jsonrpc":"2.0","method":"trace_transaction","params":["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e"],"id":1}`)
	resp, err := http.Post(
		"https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000",
		"application/json",
		bytes.NewBuffer(payload),
	)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	var result map[string]interface{}
	json.Unmarshal(body, &result)
	fmt.Println(result["result"])
}
```

**viem**

```typescript
import { createPublicClient, http } from "viem";

const client = createPublicClient({
  transport: http("https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000"),
});

const result = await client.request({
  method: "trace_transaction",
  params: ["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e"],
});
console.log(result);
```

**Foundry**

```bash
cast rpc --rpc-url https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000 trace_transaction 0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e
```

**Hardhat**

```javascript
const { ethers } = require("hardhat");

async function main() {
  const provider = new ethers.JsonRpcProvider("https://polygon-amoy-bor-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000");
  const result = await provider.send("trace_transaction", ["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e"]);
  console.log(result);
}

main();
```
