Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement three trace APIs #2205

Merged
merged 6 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions docs/api/trace/trace_block.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Title

trace_block

# Keywords

block,trace,parity

# Description

Returns traces created at given block. The traces are returned in transaction index order.

# Curl

```shell
curl -d '{
"id": "1",
"jsonrpc": "2.0",
"method": "trace_block",
"params": ["0x2ed119"]
}' -H "Content-Type: application/json" -X POST "{{ _api_url }}"
```

# Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"output": "0x",
"stateDiff": null,
"trace": [{
"action": {
"from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750",
"gas": "0x0",
"value": "0x1",
"callType": "call",
"to": "0x2910543af39aba0cd09dbb2d50200b3e800a63d2"
},
"result": {
"gasUsed": "0x0",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [],
"type": "call"
}],
"vmTrace": null
}
]
}
```

# Arguments

| Parameter | Type | Required | Description |
|-----------|--------|----------|---------------------------------|
| `id` | string | Required | `"1"` |
| `jsonrpc` | string | Required | `"2.0"` |
| `method` | string | Required | `"trace_block"` |
| `params` | array | Required | `[blockNumber]` Block number or tag |
79 changes: 79 additions & 0 deletions docs/api/trace/trace_filter.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Title

trace_filter

# Keywords

trace,filter,parity

# Description

Returns traces matching given filter. The traces are returned in transaction index order.

# Curl

```shell
curl -d '{
"id": "1",
"jsonrpc": "2.0",
"method": "trace_filter",
"params": [{
"fromBlock": "0x2ed119",
"toBlock": "0x2ed119",
"fromAddress": ["0x1c39ba39e4735cb65978d4db400ddd70a72dc750"],
"toAddress": ["0x2910543af39aba0cd09dbb2d50200b3e800a63d2"],
"after": 0,
"count": 100
}]
}' -H "Content-Type: application/json" -X POST "{{ _api_url }}"
```

# Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"output": "0x",
"stateDiff": null,
"trace": [{
"action": {
"from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750",
"gas": "0x0",
"value": "0x1",
"callType": "call",
"to": "0x2910543af39aba0cd09dbb2d50200b3e800a63d2"
},
"result": {
"gasUsed": "0x0",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [],
"type": "call"
}],
"vmTrace": null
}
]
}
```

# Arguments

| Parameter | Type | Required | Description |
|-----------|--------|----------|------------------------------------------------------|
| `id` | string | Required | `"1"` |
| `jsonrpc` | string | Required | `"2.0"` |
| `method` | string | Required | `"trace_filter"` |
| `params` | array | Required | `[filterOptions]` Object containing filter options: |

Filter Options:

- `fromBlock`: `BlockNumber` - (optional) From this block
- `toBlock`: `BlockNumber` - (optional) To this block
- `fromAddress`: `[Address]` - (optional) Sent from these addresses
- `toAddress`: `[Address]` - (optional) Sent to these addresses
- `after`: `Integer` - (optional) The offset trace number
- `count`: `Integer` - (optional) Integer number of traces to display in a batch
73 changes: 73 additions & 0 deletions docs/api/trace/trace_transaction.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Title

trace_transaction

# Keywords

transaction,trace,parity

# Description

Returns all traces of given transaction. The traces are returned in transaction index order and each trace object has the following format.

# Curl

```shell
curl -d '{
"id": "1",
"jsonrpc": "2.0",
"method": "trace_transaction",
"params": ["0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3"]
}' -H "Content-Type: application/json" -X POST "{{ _api_url }}"
```

# Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"output": "0x",
"stateDiff": {
"0x00...01": {
"balance": {
"*": {
"from": "0x100",
"to": "0x110"
}
},
"code": "=",
"nonce": "=",
"storage": {}
}
},
"trace": {
"action": {
"from": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
"gas": "0x1dcd12a0",
"value": "0x0",
"callType": "call",
"input": "0x",
"to": "0xf12b5dd4ead5f743c6baa640b0216200e89b60da"
},
"result": {
"gasUsed": "0x0",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
}
}
```

# Arguments

| Parameter | Type | Required | Description |
|-----------|--------|----------|----------------------------------------|
| `id` | string | Required | `"1"` |
| `jsonrpc` | string | Required | `"2.0"` |
| `method` | string | Required | `"trace_transaction"` |
| `params` | array | Required | `[transactionHash]` Transaction hash |
Loading