# Which code a contract runs, its hashes, and how it came to be

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

The identity of one contract — the Keccak-256 hash of its current code, the SHA-256 of the same code (the hash Sourcify and other verifiers key on), a structural fingerprint that is equal across contracts sharing the same logic, the code's size and kind, and its lifecycle: deploying account, signing account, creating transaction, code changes and self-destruction. Fields that are not recorded are absent. For an account delegated by EIP-7702 the stored bytes are the delegation, not code: `runtimeSha256` and `fingerprint` are absent there. Other contracts with exactly the same code are the clones method. An address with no indexed code answers 404.

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

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

**Access** — an [API key](/api/authentication) on the **Investigation** 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_identity` 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",
    "runtimeSha256": "0xc1bcd4dc4f30c4dcf6c9fe462abeaf2efefc065dcb4dec74996e471f1ce219b4",
    "fingerprint": "0x0fc2a90437868cc2ba704ed82eb0392fcc6cd6b1e2c27d945b3f139fd7f10b4c",
    "bytecodeSize": 2186,
    "bytecodeVariant": "legacy_analyzed",
    "lifecycle": {
      "deployBlock": 6082465,
      "latestCodeBlock": 6082465,
      "deployCodeHash": "0xd80d4b7c890cb9d6a4893e6b52bc34b56b25335cb13716e0d1d31383e6b41505",
      "latestCodeHash": "0xd80d4b7c890cb9d6a4893e6b52bc34b56b25335cb13716e0d1d31383e6b41505",
      "codeChangeCount": 1,
      "isAlive": true,
      "deployer": "0x95ba4cf87d6723ad9c0db21737d862be80e93911",
      "origin": "0x95ba4cf87d6723ad9c0db21737d862be80e93911",
      "deployTxHash": "0xe7e0fe390354509cd08c9a0168536938600ddc552b3f7cb96030ebef62e75895",
      "deployTxIndex": 22,
      "deployCallType": "CREATE"
    }
  },
  "meta": {
    "chain": "ethereum",
    "timestamp": 1794918332729,
    "cached": false,
    "docs": "https://docs.tracefast.xyz/api/contract-identity"
  }
}
```

### `data`

| Field | Meaning |
|---|---|
| `address` | The contract, lowercase and `0x`-prefixed. |
| `bytecodeSize` | Size of the current runtime code in bytes. |
| `bytecodeVariant` | `legacy_raw`, `legacy_analyzed` or `eip7702` (a delegation designator, not code). |
| `chainId` | Chain id. `1` is Ethereum mainnet. |
| `codeHash` | Keccak-256 hash of the current runtime code, `0x`-prefixed (the EXTCODEHASH). |
| `fingerprint` | A structural fingerprint of the code that is stable across metadata-only differences, `0x`-prefixed: two contracts with equal fingerprints share their logic. Absent when the code is not stored, and for an EIP-7702 delegation (as `runtimeSha256`). |
| `lifecycle` | Deployment, code changes and self-destruction, when the lifecycle index has reached the address. |
| `runtimeSha256` | SHA-256 of the same code, `0x`-prefixed — the hash Sourcify and other verifiers look code up by. Absent when it is not recorded for this code, and for an account delegated by EIP-7702 (`bytecodeVariant: eip7702`), whose 23 bytes are a delegation, not code. |

### `data.lifecycle`

| Field | Meaning |
|---|---|
| `codeChangeCount` | Number of code states observed, deployment included. |
| `deployBlock` | Block the contract was deployed at. |
| `deployCallType` | `CREATE` or `CREATE2` — how the creation ran. |
| `deployCodeHash` | Hash of the code deployed at `deployBlock`. |
| `deployTxHash` | Hash of the creating transaction. Absent when the creation frame is not indexed yet. |
| `deployTxIndex` | Index of the creating transaction within its block. |
| `deployer` | The account that executed the creation — a factory, or the sender itself. Absent when the creation frame is not indexed yet. |
| `isAlive` | `false` after a self-destruct. |
| `latestCodeBlock` | Block of the latest code change observed (equal to `deployBlock` when the code never changed). |
| `latestCodeHash` | Hash of the code at `latestCodeBlock` (equal to `deployCodeHash` when the code never changed). Absent when the lifecycle index does not state it. |
| `origin` | The externally-owned account that sent the creating transaction. Absent when the creation frame is not indexed yet. |
| `selfDestructBlock` | Block the contract self-destructed at; absent while it is alive. |

`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
