Avalanche Quick Start

SubQuery Team약 6 분

Avalanche Quick Start

In this Quick start guide, we're going to start with a simple Avalanche starter project and then finish by indexing some actual real data. This is an excellent basis to start with when developing your own SubQuery Project.

If your are looking for guides for Substrate/Polkadot, you can read the Substrate/Polkadot specific quick start guide.

이 가이드가 끝나면, 데이터를 쿼리할 수 있는 GraphQL 끝점이 있는 SubQuery 노드에서 실행 중인 SubQuery 프로젝트를 만들 수 있습니다.

아직 익숙하지 않은 경우, 우리는 귀하가 SubQuery에서 사용되는 용어에 익숙해지기를 권장합니다.

The goal of this quick start guide is to index all Pangolin token Approve logs, it should only take 10-15 minutes

준비

Local 개발 환경

SubQuery CLI 설치

Install SubQuery CLI globally on your terminal by using NPM:

# NPM
npm install -g @subql/cli

Please note that we DO NOT encourage the use of yarn global for installing @subql/cli due to its poor dependency management which may lead to an errors down the line.

You can then run help to see available commands and usage provide by CLI

subql help

Initialise the SubQuery Starter Project

Inside the directory in which you want to create a SubQuery project, simply run the following command to get started.

subql 초기화

You'll be asked certain questions as the SubQuery project is initalised:

  • Project Name: A name for your SubQuery project
  • Network Family: The layer-1 blockchain network family that this SubQuery project will be developed to index, use the arrow keys on your keyboard to select from the options, for this guide we will use "Avalanche"
  • Network: The specific network that this SubQuery project will be developed to index, use the arrow keys on your keyboard to select from the options, for this guide we will use "Avalanche"
  • Template: Select a SubQuery project template that will provide a starting point to begin development, we suggest selecting the "Starter project"
  • Git repository (Optional): Provide a Git URL to a repo that this SubQuery project will be hosted in (when hosted in SubQuery Explorer)
  • RPC endpoint (Required): Provide a HTTPS URL to a running RPC endpoint that will be used by default for this project. This RPC node must be an archive node (have the full chain state). For this guide we will use the default value "avalanche.api.onfinality.io"
  • Authors (Required): Enter the owner of this SubQuery project here (e.g. your name!)
  • Description (Optional): You can provide a short paragraph about your project that describe what data it contains and what users can do with it
  • Version (Required): Enter a custom version number or use the default (1.0.0)
  • License (Required): Provide the software license for this project or accept the default (Apache-2.0)

After the initialisation process is complete, you should see a folder with your project name has been created inside the directory. The contents of this directoy should be identical to what's listed in the Directory Structure.

Last, under the project directory, run following command to install the new project's dependencies.

::: code-tabs @tab:active yarn shell cd PROJECT_NAME yarn install