How to run a graph node locally in windows

DeFiCenter
3 min readOct 22, 2020

This article will walk you through the steps to setup and run a local graph node in windows. There are many tutorials on how to setup and run a graph node but unfortunately I didn’t find any one based on windows platform.

Below will list all the resources you need to run the graph node.

Resources you need

Ganache: this is the local Ethereum node our graph will connect to.

Graph Node: this is the source code we need to download to run locally

Docker Desktop for windows: the author tried very hard to make the graph node work without docker which means per graph document we need to install Rust/PostgresQL/IPFS. Unfortunately a bunch of random errors pops up when we try to build/run. For this reason the author would recommend go for docker option in windows.

Step 1: install Ganache

Here we can just install the windows GUI version. After you start Ganache, start the quick workspace you will see following. Please note the “RPC SERVER” address below. But default it’s 127.0.0.1. We need to go to setting on top right then go to “SERVER” tab to change it to 0.0.0.0. Our docker container will not be able to connect to 127.0.0.1 address so it’s very important to change it to 0.0.0.0.

Step 2: download the graph node source code from Github.

The source code can be download at:

https://github.com/graphprotocol/graph-node.git

Step 3: install docker windows desktop

Step 4: update graph node docker container template file

We need to tell our docker container which Ethereum to listen to. The file can be found at: graph-node/docker/docker-compose.yml assuming graph-node is the root directory of graph node source code.

We need to change ethereum address in this file to below:

mainnet:http://10.0.2.2:8545

This change is not consistent with graph node documentation. You have to make this change to make it work for windows. This is the only change you need to make in the file.

Step 5: start docker container.

Start a docker terminal then go to graph-node/docker directory assuming graph-node is the root directory of graph node source file. Run:

docker-compose up

Step 6: inspect container database

When you open docker command it will show default container IP. A common value is 192.168.99.100. To connect to docker postgre database we can use following:

Address: 192.168.99.100

Port: 5432

Maintenance database: postgres

User name: graph-node

Pwd: let-me-in

--

--