From e74bb0a2db7c4aaa79beb75b49bda4d3ee20e7b0 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:58:06 -0400 Subject: [PATCH 1/3] Removing page --- .../en/cookbook/upgrading-a-subgraph.mdx | 156 ------------------ 1 file changed, 156 deletions(-) delete mode 100644 website/pages/en/cookbook/upgrading-a-subgraph.mdx diff --git a/website/pages/en/cookbook/upgrading-a-subgraph.mdx b/website/pages/en/cookbook/upgrading-a-subgraph.mdx deleted file mode 100644 index a546f02c0800..000000000000 --- a/website/pages/en/cookbook/upgrading-a-subgraph.mdx +++ /dev/null @@ -1,156 +0,0 @@ ---- -title: Upgrading an Existing Subgraph to The Graph Network ---- - -## Introduction - -This is a guide on how to upgrade your subgraph from the hosted service to The Graph's decentralized network. Over 1,000 subgraphs have successfully upgraded to The Graph Network including projects like Snapshot, Loopring, Audius, Premia, Livepeer, Uma, Curve, Lido, and many more! - -The process of upgrading is quick and your subgraphs will forever benefit from the reliability and performance that you can only get on The Graph Network. - -### Prerequisites - -- You have a subgraph deployed on the hosted service. - -## Upgrading an Existing Subgraph to The Graph Network - - - -If you are logged in to the hosted service, you can access a simple flow to upgrade your subgraphs from [your dashboard](https://thegraph.com/hosted-service/dashboard), or from an individual subgraph page. - -> This process typically takes less than five minutes. - -1. Select the subgraph(s) you want to upgrade. -2. Connect or enter the receiving wallet (the wallet that will become the owner of the subgraph). -3. Click the "Upgrade" button. - -That's it! Your subgraphs will be deployed to Subgraph Studio, and published on The Graph Network. You can access the [Subgraph Studio](https://thegraph.com/studio/) to manage your subgraphs, logging in with the wallet specified during the upgrade process. - -You'll be able to view your subgraphs live on the decentralized network via [Graph Explorer](https://thegraph.com/explorer). - -### What next? - -When your subgraph is upgraded, it will automatically be indexed by the upgrade indexer. If the indexed chain is [fully supported by The Graph Network](/developing/supported-networks), you can add some GRT as "signal", to attract more indexers. It is recommended to curate your subgraph with at least 3,000 GRT to attract 2-3 Indexers for higher quality of service. - -You can start to query your subgraph right away on The Graph Network, once you have generated an API key. - -### Create an API key - -You can generate an API key in Subgraph Studio [here](https://thegraph.com/studio/apikeys/). - -![API key creation page](/img/api-image.png) - -You can use this API key to query subgraphs on The Graph Network. All users start on the Free Plan, which includes 100,000 free queries per month. Developers can sign up for the Growth Plan by connecting a credit or debit card, or by depositing GRT to Subgraph Studio billing system. - -> Note: see the [billing documentation](../billing) for more information on plans, and on managing your billing on Subgraph Studio. - -### Securing your API key - -It is recommended that you secure the API by limiting its usage in two ways: - -1. Authorized Subgraphs -2. Authorized Domain - -You can secure your API key [here](https://thegraph.com/studio/apikeys/). - -![Subgraph lockdown page](/img/subgraph-lockdown.png) - -### Querying your subgraph on the decentralized network - -Now you can check the indexing status of the Indexers on the network in Graph Explorer (example [here](https://thegraph.com/explorer/subgraphs/Dtj2HicXKpoUjNB7ffdBkMwt3L9Sz3cbENd67AdHu6Vb?view=Indexers&chain=arbitrum-one)). The green line at the top indicates that at the time of posting 7 Indexers successfully indexed that subgraph. Also in the Indexer tab you can see which Indexers picked up your subgraph. - -![Rocket Pool subgraph](/img/rocket-pool-subgraph.png) - -As soon as the first Indexer has fully indexed your subgraph you can start to query the subgraph on the decentralized network. In order to retrieve the query URL for your subgraph, you can copy/paste it by clicking on the symbol next to the query URL. You will see something like this: - -`https://gateway.thegraph.com/api/[api-key]/subgraphs/id/S9ihna8D733WTEShJ1KctSTCvY1VJ7gdVwhUujq4Ejo` - -Important: Make sure to replace `[api-key]` with an actual API key generated in the section above. - -You can now use that Query URL in your dapp to send your GraphQL requests to. - -Congratulations! You are now a pioneer of decentralization! - -> Note: Due to the distributed nature of the network it might be the case that different Indexers have indexed up to different blocks. In order to only receive fresh data you can specify the minimum block an Indexer has to have indexed in order to serve your query with the block: `{ number_gte: $minBlock }` field argument as shown in the example below: - -```graphql -{ - stakers(block: { number_gte: 14486109 }) { - id - } -} -``` - -More information about the nature of the network and how to handle re-orgs are described in the documentation article [Distributed Systems](/querying/distributed-systems/). - -## Updating a Subgraph on the Network - -If you would like to update an existing subgraph on the network, you can do this by deploying a new version of your subgraph to Subgraph Studio using the Graph CLI. - -1. Make changes to your current subgraph. -2. Deploy the following and specify the new version in the command (eg. v0.0.1, v0.0.2, etc): - -```sh -graph deploy --studio --version -``` - -3. Test the new version in Subgraph Studio by querying in the playground -4. Publish the new version on The Graph Network. Remember that this requires gas (as described in the section above). - -### Owner Update Fee: Deep Dive - -> Note: Curation on Arbitrum has a flat bonding curve. Learn more about Arbitrum [here](/arbitrum/arbitrum-faq/). - -An update requires GRT to be migrated from the old version of the subgraph to the new version. This means that for every update, a new bonding curve will be created (more on bonding curves [here](/network/curating#bonding-curve-101)). - -The new bonding curve charges the 1% curation tax on all GRT being migrated to the new version. The owner must pay 50% of this or 1.25%. The other 1.25% is absorbed by all the curators as a fee. This incentive design is in place to prevent an owner of a subgraph from being able to drain all their curator's funds with recursive update calls. If there is no curation activity, you will have to pay a minimum of 100 GRT in order to signal your own subgraph. - -Let's make an example, this is only the case if your subgraph is being actively curated on: - -- 100,000 GRT is signaled using auto-migrate on v1 of a subgraph -- Owner updates to v2. 100,000 GRT is migrated to a new bonding curve, where 97,500 GRT get put into the new curve and 2,500 GRT is burned -- The owner then has 1250 GRT burned to pay for half the fee. The owner must have this in their wallet before the update, otherwise, the update will not succeed. This happens in the same transaction as the update. - -_While this mechanism is currently live on the network, the community is currently discussing ways to reduce the cost of updates for subgraph developers._ - -### Maintaining a Stable Version of a Subgraph - -If you're making a lot of changes to your subgraph, it is not a good idea to continually update it and front the update costs. Maintaining a stable and consistent version of your subgraph is critical, not only from the cost perspective but also so that Indexers can feel confident in their syncing times. Indexers should be flagged when you plan for an update so that Indexer syncing times do not get impacted. Feel free to leverage the [#Indexers channel](https://discord.gg/JexvtHa7dq) on Discord to let Indexers know when you're versioning your subgraphs. - -Subgraphs are open APIs that external developers are leveraging. Open APIs need to follow strict standards so that they do not break external developers' applications. In The Graph Network, a subgraph developer must consider Indexers and how long it takes them to sync a new subgraph **as well as** other developers who are using their subgraphs. - -### Updating the Metadata of a Subgraph - -You can update the metadata of your subgraphs without having to publish a new version. The metadata includes the subgraph name, image, description, website URL, source code URL, and categories. Developers can do this by updating their subgraph details in Subgraph Studio where you can edit all applicable fields. - -Make sure **Update Subgraph Details in Explorer** is checked and click on **Save**. If this is checked, an on-chain transaction will be generated that updates subgraph details in the Explorer without having to publish a new version with a new deployment. - -## Best Practices for Deploying a Subgraph to The Graph Network - -1. Leveraging an ENS name for Subgraph Development: - -- Set up your ENS [here](https://app.ens.domains/) -- Add your ENS name to your settings [here](https://thegraph.com/explorer/settings?view=display-name). - -2. The more filled out your profiles are, the better the chances for your subgraphs to be indexed and curated. - -## Deprecating a Subgraph on The Graph Network - -Follow the steps [here](/managing/transfer-and-deprecate-a-subgraph) to deprecate your subgraph and remove it from The Graph Network. - -## Querying a Subgraph + Billing on The Graph Network - -The hosted service was set up to allow developers to deploy their subgraphs without any restrictions. - -On The Graph Network, query fees have to be paid as a core part of the protocol's incentives. For more information on subscribing to APIs and paying the query fees, check out billing documentation [here](/billing/). - -## Additional Resources - -If you're still confused, fear not! Check out the following resources or watch our video guide on upgrading subgraphs to the decentralized network below: - - - -- [The Graph Network Contracts](https://github.com/graphprotocol/contracts) -- [Curation Contract](https://github.com/graphprotocol/contracts/blob/dev/contracts/curation/Curation.sol) - the underlying contract that the GNS wraps around - - Address - `0x8fe00a685bcb3b2cc296ff6ffeab10aca4ce1538` -- [Subgraph Studio documentation](/deploying/subgraph-studio) From 7aab9afb1185de92f16dd4f655e68a54bd769673 Mon Sep 17 00:00:00 2001 From: Michael Macaulay <56690114+MichaelMacaulay@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:01:20 -0400 Subject: [PATCH 2/3] Editing _meta.js --- website/pages/en/cookbook/_meta.js | 1 - 1 file changed, 1 deletion(-) diff --git a/website/pages/en/cookbook/_meta.js b/website/pages/en/cookbook/_meta.js index 7e889981d65e..6163c54db4f9 100644 --- a/website/pages/en/cookbook/_meta.js +++ b/website/pages/en/cookbook/_meta.js @@ -1,6 +1,5 @@ export default { 'base-testnet': '', - 'upgrading-a-subgraph': '', 'subgraph-debug-forking': '', near: '', cosmos: '', From e78b592f845481766c07a8d704a4dd727109f258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Rouleau?= Date: Tue, 10 Sep 2024 18:34:04 -0400 Subject: [PATCH 3/3] Update _meta.js --- website/pages/en/cookbook/_meta.js | 1 - 1 file changed, 1 deletion(-) diff --git a/website/pages/en/cookbook/_meta.js b/website/pages/en/cookbook/_meta.js index 6163c54db4f9..9232d85d9f30 100644 --- a/website/pages/en/cookbook/_meta.js +++ b/website/pages/en/cookbook/_meta.js @@ -1,5 +1,4 @@ export default { - 'base-testnet': '', 'subgraph-debug-forking': '', near: '', cosmos: '',