How to Run an Indexer ?

Operating system: 64-bit Linux (i.e. Ubuntu 20.04 LTS Server or Desktop)

Instance-type: m6a.8xlarge (32 VCPU and 128 GiB Memory)

Storage: 4000 GiB root volume

Security Ports to be Open :

IP version

Type

Protocol

Port range

Source

IPv4

Custom TCP

TCP

3000

0.0.0.0/0

IPv6

Custom TCP

TCP

8030

::/0

IPv4

HTTPS

TCP

443

0.0.0.0/0

IPv4

Custom TCP

TCP

7300

0.0.0.0/0

IPv4

Custom TCP

TCP

8030

0.0.0.0/0

IPv6

Custom TCP

TCP

7600

::/0

IPv6

HTTPS

TCP

443

::/0

IPv4

HTTP

TCP

80

0.0.0.0/0

IPv4

PostgreSQL

TCP

5432

0.0.0.0/0

IPv6

Custom TCP

TCP

8000

::/0

IPv4

Custom TCP

TCP

9090 - 9091

0.0.0.0/0

IPv4

Custom TCP

TCP

8040

0.0.0.0/0

IPv4

Custom TCP

TCP

8000 - 8002

0.0.0.0/0

IPv4

Custom TCP

TCP

8020

0.0.0.0/0

IPv6

SSH

TCP

22

::/0

IPv4

Custom TCP

TCP

8001

0.0.0.0/0

IPv4

SSH

TCP

22

0.0.0.0/0

IPv6

Custom TCP

TCP

7300

::/0

IPv4

Custom TCP

TCP

7600

0.0.0.0/0

IPv4

Custom TCP

TCP

8000

0.0.0.0/0

IPv6

HTTP

TCP

80

::/0

IPv6

Custom TCP

TCP

8040

::/0

Public IP : You need of public IP so need to Configure Network Load Balancer with two seperate target groups and with port no 443 and port no 80 . So From there get public IP.

Ethereum Mainnet Node Hardware Requirement

Operating system: 64-bit Linux (i.e. Ubuntu 20.04 LTS Server or Desktop)

Instance-type: m6a (32 VCPU and 128 GiB Memory)

Storage: 20 GiB root volume and 4000 GiB External EBS Volume

Security Ports to be Open :

Type

Protocol

Port range

Source

Description

IPv4

Custom TCP

TCP

30303

0.0.0.0/0

IPv4

Custom TCP

TCP

3500

0.0.0.0/0

IPv4

Custom UDP

UDP

30303

0.0.0.0/0

IPv4

Custom TCP

TCP

8545

0.0.0.0/0

IPv4

Custom TCP

TCP

13000

0.0.0.0/0

IPv4

SSH

TCP

22

0.0.0.0/0

IPv4

Custom TCP

TCP

9090

0.0.0.0/0

IPv4

Custom TCP

TCP

3000

0.0.0.0/0

IPv4

Custom UDP

UDP

12000

0.0.0.0/0

Graph Node setup from scratch:

Have a look on documentation flow:

Graph Protocol Testnet Docker Compose https://github.com/StakeSquid/graphprotocol-testnet-docker/blob/master/README.md#graph-protocol-testnet-docker-compose

Install a metamask wallet extension

  • Connect your wallet to eth Mainnet network (network might change later)

  • Now get 100k GRTs

  • Now go to etherscan and get the GRT token address and import that in your metamask wallet.

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.

  1. Login with Metamask on the Wallet that holds your GRT

  2. Go to your Profile, then switch to the "Indexing" Tab and hit "Stake"

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

  1. Login with Metamask on the wallet that you used to stake your GRT

  2. Click the Profile dropdown button, and go to "Settings", and then to the "Operators" tab

  3. Click the Plus (+) button and add your operator public address there

  4. Submit the transaction, then you're done

Optional Software

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

# restart or open a new shell/terminal

nvm install node

# restart or open a new shell/terminal

npm install -g pino-pretty

Install from scratch

Run the following commands to clone the repository and set everything up:

git clone git@github.com:StakeSquid/graphprotocol-mainnet-docker.git
cd graphprotocol-mainnet-docker
git submodule init
git submodule update
git config --global user.email "you@example.com"
git config --global user.name "Example User"
git branch --set-upstream-to=origin

Get Domain

index.sld.tld
grafana.sld.tld
prometheus.sld.tld
query.sld.tld

Create a mnemonic

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

Warning

You have to be very attentive when youโ€™re creating a mnemonic phrase

From the mentioned website if it pop-ups with a INVALID-ROOT when you select ETH then youโ€™ve to do it again and get a phrase with a VALID-ROOT.

Configure Environment Variable

Edit the file called start and add your values to the following env:

EMAIL=email@domain.com \
INDEX_HOST=index.sld.tld \
GRAFANA_HOST=grafana.sld.tld \
ADMIN_USER=your_user \
ADMIN_PASSWORD=your_password \
DB_USER=your_db_user \
DB_PASS=your_db_password \
GRAPH_NODE_DB_NAME=your_graphnode_db_name \
AGENT_DB_NAME=your_agent_db_name \
ETHEREUM_RPC_0="http://ip:port" \
ETHEREUM_RPC_1="http://ip:port" \
TXN_RPC="http://ip:port" \
OPERATOR_SEED_PHRASE="12 or 15 word mnemonic" \
STAKING_WALLET_ADDRESS=0xAdDreSs \
GEO_COORDINATES="69.420 69.420" \
docker-compose up -d --remove-orphans --build $@


#The following ENV vars are optional
#they need to be added above the last line containing
#docker-compose...

#QUERY_FEE_REBATE_CLAIM_THRESHOLD=number-in-grt \
#REBATE_CLAIM_BATCH_THRESHOLD=number-in-grt \
#NETWORK_SUBGRAPH_DEPLOYMENT=QmTePWCvPedmVxAvPnDFmFVxxYNW73z6xisyKCL2xa5P6e \
#INDEXER_AGENT_OFFCHAIN_SUBGRAPHS="Qm,Qm,Qm" \
#GRAPHNODE_LOGLEVEL=warn \
#ETHEREUM_TRACE_STREAM_STEP_SIZE=100 \
#ETHEREUM_BLOCK_BATCH_SIZE=50 \
#ETHEREUM_RPC_MAX_PARALLEL_REQUESTS=128 \
#GRAPH_ETHEREUM_MAX_BLOCK_RANGE_SIZE=1000 \
#GRAPH_ETHEREUM_TARGET_TRIGGERS_PER_BLOCK_RANGE=500 \
#INDEXER_AGENT_GAS_PRICE_MAX=gas-price-in-gwei \
#GRAPH_GRAPHQL_WARN_RESULT_SIZE=bytes \
#GRAPH_GRAPHQL_ERROR_RESULT_SIZE=bytes \

Containers:

  • Graph Node (query node)

  • Graph Node (index node)

  • Indexer Agent

  • Indexer Service

  • Indexer CLI

  • Postgres Database for the index/query nodes

  • Postgres Database for the agent/service nodes

  • Prometheus (metrics database) http://<host-ip>:9090

  • Prometheus-Pushgateway (push acceptor for ephemeral and batch jobs) http://<host-ip>:9091

  • AlertManager (alerts management) http://<host-ip>:9093

  • Grafana (visualize metrics) http://<host-ip>:3000

  • NodeExporter (host metrics collector)

  • cAdvisor (containers metrics collector)

  • Caddy (reverse proxy and basic auth provider for prometheus and alertmanager)

Start

To start, all you need to do is to:

bash start

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:

bash start --force-recreate <container_name>

Or to recreate the entire stack:

bash start --force-recreate

Verify that it runs properly

To verify that everything is up and running, you need to:

docker ps

And look for containers that are crash looping - you will notice restarting and a countdown - that means those containers are not working properly.

Last updated