---
title: "debug_traceTransaction"
description: "返回一笔交易执行的详细 trace（Ethereum Sepolia）"
url: "https://blockreq.com/docs/zh-cn/build/api-reference/ethereum-sepolia/debug_traceTransaction/"
---

# debug_traceTransaction

**网络：** Ethereum Sepolia · 测试网 · Chain ID `11155111`（`0xaa36a7`）

**计为 5 个 Request。** 计费规则见 [Request Counting](https://blockreq.com/docs/zh-cn/pricing/request-counting/index.md)。

> **套餐**：需要付费套餐，Free 不可用。

## 描述

返回一笔交易执行的详细 trace。

## 参数

| 参数              | 类型     | 必填 | 说明        |
| ----------------- | -------- | ---- | ----------- |
| `transactionHash` | `hex`    | 是   | 交易哈希    |
| `tracerConfig`    | `object` | 否   | Tracer 配置 |

## 请求

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

## 代码示例

**cURL**

```bash
curl -X POST https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e",{"tracer":"callTracer"}],"id":1}'
```

**TypeScript**

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

**Python**

```python
import requests

response = requests.post(
    "https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public",
    json={
  "jsonrpc": "2.0",
  "method": "debug_traceTransaction",
  "params": [
    "0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e",
    {
      "tracer": "callTracer"
    }
  ],
  "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":"debug_traceTransaction","params":["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e",{"tracer":"callTracer"}],"id":1}`)
	resp, err := http.Post(
		"https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public",
		"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://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public"),
});

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

**Foundry**

```bash
cast rpc --rpc-url https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public debug_traceTransaction 0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e {"tracer":"callTracer"}
```

**Hardhat**

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

async function main() {
  const provider = new ethers.JsonRpcProvider("https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public");
  const result = await provider.send("debug_traceTransaction", ["0x02b39a7c1f83eebf04e785ffc31a13543cc77353461e02f30f4ea48ef5db368e",{"tracer":"callTracer"}]);
  console.log(result);
}

main();
```
