Skip to content

Commit bade84b

Browse files
committed
Edits
1 parent 35a7874 commit bade84b

File tree

1 file changed

+95
-25
lines changed

1 file changed

+95
-25
lines changed

website/pages/en/network/developing.mdx

Lines changed: 95 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,122 @@
22
title: Developing
33
---
44

5-
Developers are the demand side of The Graph ecosystem. Developers build subgraphs and publish them to The Graph Network. Then, they query live subgraphs with GraphQL in order to power their applications.
5+
Learn developer fundamentals and review the basics of a subgraph’s lifecycle. To start coding right away and engage The Graph, go to the following: [Developer Quick Start](/quick-start/)
66

7-
## Subgraph Lifecycle
7+
## Overview
88

9-
Subgraphs deployed to the network have a defined lifecycle.
9+
As a developer, you need important data to build and power your dapps. Querying and indexing that blockchain data can be challenging, but The Graph provides a solution to this issue.
1010

11-
### Build locally
11+
On The Graph, you can:
1212

13-
As with all subgraph development, it starts with local development and testing. Developers can use the same local setup whether they are building for The Graph Network or a local Graph Node, leveraging `graph-cli` and `graph-ts` to build their subgraph. Developers are encouraged to use tools such as [Matchstick](https://github.com/LimeChain/matchstick) for unit testing to improve the robustness of their subgraphs.
13+
1. Create, deploy and publish subgraphs to The Graph using **Graph CLI** and [Subgraph Studio](/https://thegraph.com/studio/).
14+
2. Use Graph node via **GraphQL** to query live subgraphs and power dapps.
1415

15-
> There are certain constraints on The Graph Network, in terms of feature and network support. Only subgraphs on [supported networks](/developing/supported-networks) will earn indexing rewards, and subgraphs which fetch data from IPFS are also not eligible.
16+
### What is GraphQL and Graph CLI?
1617

17-
### Deploy to Subgraph Studio
18+
- **GraphCLI** is a command line interface tool for building and deploying to The Graph.
19+
- **GraphQL** is the query language use for APIs and a runtime for executing those queries with your existing data. The Graph uses GraphQL to query subgraphs.
1820

19-
Once defined, the subgraph can be built and deployed to [Subgraph Studio](/deploying/subgraph-studio-faqs/). Subgraph Studio is a sandbox environment which will index the deployed subgraph and make it available for rate-limited development and testing. This gives developers an opportunity to verify that their subgraph does not encounter any indexing errors, and works as expected.
21+
### Developer Capabilities
2022

21-
### Publish to the Network
23+
- Engage with the entire subgraph lifecycle on the network, including publishing, querying and iterating on your custom subgraphs.
24+
- Specialize in subgraph development, building open APIs for others to utilize and build on.
25+
- Focus on application development by querying subgraphs deployed by other developers.
2226

23-
When the developer is happy with their subgraph, they can publish it to The Graph Network. This is an on-chain action, which registers the subgraph so that it is discoverable by Indexers. Published subgraphs have a corresponding NFT, which is then easily transferable. The published subgraph has associated metadata, which provides other network participants with useful context and information.
27+
### Network Economics
2428

25-
### Signal to Encourage Indexing
29+
As a developer, you can do any of the following:
2630

27-
Published subgraphs are unlikely to be picked up by Indexers without the addition of signal. Signal is locked GRT associated with a given subgraph, which indicates to Indexers that a given subgraph will receive query volume, and also contributes to the indexing rewards available for processing it. Subgraph developers will generally add signal to their subgraph, in order to encourage indexing. Third party Curators may also signal on a given subgraph, if they deem the subgraph likely to drive query volume.
31+
- Lock up GRT to encourage indexing and the query subgraphs.
32+
- Burn GRT whenever a subgraph is updated.
2833

29-
### Querying & Application Development
34+
## Subgraph Specifics
3035

31-
Once a subgraph has been processed by Indexers and is available for querying, developers can start to use the subgraph in their applications. Developers query subgraphs via a gateway, which forwards their queries to an Indexer who has processed the subgraph, paying query fees in GRT.
36+
### What are subgraphs?
3237

33-
In order to make queries, developers must generate an API key, which can be done in Subgraph Studio. This API key must be funded with GRT, in order to pay query fees. Developers can set a maximum query fee, in order to control their costs, and limit their API key to a given subgraph or origin domain. Subgraph Studio provides developers with data on their API key usage over time.
38+
A subgraph is a custom API built on blockchain data. It extracts data from a blockchain, process it, and stores it so that it can be easily queried via GraphQL.
3439

35-
Developers are also able to express an Indexer preference to the gateway, for example preferring Indexers whose query response is faster, or whose data is most up to date. These controls are set in Subgraph Studio.
40+
A subgraph primarily consists of the following files:
3641

37-
### Updating Subgraphs
42+
- `subgraph.yaml`: this YAML file contains the subgraph manifest
43+
- `subgraph.graphql`: this GraphQL schema defines what data is stored for your subgraph, and how to query it via GraphQL
44+
- `AssemblyScript Mappings`: [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) code that translates from the event data to the entities defined in your schema
3845

39-
After a time a subgraph developer may want to update their subgraph, perhaps fixing a bug or adding new functionality. The subgraph developer may deploy new version(s) of their subgraph to Subgraph Studio for rate-limited development and testing.
46+
Learn the detailed specifics to [create a subgraph](/developing/creating-a-subgraph/).
4047

41-
Once the Subgraph Developer is ready to update, they can initiate a transaction to point their subgraph at the new version. Updating the subgraph migrates any signal to the new version (assuming the user who applied the signal selected "auto-migrate"), which also incurs a migration tax. This signal migration should prompt Indexers to start indexing the new version of the subgraph, so it should soon become available for querying.
48+
### Subgraph Lifecycle
4249

43-
### Deprecating Subgraphs
50+
Here is a general view of a subgraph’s cycle:
4451

45-
At some point a developer may decide that they no longer need a published subgraph. At that point they may deprecate the subgraph, which returns any signalled GRT to the Curators.
52+
![Subgraph Lifecycle](/img/subgraph-lifecycle.png)
4653

47-
### Diverse Developer Roles
54+
### Subgraph Development
4855

49-
Some developers will engage with the full subgraph lifecycle on the network, publishing, querying and iterating on their own subgraphs. Some may be focused on subgraph development, building open APIs which others can build on. Some may be application focused, querying subgraphs deployed by others.
56+
Subgraph development starts with local development and staging.
5057

51-
### Developers and Network Economics
58+
- You can use the same local setup whether you're building for The Graph Network or a local Graph Node.
59+
- You can leverage `graph-cli` and `graph-ts` to build your subgraph.
60+
- You are encouraged to use tools such as [Matchstick](https://github.com/LimeChain/matchstick) for unit testing to improve the robustness of your subgraphs.
5261

53-
Developers are a key economic actor in the network, locking up GRT in order to encourage indexing, and crucially querying subgraphs, which is the network's primary value exchange. Subgraph developers also burn GRT whenever a subgraph is updated.
62+
> Only subgraphs on [supported networks](/developing/supported-networks/) will earn indexing rewards. Subgraphs that fetch data from IPFS are also **not** eligible.
63+
64+
## Deploy to Subgraph Studio
65+
66+
Once defined, a subgraph can be built and deployed to [Subgraph Studio](/deploying-a-subgraph-to-studio/). In Subgraph Studio, you can do the following:
67+
68+
- Verify that your subgraph doesn't have any indexing errors and works as expected.
69+
- Use its staging environment to index the deployed subgraph and make it available for review.
70+
71+
Learn how to [deploy subgraphs](/deploying-a-subgraph-to-studio/).
72+
73+
## Publish to the Network
74+
75+
When you are happy with your subgraph, you can publish it to The Graph Network.
76+
77+
- This is an on-chain action, which registers the subgraph and makes it discoverable by Indexers.
78+
- Published subgraphs have a corresponding NFT, which is then easily transferable.
79+
- Published subgraphs have associated metadata, which provides other network participants with useful context and information.
80+
81+
Learn how to [publish a subgraph](/publishing/publishing-a-subgraph/).
82+
83+
## Add Signal for Indexing
84+
85+
Published subgraphs are unlikely to be picked up by Indexers without signal. To encourage indexing you should add signal to your subgraph.
86+
87+
**What is signal?**
88+
89+
- Signal is locked GRT associated with a given subgraph. It indicates to indexers that a given subgraph will receive query volume and it contributes to the indexing rewards available for processing it.
90+
- Third party Curators may also signal on a given subgraph, if they deem the subgraph likely to drive query volume.
91+
92+
Learn more about signaling and [curating](/network/curating/) on The Graph.
93+
94+
## Querying & Application Development
95+
96+
Once a subgraph has been processed by Indexers and is available for querying, you can start using your subgraph in your applications.
97+
98+
- You query subgraphs via a gateway, which forwards your queries to an Indexer who has processed the subgraph (paying query fees in GRT).
99+
- In order to make queries, you must generate an API key, which can be done in [Subgraph Studio](/https://thegraph.com/studio/).
100+
- This API key must be funded with GRT to pay query fees.
101+
- You can set a maximum query fee to control their costs and limit your API key to a given subgraph or origin domain.
102+
- Subgraph Studio provides you with data on your API key usage over time.
103+
- You can express an Indexer preference to the gateway, such as preferring Indexers with fast query response or have up-to-date data. These controls are set in Subgraph Studio.
104+
105+
Learn more about [querying](/querying/querying-the-graph/).
106+
107+
## Updating Subgraphs
108+
109+
To update your subgraph with bug fixes or new functionalities, initiate a transaction to point it to the new version. You can deploy new versions of your subgraphs to [Subgraph Studio](/https://thegraph.com/studio/) for development and testing.
110+
111+
- If you selected "auto-migrate" when you applied the signal, updating the subgraph will migrate any signal to the new version and incur a migration tax.
112+
- This signal migration should prompt Indexers to start indexing the new version of the subgraph, so it should soon become available for querying.
113+
114+
## Deprecating Subgraphs
115+
116+
If you no longer need a published subgraph, then you will need to deprecate the subgraph.
117+
118+
- Deprecating a subgraph returns any signaled GRT to Curators.
119+
- To deprecate a subgraph, see the [deprecating a subgraph guide](/network/developing/deprecating-a-subgraph/).
120+
121+
## Transferring Subgraph
122+
123+
You can transfer the ownership of a subgraph. To transfer subgraph ownership, see the [transfer subgraph guide](/transferring-subgraph-ownership/).

0 commit comments

Comments
 (0)