TheGraph
- installation guide
TheGraph-Indexer-Setup
A guide to installing from scratch, how to install an indexer on the main network
Pre-requisites
- Dedicated server (16 Core, RAM 128Gb, 2Tb nvme)
- Domain like https://web3validator.info/
- 100,000 GRT for indexing
- A 12-word mnemonic phrase in order for it to work
1)Server
Server must be with minimum 12-core proccessor and 64gb RAM , good example is AX101 in hetzner you can check the step-by-step guide here
2)Domain
Domain you can buy on imena.ua and step-by-step guide here
After you bought a domain, you need to make dns records indicating the ip address of your server , it looks like this:
3) 100,000 GRT for indexing
100,000 GRT need for create indexer , you can buy it through the CEX like Binance, Coinbase or Kucoin and in DEX like Uniswap, Sushiswap and etc.
4) A 12-word mnemonic phrase
You need a wallet with a seed phrase that is registered as your operator wallet. This wallet will be the one that makes transactions on behalf of your main wallet (which holds and stakes the GRT).
The operator wallet has limited functionality, and it's recommended to be used for security reasons.
You need a 12-word, or 15-word mnemonic phrase in order for it to work.
To make yourself a mnemonic eth wallet you can go to this website, select ETH from the dropdown and press generate.
You get a seed phrase in the input field labeled BIP39 Mnemonic.
You can find your address, public key and private key in the first row of the table if you scroll down the page in the section with the heading "Derived Addresses".
Make sure you save the mnemonic, private key and the wallet address somewhere safe.
If you need, you can import the wallet using the private key into Metamask
Install from scratch
Stake on the Network
In order to become an indexer on the Graph Protocol Network, you'll have to stake a minimum of 100,000 GRT.
This can easily be done via the Web UI, by going to the Graph Explorer.
-
Login with Metamask on the Wallet that holds your GRT
-
Go to your Profile, then switch to the "Indexing" Tab and hit "Stake"
- Stake the amount of GRT that you desire, then you're all done!
Set your Operator
The Operator is a wallet address that is entirely separate from the address which you staked your GRT from. This Operator wallet will be filled with ETH, and will be used to send transactions (such as allocations) to the network, while keeping your Staked GRT safe in case of an attack on your infrastructure. It is highly recommended for you to use a new wallet, generated from a new mnemonic phrase.
For this, follow the instructions here first, then head back for the rest.
Okay, assuming that you followed the instructions and you have your new Operator wallet at hand, lets go and link it up with the wallet that you used to stake your GRT.
Login with Metamask on the wallet that you used to stake your GRT 4. Click the Profile dropdown button 5. Go to "Settings", and then to the "Operators" tab
- Click the Plus (+) button and add your operator public address there
- Submit the transaction, then you're done
Getting started
Run the following commands to clone the GraphProtocol's repository
Then you need to edit the file called .env and add your values to the following envs:
It should looks like :
**Required env vars:**Note: If you want to use any of the optional env vars, you need to copy the line that you want to enable above the last line, and uncomment it.
Start
Start by picking up the right stack that you want to spin up.
There are several start files used to spin up different components.
I would recommend to start with:
Be aware that initially it takes several minutes to download and run all the containers (especially the cli container, that one takes a while to build), so be patient. :)
Subsequent restarts will be much faster.
In case something goes wrong, find the problem, edit the variables, and add --force-recreate
at the end of the command, plus the container you want to recreate:
Or to recreate the entire stack:
Start file variants:
start-essential - starts up the graphnode, indexer and monitoring stack - all you need to get up and running on the network
start-optional - starts up the optional stack (for components, read above)
start-autoagora - starts up the autoagora stack (for components, read above)
start-all - starts up the entire stack
Verify that it runs properly
To verify that everything is up and running, you need to:
And look for containers that are crash looping - you will notice restarting
and a countdown - that means those containers are not working properly.
To further debug, try looking for the container logs and see what they say. More information in the troubleshooting section.
Indexer Infrastructure Ports
Ports Overview
The following ports are being used by all components by default. Also listed are the CLI flags and environment variables that can be used to change the ports.
Graphical Overview
Graph Node
| Port | Purpose | Routes | CLI argument | Environment variable |
| ---- | ------------------------------------------ | -------------------------------------------------- | ------------------- | -------------------- |
| 8000 | GraphQL HTTP server (for subgraph queries) | /subgraphs/id/...
subgraphs/name/.../...
| --http-port
| - |
| 8001 | GraphQL WS (for subgraph subscriptions) | /subgraphs/id/...
subgraphs/name/.../...
| --ws-port
| - |
| 8020 | JSON-RPC (for managing deployments) | /
| --admin-port
| - |
| 8030 | Subgraph indexing status API | /graphql
| --index-node-port
| - |
| 8040 | Prometheus metrics | /metrics
| --metrics-port
| - |
Indexer Service
| Port | Purpose | Routes | CLI argument | Environment variable |
| ---- | ----------------------------------------------- | ------------------------------------------------------------------- | ------------ | ---------------------- |
| 7600 | GraphQL HTTP server (for paid subgraph queries) | /subgraphs/id/...
/status
| --port
| INDEXER_SERVICE_PORT
|
| 7300 | Prometheus metrics | /metrics
| - | - |
Indexer Agent
| Port | Purpose | Routes | CLI argument | Environment variable |
| ---- | -------------------------------------------- | ------ | --------------------------- | --------------------------------------- |
| 8000 | Indexer management API (for graph indexer
) | /
| --indexer-management-port
| INDEXER_AGENT_INDEXER_MANAGEMENT_PORT
|