There are three primary ways to deploy a subgraph on Goldsky:

  1. From source code
  2. Migrating from The Graph or any other subgraph host
  3. Via instant, no-code subgraphs

For any of the above, you’ll need to have the Goldsky CLI installed and be logged in; you can do this by following the instructions below.

For these examples we’ll use the Ethereum contract for POAP.

From source code

If you’ve developed your own subgraph, you can deploy it from your system. In our example we’ll be using the open source POAP subgraph.

First we need to clone the Git repo.

git clone https://github.com/poap-xyz/poap-subgraph.git

Now change into that directory. From here, we’ll build the subgraph from templates. Open source subgraphs have different instructions to get them to build, so check the README.md or look at the package.json for hints as to the correct build commands. Usually it’s a two step process, but since POAP is deployed on multiple chains, there’s one extra step at the start to generate the correct data from templates.

Newer graph-cli versions

The POAP repo uses an older version of The Graph’s graph-cli package, and if you have a more recent version installed and see the error The current version of graph-cli can't be used with mappings on apiVersion less than '0.0.5' during codegen, edit the subgraph.template.yaml file and change the apiVersion value from 0.0.4 to 0.0.5

yarn prepare:mainnet
yarn codegen
yarn build

Then you can deploy the subgraph to Goldsky using the following command.

goldsky subgraph deploy poap-subgraph/1.0.0 --path .

From The Graph or another host

For a detailed walkthrough, follow our dedicated guide.

Via instant, no-code subgraphs

For a detailed walkthrough, follow our dedicated guide.