Subgraphs

Overview

Subgraphs are custom APIs built on top of blockchain data that can be queried using GraphQL. Developers can build and deploy subgraphs to transform raw blockchain data into more useful formats to power their applications.

PGN subgraphs can be deployed on Goldsky; for more information on getting started, visit Goldsky's documentation (opens in a new tab).

How to deploy subgraphs

PGN subgraphs on Goldsky can be deployed in 2 ways:

  • Via CLI from a local subgraph configuration file. If you are familiar with developing subgraphs already, you'll be familiar with this approach; after defining a subgraph lcoally (with a subgraph.yaml file, a schema.graphql file, and the necessary mappings to translate raw event data into the entities defined in the schema), you can deploy subgraphs to Goldsky (once the Goldsky CLI is installed) using goldsky subgraph deploy <name>/<version> --path.
  • Via instant subgraphs (opens in a new tab), where you can pass through a contract address and the ABI for that contract. This is a quick-start option that automatically generates the underlying subgraph configuration files on your behalf, making it easy to extract blockchain event data and serve it as an API endpoint without complex setup. Use the --from-ipfs-hash flag in the command above instead of --path.

Both PGN mainnet and testnet are available at the chain slugs publicgoods and publigoods-testnet respectively.