---
title: "Get the opcode traces for a historical transaction on the network with the given transaction ID or hash"
method: GET
path: "/api/v1/contracts/results/{transactionIdOrHash}/opcodes"
tags: ["contracts"]
---

# Get the opcode traces for a historical transaction on the network with the given transaction ID or hash

`GET /api/v1/contracts/results/{transactionIdOrHash}/opcodes`

Re-executes a transaction and returns a result containing detailed information for the execution,
including all values from the {@code stack}, {@code memory} and {@code storage}
and the entire trace of opcodes that were executed during the replay.

Note that to provide the output, the transaction needs to be re-executed on the EVM,
which may take a significant amount of time to complete if stack and memory information is requested.

## Path parameters

- `transactionIdOrHash` string, required

## Query parameters

- `stack` boolean
- `memory` boolean
- `storage` boolean

## Response `200`

OK

- OpcodesResponse
  - `address` string, binary, required — The address of the transaction recipient in hex. Zero address is set for transactions without a recipient (e.g., contract create)
  - `contract_id` string, nullable, required — Network entity ID in the format of `shard.realm.num`
  - `failed` boolean, required — Whether the transaction failed to be completely processed.
  - `gas` integer, required — The gas used in tinybars
  - `opcodes` Opcode[], required — The logs produced by the opcode logger
    - `depth` integer, required — The current call depth
    - `gas` integer, required — The remaining gas
    - `gas_cost` integer, required — The cost for executing op
    - `memory` string[], nullable, required — The EVM memory with items in hex
    - `op` string, required — The opcode to execute
    - `pc` integer, required — The program counter
    - `reason` string, binary, nullable — The revert reason in hex
    - `stack` string[], nullable, required — The EVM stack with items in hex
    - `storage` object, nullable, required — The storage slots (keys and values in hex) of the current contract which is read from and written to
  - `return_value` string, binary, required — The returned data from the transaction in hex

## Other responses

- `400` — Validation error
- `404` — Transaction or record file not found
- `429` — Too many requests

---

[API](https://skmtc.dev/hedera/apis/mirror-node-rest-api.md) · [All operations](https://skmtc.dev/hedera/apis/mirror-node-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hedera/mirror-node-rest-api/revisions/45f5ccac560c/schema)
