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

# Get Contract Code and Data

> Retrieve contract code and data using TON explorers or the get_info method.

To retrieve the code and data of a contract, use TON explorers such as [tonviewer.com](https://tonviewer.com), [tonscan.org](https://tonscan.org), and others, or use the `get_info` method programmatically.

## Using TON Explorers

1. Open [Tonviewer](https://tonviewer.com).
2. Enter the contract address into the search field.
3. Navigate to the **Code** tab.
4. The **Bytecode** section contains the contract code.
5. The **Raw data** section contains the contract data.

## Using the get\_info Method

```python theme={"theme":{"light":"github-light-default","dark":"dark-plus"}}
from ton_core import NetworkGlobalID

from tonutils.clients import ToncenterClient

# Contract address to inspect
CONTRACT_ADDRESS = "EQ..."


async def main() -> None:
    client = ToncenterClient(network=NetworkGlobalID.MAINNET)
    await client.connect()

    info = await client.get_info(CONTRACT_ADDRESS)

    # Print contract code (hex-encoded BoC)
    print(info.code.to_boc().hex())

    # Print contract data (hex-encoded BoC)
    print(info.data.to_boc().hex())

    await client.close()


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())
```

`info.code` and `info.data` are `None` for contracts that are not deployed. The raw hex-encoded BoC strings are also available directly as `info.code_raw` and `info.data_raw`.

See also [ContractInfo Fields Overview](/how-to/get-contract-information#contractinfo-fields-overview).
