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

> ## Agent Instructions
> To query the Token Terminal data catalog, read https://tokenterminal.com/docs/catalog/agents-manual.md first. It is the whole catalog as one page: table naming grammar, key columns, partition and cluster rules, units, additivity, and the tables that are documented but not served yet.
> Never query a catalog table on a time bound alone. Also filter its cluster key, which you read from INFORMATION_SCHEMA.COLUMNS; an empty result means the object is a view, whose pruning contract is on its page. Compute is billed to the caller's own Google Cloud project.

# Contracts

> Every program deployed on Solana, with the account that deployed it.

`dimensions.contracts` holds one row per program deployed on Solana, keyed on `chain_id` and `contract_address`. Solana calls a smart contract a program, and the row describes the address's first deployment: the time it appeared and the account that signed for it. The list is everything we see onchain, which reaches far past the programs anyone has labeled. Joining [`dimensions.accounts`](/docs/catalog/accounts/registry) on `account_id` keeps the result to addresses a project has been attributed, and names them.

Every column is documented at [Contracts](/docs/catalog/contracts/registry).

## Sample queries

<Warning>
  The table is clustered on `chain_id` and `contract_address`, and those two columns are all that prunes a scan of it. Filter on the chain, and on the address where you have it; a query that filters on neither reads the whole table.
</Warning>

<Tabs>
  <Tab title="Look up a program">
    **When one Solana program was first deployed, and by whom.** The address is Orca's Whirlpools program, spelled in base58 exactly as the chain writes it.

    ```sql theme={null}
    select
        first_deployed_at,
        deployer_address
    from `dimensions.contracts`
    where chain_id = 'solana'
      and contract_address = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc'
    ```
  </Tab>

  <Tab title="One deployer's programs">
    **List the programs one account deployed.** `deployer_address` is the account that signed the deployment, so an account that ships many programs returns all of them in one read.

    ```sql theme={null}
    select
        contract_address,
        first_deployed_at
    from `dimensions.contracts`
    where chain_id = 'solana'
      and deployer_address = '9ZqQnmRNWDePm9d8SG4mymFRXArwBTPKkSTW6CbZhcCh'
    order by first_deployed_at desc
    limit 100
    ```
  </Tab>

  <Tab title="Named programs, newest first">
    **Date the labeled Solana programs.** Joining `dimensions.accounts` on `account_id` adds the project the address is attributed to and the name that project gives it, which turns a list of base58 strings into a readable one.

    ```sql theme={null}
    select
        accounts.project_id,
        accounts.contract_name,
        contracts.contract_address,
        contracts.first_deployed_at
    from `dimensions.contracts` as contracts
    join `dimensions.accounts` as accounts
        using (account_id)
    where contracts.chain_id = 'solana'
    order by contracts.first_deployed_at desc
    limit 100
    ```
  </Tab>
</Tabs>
