Deploy an Indexer (Subgraph) on Matchain with The Graph
A step-by-step guide to deploying a subgraph on Matchain using The Graph for efficient blockchain data indexing.
Deploying a subgraph on Matchain with Mobula’s infrastructure is a simple process. This guide will take you through the steps to get your subgraph running on the Matchain network.
What you’ll need
- Fundamental understanding of The Graph and subgraphs.
- Your subgraph project files ready.
- The Graph CLI installed
- A Mobula API key (for authentication)
Walkthrough
Prepare Your Subgraph
Make sure your subgraph is configured for Matchain. Update your subgraph.yaml
file to point to Matchain specific contracts and events. If you don’t have a subgraph, you can clone the Uniswap V2 (MSwap) subgraph template and customize it for Matchain:
git clone https://github.com/MobulaFi/univ2-subgraph-matchain
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 https://subgraph.mobula.io:8020
Deploy to Mobula's Matchain Node
Use the following command to deploy your subgraph:
graph deploy --node https://subgraph.mobula.io:8020 --ipfs https://subgraph.mobula.io:5001 --network matchain
Authenticate
When asked, enter your Mobula API key for authentication. For further details on acquiring and using your API key, refer to the authentication section.
Monitor Deployment
Following deployment, you’ll be provided with a URL to track your subgraph’s indexing progress and status.
Best Practices
- Keep your subgraph regularly updated to ensure it remains compatible with the latest Matchain network changes.
- Thoroughly test your subgraph on a testnet before deploying to the mainnet.
- Continuously monitor its performance and optimize queries for greater efficiency.
Troubleshooting
If you encounter issues during deployment:
- Review your
subgraph.yaml
configuration. - Confirm that you’re using the correct network name and Mobula node URLs.
- Ensure your API key is valid and has the required permissions.
Need help? Our support team is available to assist with any questions or deployment challenges you may face.