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

# 4. Get On-chain Data

Here are some of the important parameters to take note of while using Onchain DEX API Endpoints:

* Blockchain Networks
* DEXs
* Pool Contract Address
* Token Contract Address

## Blockchain Networks

<Note>
  ### Notes

  * Please do not use CoinGecko Asset Platform ID as the Network ID in Onchain DEX API Endpoints (CoinGecko Asset Platform ID ≠ GT Network ID)

  * Example:

    * Asset Platform on CoinGecko: `ethereum`
    * Onchain Network ID: `eth`
</Note>

**How to obtain Network ID?**

* Use [/onchain/networks](/reference/networks-list) endpoint, example of response:

  <CodeGroup>
    ```json JSON theme={null}
    {
      "data": [
        {
          "id": "eth",  👈 Network ID
          "type": "network",
          "attributes": {
            "name": "Ethereum",
            "coingecko_asset_platform_id": "ethereum" 👈 CoinGecko Asset Platform ID
          }
        },
       ......
      ]
    }
    ```
  </CodeGroup>

* Go to [GeckoTerminal](https://www.geckoterminal.com/)

  1. Select or search for a blockchain network.

  2. Copy the slug from the URL:

  <img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/5b9a903-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=3d58e3708238e2c869afeb50f36ba74a" alt="" width="3024" height="1964" data-path="images/docs/5b9a903-image.png" />

## DEXs

Some of the pools endpoints require you to provide a DEX ID along with a Network ID to query the pools on a particular DEX (Decentralized Exchange).

Using the [/onchain/networks/\{network}/dexes/\{dex}/pools](/reference/top-pools-dex) endpoint as an example:

* `https://pro-api.coingecko.com/api/v3/onchain/networks/eth/dexes/uniswap_v3/pools?x_cg_pro_api_key=YOUR_API_KEY`

There are 2 parameter values required for this endpoint:

* `network`: `eth` (network ID)
* `dex`: `uniswap_v3` (DEX ID)

**How to obtain DEX ID?**

* Use [/onchain/networks/\{network}/dexes](/reference/dexes-list) endpoint, example of response:

  <CodeGroup>
    ```json JSON theme={null}
    {
      "data": [
        {
          "id": "uniswap_v2", 👈 DEX ID
          "type": "dex",
          "attributes": {
            "name": "Uniswap V2"
          }
        },
      ......
      ]
    }
    ```
  </CodeGroup>

* Go to [GeckoTerminal](https://www.geckoterminal.com/)

  1. Select or search for a blockchain network.

  2. Choose the DEX from the DEXs List on the top (e.g. Uniswap V3).

  3. Copy the slug from the URL:

  <img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/f68325c-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=58ed481ea98687173a3cbf9493c73669" alt="" width="3024" height="1964" data-path="images/docs/f68325c-image.png" />

## Methods to query Onchain Data

### a. Pool Contract Address

Most of the time, you will need a pool contract address along with a Network ID to query the onchain data, especially when using the Pools Endpoints.

Using the [/onchain/networks/\{network}/pools/\{address}](/reference/pool-address) endpoint as an example:

* `https://pro-api.coingecko.com/api/v3/onchain/networks/eth/pools/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc?x_cg_pro_api_key=YOUR_API_KEY`

There are 2 parameter values required for this endpoint:

* `network`: `eth` (network ID)
* `address`: `0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc` (pool contract address)

**How to obtain the pool contract address? (e.g. `WETH/USDC`)**

* Look for the contract address section of the pool page on [GeckoTerminal](https://www.geckoterminal.com/eth/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640):

  <img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/741fbc7-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=a80b0dafe3d5db5a527e02ea18fcc2ad" alt="" width="3023" height="1708" data-path="images/docs/741fbc7-image.png" />

* Get the pool contract address from the project website, white-paper, documentation, or block explorer site:

  * [Block Explorer (Etherscan)](https://etherscan.io/address/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640)
  * [DEX (Uniswap)](https://info.uniswap.org/#/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640)

### b. Token Contract Address

Apart from the pool contract address, you also have the option to query onchain data by using the token contract address, using the [/onchain/networks/\{network}/tokens/\{token\_address}/pools](/reference/top-pools-contract-address) endpoint as an example:

* `https://pro-api.coingecko.com/api/v3/onchain/networks/eth/tokens/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48/pools?x_cg_pro_api_key=YOUR_API_KEY`

There are 2 parameter values required for this endpoint:

* `network`: `eth` (network ID)
* `address`: `0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` (token contract address)

**How to obtain token contract address (e.g. UNI):**

* Look for the contract address section of the token page on GeckoTerminal:

  <img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/56f6c15-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=f889558b4ea90de11cb582a6b7de0abc" alt="" width="3023" height="1714" data-path="images/docs/56f6c15-image.png" />

* Get the token contract address from the project website, white-paper, documentation, or block explorer site. For example:

  * [Uniswap Documentation](https://docs.uniswap.org/protocol/concepts/governance/overview#uni-address)
  * [DEX (Uniswap)](https://info.uniswap.org/#/tokens/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984)
  * [Block Explorer (Etherscan)](https://etherscan.io/token/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984)
