Skip to content
TraceFast Docs

Decompiled code of a contract

Open the contract's Code tab →

A contract's code reconstructed as readable Solidity-like pseudocode, from the bytecode on chain — so it works the same for contracts that never published their code. The default answer is a table of contents of the functions, with their names where a known signature has the selector; one function's body, or all the bodies a page at a time, are a parameter away.

GET https://tracefast.xyz/api/v1/chains/1/contracts/{address}/decompilation
ParameterInTypeNotes
addresspathstring0x-prefixed, 40 hex characters, any case
blockqueryinteger, optionalthe block to resolve the code at. Default: the latest covered block
targetquerystring, optionalauto (default) — the code that runs at the address, one hop through a proxy; self — the address's own code
selectorquerystring, optionalone function's body: 0x + 8 hex characters, or fallback / receive. Not with bodies or cursor
bodiesqueryboolean, optionaltrue — the first page of bodies, in table-of-contents order
cursorquerystring, optionalnextCursor of the previous page — of bodies, or of the table of contents. Opaque, and valid only for the same address, target and block

Access — an API key on the Intelligence plan or higher (plans). Not sold over x402 yet. As a tool for AI agents: get_contract_decompilation on the MCP server. Stable — see stability.

chains/1 is a literal: other chain ids answer 404 chain_not_supported. An unknown query parameter is refused rather than ignored.

Read the disclaimer

Every answer carries disclaimer, and it applies to every byte of the view:

Best-effort reconstruction from public bytecode. Names are inferred from signature databases and may be wrong. Confirm any behaviour against on-chain state before relying on it.

The view is a reading aid, not the contract's original code. Variable names are invented, and a function name is the best match for its 4-byte selector — the same match the selectors method serves, with the same decodeStatus and candidateCount. lowConfidence flags a function, or the whole view, whose reconstruction is uncertain.

Which code is shown

By default (target=auto) the answer is about the code that runs at the address at the block: for a proxy, its implementation; for a beacon proxy, the beacon's implementation; for a minimal proxy, its target; for an account with an EIP-7702 delegation, the delegate's code. It follows one hop only. target.resolvedVia says how the code was reached, and target.codeAddress whose code it is. target=self shows the address's own code — a proxy's own dispatcher.

The USDC address in the example below is a proxy: resolvedVia: slot and the implementation's address in codeAddress.

A code not analysed yet

A code is analysed once, on its first request; after that, anyone can read the view without limit. A request for a code that is not analysed yet starts the analysis and answers 503 with reason: decompilation_pending and a Retry-After header — ask again after it, usually within a minute.

Each account starts a limited number of analyses per day, set by its plan, and only a few at a time. Over the limit, the answer is 429 quota_exceeded, with used, limit and retryAfterSeconds; a code that is already analysed is still served.

Over MCP, the same wait is a tool error decompilation_pending with retryAfterSeconds: call the tool again after it.

When a newer analysis release exists and this code's view under it is not computed yet, the earlier view is served with releaseIsCurrent: false.

Three shapes of the answer

  • Table of contents (default) — functions[], one entry per function. It is paged by size (about 512 KiB of entries a page, one entry always given): while hasMore is true, pass nextCursor back as cursor.
  • One body — ?selector=0x70a08231 answers the same envelope with body in place of functions. hasBody in the table of contents says whether a selector has one.
  • Bodies, a page at a time — ?bodies=true answers the first page in bodies[] and nextCursor; pass it back as cursor until it is absent.

functionCount — entries of the table of contents — and hasMore are on every shape.

A body larger than 512 KiB as written comes without text: textState: withheld_for_size and textLength (its length in bytes, UTF-8) stand in its place. A page of bodies counts each body as written.

Response

200 application/json, the USDC proxy, the table of contents cut to two of its 55 functions:

{
  "data": {
    "chainId": 1,
    "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "block": 26389912,
    "target": {
      "mode": "auto",
      "resolvedVia": "slot",
      "codeAddress": "0x43506849d7c04f9138d1a2050bbf3a0c054402dd",
      "codeHash": "0xcdfb7d322961af3acae7a8f7ee8b69c205b36f576cc5b077f170c7eb8ecbe3ea"
    },
    "analysis": {
      "codeHash": "0xcdfb7d322961af3acae7a8f7ee8b69c205b36f576cc5b077f170c7eb8ecbe3ea",
      "release": "rev:44a0daa70ae5",
      "computedAt": "2026-10-29T15:26:18Z"
    },
    "releaseIsCurrent": true,
    "disclaimer": "Best-effort reconstruction from public bytecode. Names are inferred from signature databases and may be wrong. Confirm any behaviour against on-chain state before relying on it.",
    "status": "done",
    "language": "solidity",
    "lowConfidence": false,
    "functionsDone": 55,
    "functionsTotal": 55,
    "functionCount": 55,
    "functions": [
      {
        "kind": "public",
        "selector": "0x70a08231",
        "name": "balanceOf",
        "signature": "balanceOf(address)",
        "decodeStatus": "ambiguous",
        "candidateCount": 2,
        "status": "done",
        "mutability": "view",
        "arguments": [{ "type": "address" }],
        "lowConfidence": false,
        "hasBody": true
      },
      {
        "kind": "public",
        "selector": "0xa9059cbb",
        "name": "transfer",
        "signature": "transfer(address,uint256)",
        "decodeStatus": "ambiguous",
        "candidateCount": 4,
        "status": "done",
        "mutability": "nonpayable",
        "arguments": [{ "type": "address" }, { "type": "uint256" }],
        "lowConfidence": false,
        "hasBody": true
      }
    ],
    "hasMore": false
  },
  "meta": {
    "chain": "ethereum",
    "timestamp": 1794384198609,
    "cached": false,
    "asOfBlock": 26389912,
    "docs": "https://docs.tracefast.xyz/api/contract-decompilation"
  }
}

The same address with ?selector=0x70a08231 carries, in place of functions:

"body": {
  "selector": "0x70a08231",
  "kind": "public",
  "text": "    function balanceOf(address arg0) public view { // compiler ABI checks: pc 2546\n        return abi.encode(0x7fff…ffff & map_0x9[address(arg0)]);\n    }\n"
}

The pc numbers in a body are byte offsets in the code — the same offsets the disassembly lists.

data

FieldMeaning
chainId1 — Ethereum mainnet
addressthe address asked about, lowercase
blockthe block the code was resolved at
targetwhich code this is and how it was reached — see below
analysiscodeHash of the analysed code, release — the analysis release that made the view, rev: + 12 hex (opaque: compare it, never parse it), computedAt — RFC 3339 UTC
releaseIsCurrentfalse when an earlier release's view is served while the current one is computed
disclaimerread it before relying on the view
statusdone, partial, unsupported or failed. For a day after an attempt that could not finish: timeout_wall, timeout_cpu or failed_infra, then it is retried. With no view behind the status, functions is empty and functionCount is 0
unsupportedReasonwith unsupported: eip7702_designator (the code is only a delegation pointer — ask with target=auto) or no_functions
languagesolidity, vyper or unknown
lowConfidencethe reconstruction as a whole is uncertain
functionsDone, functionsTotalfunctions whose analysis finished, of all found
functionCountentries of the table of contents, on every shape
functions[]the table of contents — the default shape
bodywith selector: that function's body
bodies[]with bodies=true or cursor: a page of bodies, in table-of-contents order
hasMoretrue when the answer is a page and more follows — of the table of contents or of bodies
nextCursorpass as cursor for the next page — of the table of contents on a contents answer, of bodies on a bodies answer; absent on the last page
outputLimitedpresent (true) only when the view was cut to its size limit

target

FieldMeaning
modeauto or self, as asked
resolvedViahow the code was reached at the block: own — the address's own code; slot — a proxy's implementation slot; beacon — a beacon proxy's beacon; beacon_unproven — a beacon whose implementation is not proven at the block; eip1167 — a minimal proxy's target; delegate — an EIP-7702 delegation
codeAddressthe address whose code this is
codeHashhash of the code
targetUnresolvedpresent (true) only when auto found no proven code to follow and the address's own code is served instead

A table-of-contents entry

FieldMeaning
kindpublic — reached through a selector; fallback or receive
selectorthe 4-byte selector; absent for fallback and receive
name, signaturepresent when a known signature has the selector and its text is served — see text from the chain
nameStatewithheld — a known signature has the selector, but its text is not served: no name or signature, and it is still counted in decodeStatus and candidateCount. Absent otherwise
decodeStatus, candidateCounthow confident the name is — partial, ambiguous, abi_missing — and how many known signatures share the selector, as on selectors
statushow far this function's analysis got: done, partial, timeout, failed
mutabilitywhere the code shows it, for example view or payable
arguments[]one entry per argument; type where the code checks one
lowConfidencethis function's reconstruction is uncertain
hasBodywhether ?selector= returns a body for it
bodyOmittedpresent (true) only when the body was left out to keep the view within its size limit

A body — in body or bodies[] — has kind, selector (absent for fallback and receive) and text, the function as pseudocode with known names filled in. A body larger than 524,288 bytes as written (each invisible character counted as its <U+XXXX> marker) has no text; instead textState is withheld_for_size and textLength gives the body's length in bytes (UTF-8).

Errors

StatuscodeWhendetails
400bad_requestreason: target_invalid, selector_invalid, bodies_invalid, or selector_with_cursor — selector with bodies or cursorreason
400invalid_cursorthe cursor is not valid for this request — restart from the first page—
404not_foundno code is proven to run at the address at that block, or the selector is not a function of this code—
422block_not_availableblock is past the covered historymaxAvailableBlock
429quota_exceededreason: decompile_in_flight_limit or decompile_daily_limit — your account may not start another analysis now. Codes already analysed are still servedused, limit, retryAfterSeconds, and Retry-After
503service_unavailablereason: decompilation_pending — the view is being computed; ask again after Retry-AfterpendingSince, queueDepth, retryAfterSeconds
503service_unavailablereason: decompilation_backlog_too_large or decompiler_unavailable — no view of this code is stored and none can be started right now; retry laterretryAfterSeconds

Malformed input, unknown parameters and the key check's 401/403/429 are the same for every method — see conventions and API keys.


Last updated 19 Nov 2026, 11:46 UTC · verified against TraceFast v1.0.332 · Markdown