Subgraphs Quickstart

A developer's guide to developing and deploying to Alchemy Subgraphs.

Getting Started

Creating a new subgraph

  1. Install the graph-cli:

    bash
    $npm install -g @graphprotocol/graph-cli
  2. Retrieve contract address and related ABI.

  3. Create a new subgraph:

    bash
    $graph init --from-contract <0x_CONTRACT_ADDRESS> --abi '<PATH_TO_ABI>'
  4. Make modifications as necessary to the manifest, schema, and handlers.

  5. See Developing a Subgraph for more details.

Deploying your subgraph

  1. Get your deploy key from your Alchemy Dashboard.

  2. Run the following:

    bash
    $cd <SUBGRAPH_DIRECTORY>
    >
    >graph deploy <SUBGRAPH_NAME> \
    > --version-label <VERSION_NAME> \
    > --node https://subgraphs.alchemy.com/api/subgraphs/deploy \
    > --deploy-key <DEPLOY_KEY>
    > --ipfs https://ipfs.satsuma.xyz

    See Deploying a Subgraph for more details.

  3. You’ll receive a link to view your newly deployed subgraph. Congrats! 🎉