> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blockdb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Contracts

> Canonical smart contract deployment registry for Ethereum & EVM — CREATE/CREATE2 discovery, deployer address, block. REST API.

## Overview

* **Dataset ID:** `0121`
* **Table:** `blockdb_evm.b0121_contracts_v1`
* **Description:** Smart contracts discovered via CREATE/CREATE2 internal transactions. Uses `contract_id` (26 bytes = address + creation\_block + tx\_index) as primary key to support metamorphic contracts (e.g. CREATE-SELFDESTRUCT-CREATE2 in the same block).
* **Primary key:** `contract_id`
* **Foreign Key:** `(block_number, tx_index)` → `blockdb_evm.b0102_transactions_v1`
* **API:** [POST /evm/raw/contracts](/api-reference/evm/primitives/contracts)
* **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Contracts-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0121_contracts_v1.csv?download=true)
* **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Contracts-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0121_contracts_v1.json?download=true)

## Sample Viewer

<Frame>
  <iframe src="https://huggingface.co/datasets/BlockDB/Raw-Contracts-Ethereum-And-EVM-Cryptocurrency-Data/embed/viewer/default/train" frameborder="0" width="100%" height="600px" />
</Frame>

## Columns

| Column               | Type          | Description                                                                                                                               |
| -------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `contract_id`        | `BYTEA`       | Unique contract incarnation ID: 20 bytes (address) + 4 bytes (creation block, big-endian) + 2 bytes (tx\_index, big-endian). Primary key. |
| `contract_address`   | `BYTEA`       | The deployed contract address (20 bytes). Separate column for efficient API lookups.                                                      |
| `block_number`       | `BIGINT`      | Block number where contract was deployed.                                                                                                 |
| `block_time`         | `TIMESTAMPTZ` | UTC timestamp of the block.                                                                                                               |
| `tx_index`           | `INTEGER`     | Transaction index within the block.                                                                                                       |
| `trace_address`      | `TEXT`        | Position in call tree (e.g., "0", "0.0", "0.1.2").                                                                                        |
| `creator_address`    | `BYTEA`       | Address that deployed the contract (msg.sender of CREATE/CREATE2).                                                                        |
| `creation_call_type` | `TEXT`        | Type of creation: CREATE or CREATE2.                                                                                                      |
| `_tracing_id`        | `BYTEA`       | Internal tracing identifier for lineage tracking.                                                                                         |
| `_created_at`        | `TIMESTAMPTZ` | Record creation timestamp.                                                                                                                |
| `_updated_at`        | `TIMESTAMPTZ` | Record last update timestamp.                                                                                                             |

## Use Cases

* Contract registry and address validation
* Deployment tracking and contract lifecycle analysis
* Factory pattern analysis and contract creation patterns
* Security research and contract classification
* Integration with contract metadata and ABI databases
* Foundation for contract interaction analysis

## Related Datasets

<CardGroup cols={3}>
  <Card title="Function Results" icon="brackets-curly" href="/data-catalog/evm/primitives/function-results">
    Read-call results from contract view functions.
  </Card>

  <Card title="Internal Transactions" icon="sitemap" href="/data-catalog/evm/primitives/internal-transactions">
    Calls targeting these contract addresses.
  </Card>

  <Card title="Transactions" icon="arrow-right-arrow-left" href="/data-catalog/evm/primitives/transactions">
    Deployment and interaction transactions.
  </Card>
</CardGroup>
