# How a contract's code is built and how it can change

[Open the contract on its entity page →](https://tracefast.xyz/entity/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)

The security profile of one contract's current code — the proxy pattern detected in it and its confidence, its opcode-level features (DELEGATECALL, CALLCODE, a DELEGATECALL target read from storage), and what the knowledge graph proves about how it is built (`architecture`: for example immutable, an upgradeable proxy, a mutable implementation slot, metamorphic). Only proven facts are stated: an absent one means "not proven", never "no". Who changed a proxy's implementation and when is the control-history method; what the contract can do is the capabilities method. An address with no indexed code answers 404.

```
GET https://tracefast.xyz/api/v1/chains/1/contracts/{address}/security
```

| Parameter | In | Type | Notes |
|---|---|---|---|
| `address` | path | string | The contract, `0x` + 40 hex, any case. |

**Access** — an [API key](/api/authentication) on the **Intelligence** plan or higher ([plans](/api/authentication#plans)), or no key at all: pay per call with [x402](/api/x402) at the same path on `https://mpp.tracefast.xyz/api/v1`, at the price its `402` states. As a tool for AI agents: `get_contract_security` on the [MCP server](/api/mcp-server). **Stable** — see [stability](/api/conventions#stability).

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

## Response

`200 application/json`, USDC. Lists in the example are cut to two entries.

```json
{
  "data": {
    "chainId": 1,
    "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "codeHash": "0xd80d4b7c890cb9d6a4893e6b52bc34b56b25335cb13716e0d1d31383e6b41505",
    "bytecodeVariant": "legacy_analyzed",
    "proxyFamily": "oz_v1",
    "proxyConfidence": 3,
    "codeFeatures": {
      "hasDelegatecall": true,
      "hasCallcode": false,
      "delegatecallTargetFromStorage": true
    },
    "graphReached": true,
    "architecture": [
      {
        "attributeId": "architecture:has_mutable_impl_slot",
        "result": "pass",
        "referenceBlock": 18963716
      },
      {
        "attributeId": "architecture:proxy",
        "result": "pass",
        "referenceBlock": 18963716
      }
    ]
  },
  "meta": {
    "chain": "ethereum",
    "timestamp": 1794918332762,
    "cached": true,
    "docs": "https://docs.tracefast.xyz/api/contract-security"
  }
}
```

### `data`

| Field | Meaning |
|---|---|
| `address` | The contract, lowercase and `0x`-prefixed. |
| `architecture` | What the knowledge graph proves about how the contract is built, as it names it — for example `architecture:immutable`, `architecture:upgradeable_proxy`, `architecture:has_mutable_impl_slot`, `architecture:metamorphic`, `architecture:minimal_proxy_eip1167`. Only proven facts are listed; an absent one is "not proven", never "no". |
| `bytecodeVariant` | `legacy_raw`, `legacy_analyzed` or `eip7702` (a delegation designator, not code). |
| `chainId` | Chain id. `1` is Ethereum mainnet. |
| `codeFeatures` | Opcode-level facts of the code. Absent with `proxyFamily`. |
| `codeHash` | Keccak-256 hash of the current runtime code, `0x`-prefixed — the code described here. |
| `graphReached` | `true` when the knowledge graph has reached the address at all; `false` means an empty `architecture` says nothing about the contract. |
| `proxyConfidence` | Confidence of `proxyFamily`, 0 (none) to 3 (high). Absent with it. |
| `proxyFamily` | Proxy pattern detected in the code (the vocabulary of `proxyFamily` on the contract method). Absent when the code has not been analysed yet. |

### `data.architecture[]`

| Field | Meaning |
|---|---|
| `attributeId` | The attribute id, `<family>:<name>`. |
| `referenceBlock` | The block the fact was evaluated at. |
| `result` | `pass` (proven). Other values may appear and are not proof. |
| `value` | The value, for a fact that has one (for example the signature threshold of a Safe in `capability:safe_threshold_current`), as a JSON scalar in text. Absent otherwise. |

### `data.codeFeatures`

| Field | Meaning |
|---|---|
| `delegatecallTargetFromStorage` | A DELEGATECALL target is read from storage, shown by following the data flow: the code the contract runs can be changed by writing that storage slot, which is how upgradeable proxies work. `true` is proven; `false` only when the code has no DELEGATECALL at all. Absent when the code has a DELEGATECALL and no storage-held target was proven — not proven is not "none". An account delegated by EIP-7702 (`proxyFamily: eip7702`) runs its delegate's code without any of these opcodes: its features describe the 23-byte delegation, not that code. |
| `hasCallcode` | The code contains CALLCODE, the deprecated predecessor of DELEGATECALL. |
| `hasDelegatecall` | The code contains DELEGATECALL: it can run another contract's code against its own storage and balance. |

`meta` is the same envelope on every method — see [conventions](/api/conventions#meta).

## Errors

| Status | When |
|---|---|
| 400 | `bad_request`: a malformed address (`reason: address_invalid`) or an unknown query parameter |
| 404 | `not_found`: no contract code is indexed at the address; `chain_not_supported`, or an unknown path |
| 422 | `block_not_available` (`reason: coverage_gap`): the address cannot be confirmed absent right now |

Malformed input, unknown parameters and the key check's `401`/`403`/`429`/`503` are the same for every method — see [conventions](/api/conventions#errors) and [API keys](/api/authentication#when-a-key-is-refused).

## Related pages

* [One contract](/api/contract)
* [Bytecode](/api/contract-bytecode)
* [Function selectors](/api/contract-selectors)
* [Disassembly](/api/contract-disassembly)
* [All API methods](/api/methods) — every method on one page
* [Conventions](/api/conventions) — requests, responses, errors and pagination
