Skip to content

Commit 4115587

Browse files
Quickstart edits (#926)
* Rewrite * edits * Fix error
1 parent b7db187 commit 4115587

File tree

1 file changed

+27
-67
lines changed

1 file changed

+27
-67
lines changed

website/src/pages/en/subgraphs/quick-start.mdx

Lines changed: 27 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@
22
title: Quick Start
33
---
44

5-
Learn how to easily build, publish and query a [Subgraph](/subgraphs/developing/developer-faq/#1-what-is-a-subgraph) on The Graph.
5+
Create, deploy, and query a [Subgraph](/subgraphs/developing/developer-faq/#1-what-is-a-subgraph) on The Graph Network.
6+
7+
By the end, you'll have:
8+
9+
- Initialized a Subgraph from a smart contract
10+
- Deployed it to Subgraph Studio for testing
11+
- Published to The Graph Network for decentralized indexing
612

713
## Prerequisites
814

915
- A crypto wallet
10-
- A smart contract address on a [supported network](/supported-networks/)
11-
- [Node.js](https://nodejs.org/) installed
12-
- A package manager of your choice (`npm`, `yarn` or `pnpm`)
16+
- A deployed smart contract on a [supported network](/supported-networks/)
17+
- [Node.js](https://nodejs.org/) & a package manager of your choice (`npm`, `yarn` or `pnpm`)
1318

1419
## How to Build a Subgraph
1520

1621
### 1. Create a Subgraph in Subgraph Studio
1722

18-
Go to [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet.
19-
20-
Subgraph Studio lets you create, manage, deploy, and publish Subgraphs, as well as create and manage API keys.
21-
22-
Click "Create a Subgraph". It is recommended to name the Subgraph in Title Case: "Subgraph Name Chain Name".
23+
1. Go to [Subgraph Studio](https://thegraph.com/studio/)
24+
2. Connect your wallet
25+
3. Click "Create a Subgraph"
26+
4. Name it in Title Case: "Subgraph Name Chain Name"
2327

2428
### 2. Install the Graph CLI
2529

@@ -37,20 +41,22 @@ Using [yarn](https://yarnpkg.com/):
3741
yarn global add @graphprotocol/graph-cli
3842
```
3943

40-
### 3. Initialize your Subgraph
44+
Verify install:
4145

42-
> You can find commands for your specific Subgraph on the Subgraph page in [Subgraph Studio](https://thegraph.com/studio/).
46+
```sh
47+
graph --version
48+
```
49+
50+
### 3. Initialize your Subgraph
4351

44-
The `graph init` command will automatically create a scaffold of a Subgraph based on your contract's events.
52+
> You can find commands for your specific Subgraph in [Subgraph Studio](https://thegraph.com/studio/).
4553
46-
The following command initializes your Subgraph from an existing contract:
54+
The following command initializes your Subgraph from an existing contract and indexes events:
4755

4856
```sh
4957
graph init
5058
```
5159

52-
If your contract is verified on the respective blockscanner where it is deployed (such as [Etherscan](https://etherscan.io/)), then the ABI will automatically be created in the CLI.
53-
5460
When you initialize your Subgraph, the CLI will ask you for the following information:
5561

5662
- **Protocol**: Choose the protocol your Subgraph will be indexing data from.
@@ -59,19 +65,17 @@ When you initialize your Subgraph, the CLI will ask you for the following inform
5965
- **Ethereum network** (optional): You may need to specify which EVM-compatible network your Subgraph will be indexing data from.
6066
- **Contract address**: Locate the smart contract address you’d like to query data from.
6167
- **ABI**: If the ABI is not auto-populated, you will need to input it manually as a JSON file.
62-
- **Start Block**: You should input the start block to optimize Subgraph indexing of blockchain data. Locate the start block by finding the block where your contract was deployed.
68+
- **Start Block**: You should input the start block where the contract was deployed to optimize Subgraph indexing of blockchain data.
6369
- **Contract Name**: Input the name of your contract.
6470
- **Index contract events as entities**: It is suggested that you set this to true, as it will automatically add mappings to your Subgraph for every emitted event.
6571
- **Add another contract** (optional): You can add another contract.
6672

67-
See the following screenshot for an example for what to expect when initializing your Subgraph:
73+
See the following screenshot for an example of what to expect when initializing your Subgraph:
6874

6975
![Subgraph command](/img/CLI-Example.png)
7076

7177
### 4. Edit your Subgraph
7278

73-
The `init` command in the previous step creates a scaffold Subgraph that you can use as a starting point to build your Subgraph.
74-
7579
When making changes to the Subgraph, you will mainly work with three files:
7680

7781
- Manifest (`subgraph.yaml`) - defines what data sources your Subgraph will index.
@@ -82,9 +86,7 @@ For a detailed breakdown on how to write your Subgraph, check out [Creating a Su
8286

8387
### 5. Deploy your Subgraph
8488

85-
> Remember, deploying is not the same as publishing.
86-
87-
When you **deploy** a Subgraph, you push it to [Subgraph Studio](https://thegraph.com/studio/), where you can test, stage and review it. A deployed Subgraph's indexing is performed by the [Upgrade Indexer](https://thegraph.com/blog/upgrade-indexer/), which is a single Indexer owned and operated by Edge & Node, rather than by the many decentralized Indexers in The Graph Network. A **deployed** Subgraph is free to use, rate-limited, not visible to the public, and meant to be used for development, staging, and testing purposes.
89+
When you **deploy** a Subgraph, you push it to [Subgraph Studio](https://thegraph.com/studio/), where you can test, stage and review it. A deployed Subgraph's indexing is performed by the [Upgrade Indexer](https://thegraph.com/blog/upgrade-indexer/), which is a single Indexer owned and operated by Edge & Node. A **deployed** Subgraph is free to use, rate-limited, not visible to the public, and meant to be used for development, staging, and testing purposes.
8890

8991
Once your Subgraph is written, run the following commands:
9092

@@ -103,8 +105,6 @@ Authenticate and deploy your Subgraph. The deploy key can be found on the Subgra
103105
graph deploy <SUBGRAPH_SLUG>
104106
```
105107

106-
The CLI will ask for a version label. It's strongly recommended to use [semantic versioning](https://semver.org/), e.g. `0.0.1`.
107-
108108
### 6. Review your Subgraph
109109

110110
If you’d like to test your Subgraph before publishing it, you can use [Subgraph Studio](https://thegraph.com/studio/) to do the following:
@@ -121,53 +121,13 @@ When your Subgraph is ready for a production environment, you can publish it to
121121

122122
- It makes your Subgraph available to be to indexed by the decentralized [Indexers](/indexing/overview/) on The Graph Network.
123123
- It removes rate limits and makes your Subgraph publicly searchable and queryable in [Graph Explorer](https://thegraph.com/explorer/).
124-
- It makes your Subgraph available for [Curators](/resources/roles/curating/) to curate it.
125-
126-
> The greater the amount of GRT you and others curate on your Subgraph, the more Indexers will be incentivized to index your Subgraph, improving the quality of service, reducing latency, and enhancing network redundancy for your Subgraph.
124+
- It makes your Subgraph available for [Curators](/resources/roles/curating/) to add curation signal.
127125

128-
#### Publishing with Subgraph Studio
129-
130-
To publish your Subgraph, click the Publish button in the dashboard.
126+
To publish your Subgraph, click the Publish button in the dashboard and select your network.
131127

132128
![Publish a Subgraph on Subgraph Studio](/img/publish-sub-transfer.png)
133129

134-
Select the network to which you would like to publish your Subgraph.
135-
136-
#### Publishing from the CLI
137-
138-
As of version 0.73.0, you can also publish your Subgraph with the Graph CLI.
139-
140-
Open the `graph-cli`.
141-
142-
Use the following commands:
143-
144-
```sh
145-
graph codegen && graph build
146-
```
147-
148-
Then,
149-
150-
```sh
151-
graph publish
152-
```
153-
154-
3. A window will open, allowing you to connect your wallet, add metadata, and deploy your finalized Subgraph to a network of your choice.
155-
156-
![cli-ui](/img/cli-ui.png)
157-
158-
To customize your deployment, see [Publishing a Subgraph](/subgraphs/developing/publishing/publishing-a-subgraph/).
159-
160-
#### Adding signal to your Subgraph
161-
162-
1. To attract Indexers to query your Subgraph, you should add GRT curation signal to it.
163-
164-
- This action improves quality of service, reduces latency, and enhances network redundancy and availability for your Subgraph.
165-
166-
2. If eligible for indexing rewards, Indexers receive GRT rewards based on the signaled amount.
167-
168-
- It’s recommended to curate at least 3,000 GRT to attract 3 Indexers. Check reward eligibility based on Subgraph feature usage and supported networks.
169-
170-
To learn more about curation, read [Curating](/resources/roles/curating/).
130+
> It is recommended that you curate your own Subgraph with at least 3,000 GRT to incentivize indexing.
171131
172132
To save on gas costs, you can curate your Subgraph in the same transaction you publish it by selecting this option:
173133

0 commit comments

Comments
 (0)