Indexing a SubQuery Project

SubQuery TeamAbout 4 min

Indexing a SubQuery Project

Introduction

If you are willing to become a SubQuery Indexer, you need to stake a minimum of 1000 SQT.

Note:

1. Initial Set-Up

1.1 The Indexer Admin Page

Depending on where the application has been installed, you may find the Indexer admin page at:

  • http://localhost:8000/
  • http://your-ec2-public-path:8000/ (for example ec2-14-273-116-26.ap-southeast-2.compute.amazonaws.com:8000)
  • http://some-public-ip-address:8000

Stake-SQT

1.2 Request Approval

Click Get Started and then select Approve. Then MetaMask will pop up, asking you to sign this transaction.

Request Approval

Confirm Appoval

1.3 Register Indexer

Fill in the details to register your Indexer and confirm the MetaMask transaction.

Register MetMask-Confirm Transaction

1.4 Synchronise Your Indexer

Next, click on Sync to synchronise this account with your coordinator service. This may take a few minutes. If you still don’t get any results after 5 minutes, try refreshing the page.

Synchronise Indexer with Coordinator

1.5 Indexer and Controller Accounts

Now, two accounts will appear on the screen. The Indexer Account where you can update the metadata (Indexer name and proxy server endpoint) and the Controller Account.

Indexer and Controller Accounts

1.6 Add a Controller Account

The Controller is a separate account that needs to be created and it holds a small amount of DEV tokens to update configurations.

Updating a configuration is a signable event. That means, it is an on-chain update that requires transaction fees to be paid (in DEV).

Click Managed Controllers and then select Create an Account. This adds an account where you will need to fund with some tokens. Then set the account to Active.

Add Controller

Activating a controller is an on-chain signable event.

Activate Controller

Once the controller account is added, it should appear as follows:

Activate Controller

1.7 Update Indexer Metadata (Optional)

The Indexer can update metadata which includes:

  • Indexer name.
  • Proxy server endpoint.

Update Indexer's Metadata

You have now completed the initial set-up. Next, let’s work on adding a project.

2. Add a Project

Once the Controller Account has been added, a new Projects tab appears at the top of the page. This will allow Indexers to add projects of their choice to index.

Before clicking Add Project, click on the SubQuery Explorer hyperlink. This will take to you a list of SubQuery projects where you will obtain the project’s Deployment ID first.

Add Project Screen

Select a project of your choice to index and copy the deployment ID.

Select a Project

Then return to the project page and add the project.

Add a New Project Using Deploy ID

After finishing the process of adding your project, move forward with indexing the project.

3. Index a Project

Select the project card to open the project details page.

Project Details Page

For a brand new project, the indexing status will be NOT INDEXING. Select the Start Indexing button to begin indexing the project.

Enter the following values for each project and select specific image versions if needed:

  • Staking Threshold - Polkadot

    • Indexing Endpoint: wss://polkadot.api.onfinality.io/public-ws
    • Dictionary Endpoint: https://api.subquery.network/sq/subquery/polkadot-dictionary
  • Developer Fund Votes - Juno

    • Dictionary Endpoint: https://api.subquery.network/sq/subquery/cosmos-juno-dictionary
  • [Pangolin Approvals - Avalanche]

    • Indexing Endpoint: http://avalanche.api.onfinality.io:9650
    • Dictionary Endpoint: https://api.subquery.network/sq/subquery/avalanche-dictionary

Please make sure that you set “Enable POI” to true. Then press Confirm to trigger the request to start the node and query service for this project in the coordinator service.

Restart Indexing Project Screen

Once the services are started, the service information will be displayed.

Indexing Service Information Screen

The Indexer can then check the service log to see the indexing details:

Indexer Service Log

You have successfully completed the indexing process. Next comes the Announcements section. Let’s dig out further.

4. Announcements

4.1 Announcing a Project to the Network

To announce a project to the network, select the Announce Indexing button and send a transaction.

Announce a Project to Network

After the transaction is processed, the project's status will change to INDEXING. Now, the Indexer can:

  • Publish the project to READY on the network via Announce Ready.
  • Stop indexing the project.
  • Restart indexing the project with a new network endpoint.

Indexing Status

4.2 Announcing that Indexing Service is Ready to Use

Once the Indexer announces that they have started indexing the project on the network, and when the indexing progress reaches the minimum block height, the indexer can publish the project to the ready status. It indicates that other users can now access the indexing service.

Indexing Service Ready to Use Announcement

Indexer Ready Screen

4.3 Stop Indexing the Project

When you stop indexing the project, the node and query service will be terminated on the coordinator service side. In addition, the status of the indexing service will need to be changed back to NOT INDEXING.

After the status changes to TERMINATED, remove the project directly.

Stop Indexing the Project

The proxy services status will change to TERMINATED after triggering the stop indexing function.

Once the services are terminated, the Indexer also needs to send a transaction to change the status to NOT INDEXING on the network.

Not Indexing the Project Announcement_Transaction

Project Status_Not Indexing

Note: You can start re-indexing the project at any time after stopping the project.

4.4 Restarting a Project

Restart the project if you want to change the network endpoint, network dictionary, or image versions.

Restart a Project

4.5 Removing a Project

You can remove the project from the service if a project is not required anymore.

Remove a Project

5. Indexer Network Information

On the network page, the Indexer can check the era information and confirm that the reward collection is up to date. The service log component provides the logs for the coordinator service.

Indexer Network Information

Congratulations! You have successfully indexed your SubQuery Project.

  • If you encounter any trouble while running the indexing service, please visit Troubleshooting) and get all your solutions at one place.

  • Find the list of FAQs, and resolve your query.