diff --git a/website/pages/en/quick-start.mdx b/website/pages/en/quick-start.mdx index 295de75c8a0f..cba2247457b8 100644 --- a/website/pages/en/quick-start.mdx +++ b/website/pages/en/quick-start.mdx @@ -8,26 +8,25 @@ Ensure that your subgraph will be indexing data from a [supported network](/deve This guide is written assuming that you have: -- A smart contract address on the network of your choice -- GRT to curate your subgraph - A crypto wallet +- A smart contract address on the network of your choice ## 1. Create a subgraph on Subgraph Studio Go to the [Subgraph Studio](https://thegraph.com/studio/) and connect your wallet. -Once connected, you can begin by clicking “Create a Subgraph”. +Once your wallet is connected, you can begin by clicking “Create a Subgraph." It is recommended to name the subgraph in Title Case: "Subgraph Name Chain Name." ## 2. Install the Graph CLI -The Graph CLI is written in JavaScript and you will need to have either `npm` or `yarn` installed to use it. +The Graph CLI is written in TypeScript and you will need to have `node` and either `npm` or `yarn` installed to use it. Check that you have the most recent CLI version installed. On your local machine, run one of the following commands: Using [npm](https://www.npmjs.com/): ```sh -npm install -g @graphprotocol/graph-cli +npm install -g @graphprotocol/graph-cli@latest ``` Using [yarn](https://yarnpkg.com/): @@ -36,7 +35,13 @@ Using [yarn](https://yarnpkg.com/): yarn global add @graphprotocol/graph-cli ``` -## 3. Initialize your Subgraph +## 3. Initialize your subgraph from existing contract + +Initialize your subgraph from an existing contract by running the initialize command: + +```sh +graph init --studio +``` > You can find commands for your specific subgraph on the subgraph page in [Subgraph Studio](https://thegraph.com/studio/). @@ -53,17 +58,11 @@ When you initialize your subgraph, the CLI tool will ask you for the following i - 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 - Add another contract(optional): you can add another contract -Initialize your subgraph from an existing contract by running the following command: - -```sh -graph init --studio -``` - See the following screenshot for an example for what to expect when initializing your subgraph: ![Subgraph command](/img/subgraph-init-example.png) -## 4. Write your Subgraph +## 4. Write your subgraph The previous commands create a scaffold subgraph that you can use as a starting point for building your subgraph. When making changes to the subgraph, you will mainly work with three files: @@ -93,7 +92,7 @@ You will be asked for a version label. It's strongly recommended to use [semver] ## 6. Test your subgraph -You can test your subgraph by making a sample query in the playground section. +In Subgraph Studio's playground environment, you can test your subgraph by making a sample query. The logs will tell you if there are any errors with your subgraph. The logs of an operational subgraph will look like this: @@ -143,15 +142,15 @@ If your subgraph is failing, you can query the subgraph health by using the Grap } ``` -## 7. Publish Your Subgraph to The Graph’s Decentralized Network +## 7. Publish your subgraph to The Graph’s Decentralized Network -Once your subgraph has been deployed to Subgraph Studio, you have tested it out, and are ready to put it into production, you can then publish it to the decentralized network. +Once your subgraph has been deployed to Subgraph Studio, you have tested it out, and you are ready to put it into production, you can then publish it to the decentralized network. -In Subgraph Studio, click on your subgraph. On the subgraph’s page, you will be able to click the publish button on the top right. +In Subgraph Studio, you will be able to click the publish button on the top right of your subgraph's page. Select the network you would like to publish your subgraph to. It is recommended to publish subgraphs to Arbitrum One to take advantage of the [faster transaction speeds and lower gas costs](/arbitrum/arbitrum-faq). -The (upgrade Indexer)[/sunrise/#about-the-upgrade-indexer] will begin serving queries on your subgraph regardless of subgraph curation, and will provide you with 100,000 free queries per month. +The (upgrade Indexer)[/sunrise/#about-the-upgrade-indexer] will begin serving queries on your subgraph regardless of subgraph curation, and it will provide you with 100,000 free queries per month. For a higher quality of service and stronger redundancy, you can curate your subgraph to attract more Indexers. At the time of writing, it is recommended that you curate your own subgraph with at least 3,000 GRT to ensure 3-5 additional Indexers begin serving queries on your subgraph. @@ -159,10 +158,10 @@ To save on gas costs, you can curate your subgraph in the same transaction that ![Subgraph publish](/img/publish-and-signal-tx.png) -## 8. Query your Subgraph +## 8. Query your subgraph Now, you can query your subgraph by sending GraphQL queries to your subgraph’s Query URL, which you can find by clicking on the query button. -You can query from your dapp if you don't have your API key via the free, rate-limited temporary query URL that can be used for development and staging. +If you don't have your API key, you can query via the free, rate-limited development query URL, which can be used for development and staging. For more information about querying data from your subgraph, read more [here](/querying/querying-the-graph/).