Multichain queries with Insight API

Multichain queries with Insight API

We’re excited to announce a major update to Insight API! The latest changes enhance the API’s functionality by introducing multichain support, enabling seamless data fetching across multiple blockchain networks.

What's New?

Multichain Queries Across All Endpoints

  • Parallel Data Fetching: Fetch data from multiple chains simultaneously, improving efficiency.
  • Consolidated Responses: Responses now include chain_ids in the payload to identify the source chain for each piece of data.
  • Enhanced Response Schema: Added metadata fields:
    • chain_ids: List of queried chain IDs.
    • total_items: Total count across all chains.
    • limit_per_chain: Indicates the per-chain limit derived from the request's original limit.

Chain IDs Validation

Only requests with supported chain IDs—validated against Thirdweb Insight’s chain list—are now processed. This ensures consistent and accurate responses.

Updated Endpoints

The following endpoints now support multichain queries:

  • /tokens/erc20[erc721/erc1155]/{address}: Consolidates token balances across chains
  • /events: Returns events from specified chains, preserving chain identification.
  • /transactions: Provides transactions with proper error handling for invalid chain IDs.
  • /query: Delivers raw query results with metadata for chain information.

Backward Compatibility

Existing single-chain requests remain fully supported, ensuring no disruptions for current users.

Example Requests

Single-Chain Request

curl -X GET "https://insight.thirdweb.com/v1/{clientId}/events/0x6e55472109e6abe4054a8e8b8d9edffcb31032c5/Transfer(address,address,uint256)?limit=100&chain=660279"

Multichain Request

curl -X GET "https://insight.thirdweb.com/v1/{clientId}/events/0x6e55472109e6abe4054a8e8b8d9edffcb31032c5/Transfer(address,address,uint256)?limit=100&chain=1&chain=660279"

Response Example

{
  "meta": {
    "chain_ids": [1, 660279],
    "total_items": 113,
    "limit_per_chain": 100,
    "...": "..."
  },
  "data": [
    {
      "chainId": 1,
      "...": "..."
    },
    {
      "chainId": 660279,
      "...": "..."
    }
  ]
}

Looking Ahead

This update lays the groundwork for future improvements on multichain queries via Insight API. As we continue to expand, our goal is to make working with multichain data as seamless and efficient as possible.

Start leveraging these improvements today to explore multichain insights more effectively!