Deploy an Indexer (Subgraph) on Cronos with The Graph
Uncover the steps to deploy a subgraph on Cronos using The Graph for seamless blockchain data indexing and querying.
Creating a subgraph on Cronos using Mobula’s infrastructure is a straightforward task. This guide will help you set up and deploy your subgraph on the Cronos network efficiently.
What you’ll need
- Basic knowledge of The Graph and subgraphs.
- Your subgraph project files.
- The Graph CLI installed.
- A Mobula API key (for authentication).
Walkthrough
Prepare Your Subgraph
Set up your subgraph for Cronos. Update your subgraph.yaml
file to reference Cronos-specific contracts and events. If you don’t have a subgraph, you can clone the Uniswap V2 (CronaSwap) subgraph template and adapt it for Cronos:
git clone https://github.com/MobulaFi/univ2-subgraph-cronos
Install Dependencies
Make sure you have The Graph CLI installed:
npm install -g @graphprotocol/graph-cli
Build Your Subgraph
Compile your subgraph before deployment:
graph codegen && graph build
Create the Subgraph
Use the following command to deploy your subgraph:
graph create --node http://subgraph.mobula.io:8020
Deploy to Mobula's Cronos Node
Use the following command to deploy your subgraph:
graph deploy --node http://subgraph.mobula.io:8020 --ipfs http://subgraph.mobula.io:5001 --network cronos
Authenticate
Upon request, provide your Mobula API key for authentication. For additional guidance on acquiring and utilizing your API key, see the authentication section.
Monitor Deployment
After deployment, you’ll receive a URL to monitor your subgraph’s indexing progress and status.
Best Practices
- Keep your subgraph up to date to ensure it aligns with the latest Cronos network changes.
- Conduct comprehensive testing on a testnet before mainnet deployment.
- Continuously monitor performance and fine-tune queries for maximum efficiency.
Troubleshooting
If you encounter deployment problems:
- Double-check your
subgraph.yaml
configuration. - Verify that the network name and Mobula node URLs are correct.
- Make sure your API key is valid and properly authorized.
Need assistance? Our support team is ready to help with any questions or deployment challenges.