subgraphs > Cookbook > Tranfer to The Graph

Tranfer to The Graph

Reading time: 3 min

Quickly upgrade your subgraphs from any platform to The Graph's decentralized network.

Benefits of Switching to The Graph

Bu bölüme bağlantı
  • Use the same subgraph that your apps already use with zero-downtime migration.
  • Increase reliability from a global network supported by 100+ Indexers.
  • Receive lightning-fast support for subgraphs 24/7, with an on-call engineering team.

Upgrade Your Subgraph to The Graph in 3 Easy Steps

Bu bölüme bağlantı
  1. Set Up Your Studio Environment
  2. Deploy Your Subgraph to Studio
  3. Publish to The Graph Network

1. Set Up Your Studio Environment

Bu bölüme bağlantı

Create a Subgraph in Subgraph Studio

Bu bölüme bağlantı
  • Subgraph Studio'ya gidin ve cüzdanınızı bağlayın.
  • "Subgraph Oluştur" düğmesine tıklayın. Subgraph'in adını başlık formunda vermeniz önerilir: "Subgraph Adı Ağ Adı".

Note: After publishing, the subgraph name will be editable but requires on-chain action each time, so name it properly.

Install the Graph CLI⁠

Bu bölüme bağlantı

You must have Node.js and a package manager of your choice (npm or pnpm) installed to use the Graph CLI. Check for the most recent CLI version.

On your local machine, run the following command:

npm kullanarak:

npm install -g @graphprotocol/graph-cli@latest

Use the following command to create a subgraph in Studio using the CLI:

graph init --product subgraph-studio

Authenticate Your Subgraph

Bu bölüme bağlantı

In The Graph CLI, use the auth command seen in Subgraph Studio:

graph auth <your-auth-code>

2. Deploy Your Subgraph to Studio

Bu bölüme bağlantı

If you have your source code, you can easily deploy it to Studio. If you don't have it, here's a quick way to deploy your subgraph.

In The Graph CLI, run the following command:

graph deploy <slug> --ipfs-hash <your-subgraph-ipfs-hash>

Note: Every subgraph has an IPFS hash (Deployment ID), which looks like this: "Qmasdfad...". To deploy simply use this IPFS hash. You’ll be prompted to enter a version (e.g., v0.0.1).

3. Publish Your Subgraph to The Graph Network

Bu bölüme bağlantı

publish button

Query Your Subgraph

Bu bölüme bağlantı

To attract about 3 indexers to query your subgraph, it’s recommended to curate at least 3,000 GRT. To learn more about curating, check out Curating on The Graph.

You can start querying any subgraph by sending a GraphQL query into the subgraph’s query URL endpoint, which is located at the top of its Explorer page in Subgraph Studio.

CryptoPunks Ethereum subgraph by Messari:

Query URL

The query URL for this subgraph is:

https://gateway-arbitrum.network.thegraph.com/api/`**your-own-api-key**`/subgraphs/id/HdVdERFUe8h61vm2fDyycgxjsde5PbB832NHgJfZNqK

Now, you simply need to fill in your own API Key to start sending GraphQL queries to this endpoint.

Getting your own API Key

Bu bölüme bağlantı

You can create API Keys in Subgraph Studio under the “API Keys” menu at the top of the page:

API keys

Monitor Subgraph Status

Bu bölüme bağlantı

Once you upgrade, you can access and manage your subgraphs in Subgraph Studio and explore all subgraphs in The Graph Explorer.

  • To quickly create and publish a new subgraph, check out the Quick Start.
  • To explore all the ways you can optimize and customize your subgraph for a better performance, read more about creating a subgraph here.
Sayfayı Düzenle

Önceki
Substreams destekli subgraphlar
Sonraki
Subgraph Best Practice 1: Pruning with indexerHints
Sayfayı Düzenle