Please view the third-party content disclaimer here.
- Polygon Chain mainnet
- Amoy testnet
Prerequisites
- A smart contract deployed and verified on a supported Polygon network.
- Node.js installed.
- A Subgraph Studio account with a connected wallet.
Step 1: Initialize your subgraph project
Create a subgraph in Subgraph Studio
Go to Subgraph Studio and connect your wallet. Click Create a Subgraph. Use Title Case for the name, for example: “My Contract Polygon Chain”.

Install the Graph CLI
Initialize your subgraph
Copy the command from your subgraph page to include your specific subgraph slug:
Step 2: Deploy and publish
Deploy to Subgraph Studio
Build the subgraph:v0.0.1.
Test your subgraph
Use the playground in Subgraph Studio to run a sample query. The Details tab shows your API endpoint for testing from your dApp.
Publish to the decentralized network
When your subgraph is ready for production, click Publish on the subgraph page in Subgraph Studio:

Note: The Graph’s smart contracts are on Arbitrum One, even when your subgraph indexes data from Polygon or other supported chains.
Step 3: Query your subgraph
Once published, query your subgraph by sending a GraphQL query to the subgraph’s query URL. Find the URL at the top of the subgraph’s Explorer page. Example from the CryptoPunks Ethereum subgraph:
https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/HdVdERFUe8h61vm2fDyycgxjsde5PbB832NHgJfZNqK
Get an API key
In Subgraph Studio, open the API Keys menu at the top of the page to create an API key.