LogoLogo
Block ExplorerDiscordTwitterMirror
  • What Is Canto?
  • Free Public Infrastructure
    • NOTE
    • Canto Lending Market
    • Canto DEX
  • Canto Neofinance
    • Overview
    • Application Specific Dollar
  • User Guides
    • Connecting to Canto
    • Bridging Assets
      • Bridging to Canto
      • Bridging from Canto
      • Synapse Bridge
      • Celer cBridge
    • Providing Liquidity
    • Lending & Borrowing
    • Staking
    • Governance
  • EVM Development
    • Overview
    • Quickstart Guide
    • NOTE, DEX, and Lending Market
    • Contract Secured Revenue (CSR)
    • Verifying Contracts
    • Contract Addresses
    • Testnet
  • Running a Node
    • Validators
      • Quickstart Guide
      • Useful Commands
      • Snapshots
      • FAQ
      • Troubleshooting
      • Uptime
      • Slashing
    • Archive Node
    • Graph Node (Subgraphs)
  • Technical Reference
    • Application Specific Dollar
      • asdOFT
      • asdRouter
      • asdUSDC
    • Liquidity Coordinator
      • VotingEscrow
      • GaugeController
      • LendingLedger
      • LiquidityGauge
    • Architecture & Design
      • Onboarding Module
      • Gravity Bridge
      • NOTE Design
      • Canto Lending Protocol
      • IBC Token Recovery
    • Governance
      • Governance Module
      • GovShuttle Module
      • Lending Market Governance
    • Tokenomics
    • Audits
Powered by GitBook
On this page
  • Prerequisites
  • Graph Node Setup
  • Deploying Subgraphs
  1. Running a Node

Graph Node (Subgraphs)

PreviousArchive NodeNextApplication Specific Dollar

Last updated 1 year ago

This page is a work in progress. Contributions are welcome on the .

You can index historical activity on the Canto network by running a local Graph node, which custom subgraphs can be deployed to. This page contains instructions for doing so.

Prerequisites

In order to spin up a Graph node, you will need access to a Canto node with historical data. The recommended approach is to sync your own first.

You'll also need to install Docker and Docker Compose on the machine you'll use to run the Graph node.

Graph Node Setup

To set up the Graph node itself, start by cloning the default Graph repository:

git clone https://github.com/graphprotocol/graph-node/

If the Canto node you are using to sync is running on a different machine, change the RPC URL for the ethereum network in graph-node/docker/docker-compose.yml. Otherwise, the default value should work.

It is not necessary to change the name of the network, and doing so may require you to make additional config changes elsewhere.

Then run the setup file in graph-node/docker and start the node:

# Run setup
./setup.sh

# Start Graph node
docker-compose up

Optionally, use the --detach flag to start the Graph node in the background.

Deploying Subgraphs

After compiling the specification files, run the following commands to create and deploy the subgraph:

# Create the subgraph
graph create generated/sample --node http://127.0.0.1:8020

# Deploy the subgraph
graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 generated/sample ./generated/sample.subgraph.yaml

By default, Graph nodes host a GraphiQL user interface for each subgraph, which can be accessed at http://localhost:8000/subgraphs/name/generated/sample.

To deploy subgraphs to a Graph node, you'll need to create a subgraph specification consisting of both subgraph.yaml and schema.graphql files. Detailed information on creating subgraphs is available within .

For contracts implementing common token standards like ERC20, ERC721, or ERC1155, you can use the to automatically generate a subgraph specification.

These instructions are based on by Leon Do.

GitHub repo
archive node
The Graph's documentation
OpenZeppelin Subgraphs module
a guide