|
| 1 | +--- |
| 2 | +title: Tranfer to The Graph |
| 3 | +--- |
| 4 | + |
| 5 | +Quickly upgrade your subgraphs from any platform to [The Graph's decentralized network](https://thegraph.com/networks/). |
| 6 | + |
| 7 | +## Benefits of Switching to The Graph |
| 8 | + |
| 9 | +- Use the same subgraph that your apps already use with zero-downtime migration. |
| 10 | +- Increase reliability from a global network supported by 100+ Indexers. |
| 11 | +- Receive lightning-fast support for subgraphs 24/7, with an on-call engineering team. |
| 12 | + |
| 13 | +## Upgrade Your Subgraph to The Graph in 3 Easy Steps |
| 14 | + |
| 15 | +1. [Set Up Your Studio Environment](/cookbook/transfer-to-the-graph/#1-set-up-your-studio-environment) |
| 16 | +2. [Deploy Your Subgraph to Studio](/cookbook/transfer-to-the-graph/#2-deploy-your-subgraph-to-studio) |
| 17 | +3. [Publish to The Graph Network](/cookbook/transfer-to-the-graph/#publish-your-subgraph-to-the-graphs-decentralized-network) |
| 18 | + |
| 19 | +## 1. Set Up Your Studio Environment |
| 20 | + |
| 21 | +### Create a Subgraph in Subgraph Studio |
| 22 | + |
| 23 | +- Go to [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet. |
| 24 | +- Click "Create a Subgraph". It is recommended to name the subgraph in Title Case: "Subgraph Name Chain Name". |
| 25 | + |
| 26 | +> Note: After publishing, the subgraph name will be editable but requires on-chain action each time, so name it properly. |
| 27 | +
|
| 28 | +### Install the Graph CLI |
| 29 | + |
| 30 | +You must have [Node.js](https://nodejs.org/) and a package manager of your choice (`npm` or `pnpm`) installed to use the Graph CLI. Check for the [most recent](https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI version. |
| 31 | + |
| 32 | +On your local machine, run the following command: |
| 33 | + |
| 34 | +Using [npm](https://www.npmjs.com/): |
| 35 | + |
| 36 | +```sh |
| 37 | +npm install -g @graphprotocol/graph-cli@latest |
| 38 | +``` |
| 39 | + |
| 40 | +Use the following command to create a subgraph in Studio using the CLI: |
| 41 | + |
| 42 | +```sh |
| 43 | +graph init --product subgraph-studio |
| 44 | +``` |
| 45 | + |
| 46 | +### Authenticate Your Subgraph |
| 47 | + |
| 48 | +In The Graph CLI, use the auth command seen in Subgraph Studio: |
| 49 | + |
| 50 | +```sh |
| 51 | +graph auth --studio <your-auth-code> |
| 52 | +``` |
| 53 | + |
| 54 | +## 2. Deploy Your Subgraph to Studio |
| 55 | + |
| 56 | +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. |
| 57 | + |
| 58 | +In The Graph CLI, run the following command: |
| 59 | + |
| 60 | +```sh |
| 61 | +graph deploy --studio <slug> --ipfs-hash <your-subgraph-ipfs-hash> |
| 62 | + |
| 63 | +``` |
| 64 | + |
| 65 | +> **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). |
| 66 | +
|
| 67 | +## 3. Publish Your Subgraph to The Graph Network |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +### Query Your Subgraph |
| 72 | + |
| 73 | +> 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](/network/curating/) on The Graph. |
| 74 | +
|
| 75 | +You can start [querying](/querying/querying-the-graph/) 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. |
| 76 | + |
| 77 | +#### Example |
| 78 | + |
| 79 | +[CryptoPunks Ethereum subgraph](https://thegraph.com/explorer/subgraphs/HdVdERFUe8h61vm2fDyycHgxjsde5PbB832NHgJfZNqK) by Messari: |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +The query URL for this subgraph is: |
| 84 | + |
| 85 | +```sh |
| 86 | +https://gateway-arbitrum.network.thegraph.com/api/`**your-own-api-key**`/subgraphs/id/HdVdERFUe8h61vm2fDyycgxjsde5PbB832NHgJfZNqK |
| 87 | +``` |
| 88 | + |
| 89 | +Now, you simply need to fill in **your own API Key** to start sending GraphQL queries to this endpoint. |
| 90 | + |
| 91 | +### Getting your own API Key |
| 92 | + |
| 93 | +You can create API Keys in Subgraph Studio under the “API Keys” menu at the top of the page: |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +### Monitor Subgraph Status |
| 98 | + |
| 99 | +Once you upgrade, you can access and manage your subgraphs in [Subgraph Studio](https://thegraph.com/studio/) and explore all subgraphs in [The Graph Explorer](https://thegraph.com/networks/). |
| 100 | + |
| 101 | +### Additional Resources |
| 102 | + |
| 103 | +- To quickly create and publish a new subgraph, check out the [Quick Start](/quick-start/). |
| 104 | +- To explore all the ways you can optimize and customize your subgraph for a better performance, read more about [creating a subgraph here](/developing/creating-a-subgraph/). |
0 commit comments