Skip to content

Commit 69b117f

Browse files
developing-page (#746)
* Moved sections * Multiple Edits --------- Co-authored-by: Michael Macaulay <[email protected]>
1 parent 6ed5cba commit 69b117f

File tree

1 file changed

+60
-24
lines changed

1 file changed

+60
-24
lines changed

website/pages/en/network/developing.mdx

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,88 @@
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+
To start coding right away, go to [Developer Quick Start](/quick-start/).
6+
7+
## Overview
8+
9+
As a developer, you need data to build and power your dapp. Querying and indexing blockchain data is challenging, but The Graph provides a solution to this issue.
10+
11+
On The Graph, you can:
12+
13+
1. Create, deploy, and publish subgraphs to The Graph using Graph CLI and [Subgraph Studio](https://thegraph.com/studio/).
14+
2. Use GraphQL to query existing subgraphs.
15+
16+
### What is GraphQL?
17+
18+
- [GraphQL](https://graphql.org/learn/) is the query language for APIs and a runtime for executing those queries with your existing data. The Graph uses GraphQL to query subgraphs.
19+
20+
### Developer Actions
21+
22+
- Query subgraphs built by other developers in [The Graph Network](https://thegraph.com/explorer) and integrate them into your own dapps.
23+
- Create custom subgraphs to fulfill specific data needs, allowing improved scalability and flexibility for other developers.
24+
- Deploy, publish and signal your subgraphs within The Graph Network.
25+
26+
## Subgraph Specifics
27+
28+
### What are subgraphs?
29+
30+
A subgraph is a custom API built on blockchain data. It extracts data from a blockchain, processes it, and stores it so that it can be easily queried via GraphQL.
31+
32+
A subgraph primarily consists of the following files:
33+
34+
- `subgraph.yaml`: this YAML file contains the [subgraph manifest](/developing/creating-a-subgraph/#the-subgraph-manifest).
35+
- `subgraph.graphql`: this GraphQL schema defines what data is stored for your subgraph, and how to query it via [GraphQL](/developing/creating-a-subgraph/#the-graphql-schema).
36+
- `mappings`: this [AssemblyScript](https://github.com/AssemblyScript/assemblyscript) mappings file translates data from the event data to the entities defined in your schema.
37+
38+
Learn the detailed specifics to [create a subgraph](/developing/creating-a-subgraph/).
639

740
## Subgraph Lifecycle
841

9-
Subgraphs deployed to the network have a defined lifecycle.
42+
Here is a general overview of a subgraph’s lifecycle:
1043

11-
### Build locally
44+
![Subgraph Lifecycle](/img/subgraph-lifecycle.png)
1245

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.
46+
### Build locally
1447

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.
48+
Great subgraphs start with a local development environment and unit tests. Developers use [Graph CLI](https://github.com/graphprotocol/graph-tooling/tree/main/packages/cli), a command-line interface tool for building and deploying subgraphs on The Graph. They can also use [Graph TypeScript](/developing/graph-ts/) and [Matchstick](/developing/unit-testing-framework/) to create robust subgraphs.
1649

1750
### Deploy to Subgraph Studio
1851

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.
20-
21-
### Publish to the Network
52+
Once defined, a subgraph can be [deployed to Subgraph Studio](/deploying/deploying-a-subgraph-to-studio/). In Subgraph Studio, you can do the following:
2253

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.
54+
- Use its staging environment to index the deployed subgraph and make it available for review.
55+
- Verify that your subgraph doesn't have any indexing errors and works as expected.
2456

25-
### Signal to Encourage Indexing
57+
### Publish to the Network
2658

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.
59+
When you're happy with your subgraph, you can [publish it](/publishing/publishing-a-subgraph/) to The Graph Network.
2860

29-
### Querying & Application Development
61+
- This is an on-chain action, which registers the subgraph and makes it discoverable by Indexers.
62+
- Published subgraphs have a corresponding NFT, which defines the ownership of the subgraph. You can [transfer the subgraph's ownership](/managing/transfer-and-deprecate-a-subgraph/) by sending the NFT.
63+
- Published subgraphs have associated metadata, which provides other network participants with useful context and information.
3064

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.
65+
### Add Curation Signal for Indexing
3266

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.
67+
Published subgraphs are unlikely to be picked up by Indexers without curation signal. To encourage indexing you should add signal to your subgraph. Learn more about signaling and [curating](/network/curating/) on The Graph.
3468

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.
69+
#### What is signal?
3670

37-
### Updating Subgraphs
71+
- 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.
72+
- Third party Curators may also signal on a given subgraph, if they deem the subgraph likely to drive query volume.
3873

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.
74+
### Querying & Application Development
4075

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.
76+
Subgraphs on The Graph Network receive 100,000 free queries per month, after which point developers can either [pay for queries with GRT or a credit card](/billing/).
4277

43-
### Deprecating Subgraphs
78+
Learn more about [querying subgraphs](/querying/querying-the-graph/).
4479

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.
80+
### Updating Subgraphs
4681

47-
### Diverse Developer Roles
82+
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.
4883

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.
84+
- 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.
85+
- This signal migration should prompt Indexers to start indexing the new version of the subgraph, so it should soon become available for querying.
5086

51-
### Developers and Network Economics
87+
### Deprecating & Transferring Subgraphs
5288

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.
89+
If you no longer need a published subgraph, you can [deprecate or transfer a subgraph](managing/transfer-and-deprecate-a-subgraph/). Deprecating a subgraph returns any signaled GRT to [Curators](/network/curating/). To deprecate or transfer a subgraph, check out [this guide](/managing/transfer-and-deprecate-a-subgraph/#deprecating-a-subgraph).

0 commit comments

Comments
 (0)