Skip to content

Commit

Permalink
add doc for connect rpc node (#514)
Browse files Browse the repository at this point in the history
* add doc for connect rpc node

* RPC guide review

---------

Co-authored-by: James Bayly <james@bayly.xyz>
  • Loading branch information
ianhe8x and jamesbayly authored May 8, 2024
1 parent 642113b commit 2528b1e
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 117 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/.vuepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,11 @@ export const getSidebar = (locale: string) =>
{
text: "RPC Providers",
link: `${locale}/subquery_network/node_operators/rpc_providers/introduction.md`,
collapsible: true,
children: [
`${locale}/subquery_network/node_operators/rpc_providers/introduction.md`,
`${locale}/subquery_network/node_operators/rpc_providers/connect-node.md`,
],
},
`${locale}/subquery_network/node_operators/stake.md`,
`${locale}/subquery_network/node_operators/plans.md`,
Expand Down
126 changes: 36 additions & 90 deletions docs/subquery_network/node_operators/indexers/index-project.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,77 @@
# Indexing a SubQuery Project

## Introduction
Node Operators can run either data indexing projects or RPC endpoints for the network (or both). If you instead want to connect an RPC endpoint, please follow the instructions [here](../rpc_providers/connect-node.md).

To become a SubQuery Indexer, you need to stake a minimum of 200,000 SQT.
## 1. Select and Add a Project

## 1. Initial Set-Up
Inside your Node Operator Admin App (usually this is `http://localhost:8000/` depending on your installation), the Projects tab appears at the top of the page. This enables Node Operators to add projects of their choice to their Node Operator profile.

### 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

### 1.2 Request Approval

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

### 1.3 Register Indexer

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

![Register MetMask-Confirm Transaction](/assets/img/network/indexer_registration.png)

### 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](/assets/img/network/indexer_sync_coordinator.png)

### 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](/assets/img/network/indexer_controller_account.png)

### 1.6 Add a Controller Account

The Controller, a distinct and seperate account that must be created, holds a small amount of Eth tokens to facilitate Indexer configuration updates and run day to day operations.

Updating a Indexer configuration is a sign-able event. That means it is an on-chain update that requires transaction fees to be paid (in Eth).

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

![Add Controller](/assets/img/network/indexer_controller_add.png)

Activating a controller is an on-chain sign-able event.

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

![Activate Controller](/assets/img/network/indexer_controller_account_added.png)

### 1.7 Update Indexer Metadata (Optional)

The Indexer can update metadata which includes:

- Indexer name.
- Proxy server endpoint.

![Update Indexer's Metadata](/assets/img/network/indexer_metadata_update.png)

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 enables Indexers to add projects of their choice for indexing.

Before clicking **`Add Project`,** you will need to obtain the project's deployment ID. If the project has already been deployed and indexed by other indexers, you may be able to find it listed in the SubQuery Explorer as the obtain the project’s Deployment ID.
Before clicking **`Add Project`,** you will need to obtain the project's deployment ID. If the project has already been deployed and indexed by other Node Operators, you will be able to obtain the project’s Deployment ID from the [SubQuery Explorer](https://app.subquery.network/explorer/home).

Enter the project deployment ID when adding the new project.

![Add a New Project Using Deploy ID](/assets/img/network/indexer_project_add.png)

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

## 3. Index a Project
## 2. Index a Project

Select the project card to open the 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.

You will need to provide an indexing endpoint, this endpoint must be a non-pruned archive node. Public nodes may be rate limited, which can affect indexing speed. **When indexing your project we suggest getting a private API key to avoid being rate limited.**

Public RPC Endpoints may be rate limited which can affect indexing speed, when indexing your project we suggest getting a private API key. You can retrieve endpoints for some networks for free from [OnFinality](https://www.onfinality.io/networks).
Public RPC Endpoints may be rate limited which can affect indexing speed, when indexing your project we suggest getting a private API key. You can retrieve endpoints for some networks for free from SubQuery Network itself.

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

Once the services are started, the service information will be displayed. The Indexer can then check the service log to see the indexing details:
Once the services are started, the service information will be displayed. The Node Operator can then check the service log to see the indexing details:

![Indexer Service Log](/assets/img/network/indexer_service_logs.png)
![Node Operator Service Log](/assets/img/network/indexer_service_logs.png)

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

## 4. Announcements
## 3. Announcements

### 4.1 Announcing a Project to the Network
### 3.1 Announcing a Project to the Network

To announce a project to the network, select the `Announce Indexing` button and send a transaction.
Once the project has started indexing, you can announce your project deployment to the network so the network knows that you are in the proccess of indexing the project.

Select the `Announce Indexing` button and send a transaction.

![Announce a Project to Network](/assets/img/network/indexer_project_announce.png)

After the transaction is processed, the project's status will change to `INDEXING`. Now, the Indexer can:
After the transaction is processed, the project's status will change to `INDEXING`. Now, you 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](/assets/img/network/indexer_project_indexing.png)

### 4.2 Announcing that Indexing Service is Ready to Use
### 3.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. This indicates that other users can now access the indexing service.
Once a Node Operator announces that they have started indexing the project on the network, and when the indexing progress reaches the minimum required block height (or catches up with the latest height), the Node Operator can publish the project to the `ready` status. This indicates that the network can now start to distribute requests to the Node Operator's project deployment.

![Indexing Service Ready to Use Announcement](/assets/img/network/indexer_project_ready.png)

### 4.3 **Stop Indexing the Project**
## 4 Allocate SQT to the Project and Monitor

To earn Network Allocation Rewards for your project, you should immediately allocate SQT to your new project. [Please follow the guide here](../stake.md#allocating-stake).

On the Network app, the Node Operator 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.

Monitor your eligibility for rewards from the Admin Portal, if your node is out of sync or not reachable, you may not receive rewards.

Congratulations! You have successfully indexed your SubQuery Project.

- If you encounter any trouble while running the Node Operator service, please visit [Troubleshooting](../setup/troubleshooting.md)) and find all your solutions in one place.
- Find the list of [FAQs](../setup/faq.md), and resolve your query.

## 5. Other Actions

### 5.1 Stop Indexing the Project

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

Expand All @@ -125,30 +81,20 @@ After the status changes to `TERMINATED`, remove the project directly.

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.
Once the services are terminated, the Node Operator also needs to send a transaction to change the status to `NOT INDEXING` on the network.

![Not Indexing the Project Announcement_Transaction](/assets/img/network/indexer_project_stop_indexing.png)

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

### 4.4 Restarting a Project
### 5.2 Restarting a Project

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

![Restart a Project](/assets/img/network/indexer_project_restart.png)

### 4.5 **Removing a Project**
### 5.3 Removing a Project

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

![Remove a Project](/assets/img/network/indexer_project_remove.png)

## 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.

Congratulations! You have successfully indexed your SubQuery Project.

- If you encounter any trouble while running the indexing service, please visit [Troubleshooting](../setup/troubleshooting.md)) and find all your solutions in one place.

- Find the list of [FAQs](../setup/faq.md), and resolve your query.
52 changes: 52 additions & 0 deletions docs/subquery_network/node_operators/rpc_providers/connect-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Connect your an RPC Endpoint

Node Operators can run either data indexing projects or RPC endpoints for the network (or both). If you instead want to sync a data indexing project, please follow the instructions [here](../indexers/index-project.md).

:::info Connect any RPC
The SubQuery Network does not control how your run the underlying RPC endpoint to the Network, only that you connect and announce a standard EVM endpoint that is able to consume public queries.

This means you can run existing RPC endpoint used for other purposes (includng other decentralised RPC networks) to the SubQuery Network.
:::

## Prerequisites

This guide assumes you are already a running an RPC node that is publicly available on a known IP address/port.

For example with Etheruem, it can any client (geth or erigon etc), and it is listening on a known address and port (in the examples below our node is listening on `192.168.1.100:8545`).

Please consult the relevant guides for how to run an RPC node on each network, for example this is the guide for [Geth on Ethereum](https://geth.ethereum.org/docs/getting-started), and [Base](https://docs.base.org/tutorials/run-a-base-node/).

## 1. Add Project

Inside your Node Operator Admin App (usually this is `http://localhost:8000/` depending on your installation), the Projects tab appears at the top of the page. This enables Node Operators to add projects of their choice to their Node Operator profile.

Before clicking **`Add Project`,** you will need to obtain the project's deployment ID. If the project has already been deployed and synced by other Node Operators, you will be able to obtain the project’s Deployment ID from the [SubQuery Explorer](https://app.subquery.network/explorer/home).

Enter the project deployment ID when adding the new project, in our case, it is `QmNa36oZ4zRS1i2wQhiFznU5DjEuNP3wopV6U3VcUWMUKu`.

![Add a rpc project](/assets/img/network/rpc_project_add.png)

## 2. Connect your local RPC node

Input the public endpoint of your local node, then backend will run some verification on the endpoint to check whether it matches the manifest of the project, e.g chainId, node type, localness.

Be aware that coordinator service runs in docker, so localhost doesn't work like it runs outside of docker. You should use the internal ip address to connect to the node, or `host.docker.internal` which points to the host localhost.

![Connect local node](/assets/img/network/rpc_connect_node.png)

## 3. Go Online

Click `Go Online`, which will then trigger your wallet to sign a transaction, then your RPC is announced online and is available to query.

## 4. Allocate SQT to the Project and Monitor

To earn Network Allocation Rewards for your project, you should immediately allocate SQT to your new project. [Please follow the guide here](../stake.md#allocating-stake).

On the Network app, the Node Operator 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.

Monitor your eligibility for rewards from the Admin Portal, if your node is out of sync or not reachable, you may not receive rewards.

Congratulations! You have successfully synced your SubQuery RPC Endpoint.

- If you encounter any trouble while running the the Node Operator service, please visit [Troubleshooting](../setup/troubleshooting.md)) and find all your solutions in one place.
- Find the list of [FAQs](../setup/faq.md), and resolve your query.
Loading

0 comments on commit 2528b1e

Please sign in to comment.