📡0xgraph CLI Cheat sheet

Streamlined Guide: Deploying Subgraphs with the 0xgraph CLI

This quick start guide outlines streamlined instructions for deploying subgraphs using the Command Line Interface (CLI). Developers looking to swiftly incorporate subgraph capabilities into their projects will find straightforward guidance and pro tips for getting set up fast.

Summary: This cheat sheet condenses essential commands, tips, and best practices into an indispensable reference for anyone deploying a subgraph. Developers will find this streamlined guide invaluable for swiftly progressing through the deployment workflow and resolving frequent pain points. With key information consolidated in one place, engineers can deploy subgraphs more efficiently and focus their efforts on building applications powered by real-time, customizable blockchain data indexes.

Deployment Network definitions

For developers who are already familiar with Graph Protocol tooling, below are the network definitions to deploy subgraphs on 0xgraph. These settings can be configured in the subgraph.yaml file:

1. Get started by install the Graph cli

Download the Graph Cli to cli

npm i @xgraph/cli

2. Authentication with API key

  1. Authenticate using the 0xgraph Cli and API key.

Note: You need to specify the 0xgraph deployment endpoint. Your API key should only be used for the 0xgraph deployment endpoint.

0xgraph auth

Copy your API key when promoted by the command line

What is the deploy key?: ABCDE1234
Deploy key set for http://api.0xgraph.xyz/deploy

3. Generate types and mappings for your subgraph

  1. Go to your subgraph root directory where subgraph.yaml file is located.

cd <your_subgraph_project>
  1. Run the following command to generate types and mapping for your subgraph project

0xgraph codegen

4. Compile your subgraph

  1. Run the following command to compile your subgraph into WASM (WebAssembly).

0xgraph build        

5. Create your subgraph on 0xgraph

  1. Run the following command to create a subgraph entry on the 0xgraph Service. Note that this step only registers a subgraph and does not deploy the actual subgraph in the 0xgraph service.

0xgraph create <your_subgraph>

6. Deploy your subgraph to 0xgraph service

  1. Run the following command to deploy your subgraph to the 0xgraph service.

0xgraph deploy <your_subgraph>

7. Remove your subgraph from 0xgraph service

  1. Run the following command to remove/unregister your subgraph from the 0xgraph Subgraph Service.

0xgraph remove <your_subgraph>

Quick Start in the App

The 0xgraph Web App also offers a concise guide to assist users in deploying their subgraphs effectively.

Last updated