Skip to main content
Building Graph Node from source is typically needed for contributors or developers who want to modify Graph Node itself. For subgraph development, using Docker is recommended.

Prerequisites

Ensure the following are installed on your system:
toolchain
required
Latest stable Rust compiler and toolchainInstall via rustup:
database
required
PostgreSQL 12 or higher
service
required
IPFS daemon (Kubo)Install IPFS
build-tool
required
Protocol Buffers compiler
  • macOS: brew install protobuf
  • Linux: apt-get install protobuf-compiler or dnf install protobuf-compiler
  • Manual: Installing Protobuf
service
required
Access to an Ethereum RPC endpointOptions:
  • Local node (Geth, Erigon, Nethermind)
  • Provider service (Infura, Alchemy, QuickNode)

Setup Instructions

1

Clone the Repository

Clone Graph Node from GitHub:
2

Install Rust Components

Ensure all required Rust components are installed:
The graph-node codebase assumes the latest available stable compiler is used.
3

Set Up PostgreSQL

Create a database and configure it for Graph Node.
The superuser name depends on your installation (usually postgres or your username):
Required PostgreSQL extensions:
  • pg_trgm: Trigram matching for text search
  • btree_gist: B-tree indexing support
  • postgres_fdw: Foreign data wrapper for multi-database setups
Set the POSTGRES_URL environment variable and save it (e.g., in ~/.bashrc or ~/.zshrc):
Verify the connection:
4

Start IPFS

Initialize and start the IPFS daemon:
IPFS should be accessible at 127.0.0.1:5001.
5

Build Graph Node

Build the Graph Node binary in release mode:
This compiles the graph-node binary to target/release/graph-node.
Initial builds can take 15-30 minutes depending on your system. Ensure you have:
  • At least 8GB RAM
  • 10GB free disk space
  • Good internet connection for downloading dependencies
6

Run Graph Node

Start Graph Node with the required configuration:
The --ethereum-rpc argument format is:
Examples:
Common Capabilities:
  • archive: Full historical state available
  • traces: Supports debug_traceBlockByNumber for call tracing
7

Verify Graph Node is Running

Graph Node prints the ports it’s listening on when it starts. By default:Test the GraphQL endpoint:

Deploying a Subgraph

Once Graph Node is running, deploy subgraphs using Graph CLI:
1

Install Graph CLI

2

Create a Subgraph

3

Generate Code and Build

4

Create and Deploy

5

Query the Subgraph

Once deployed, query at:
Or use GraphiQL:

Development Workflow

Running Tests

Code Quality

Building Specific Components

Command Line Arguments

string
required
PostgreSQL connection stringFormat: postgresql://user:password@host:port/database
string
required
Ethereum network configurationFormat: NETWORK:[CAPABILITIES]:URLCan be specified multiple times for multiple networks.
string
required
IPFS node addressDefault: 127.0.0.1:5001
string
Unique identifier for this node (for multi-node setups)Default: default
string
Path to TOML configuration file for advanced setupsMutually exclusive with --postgres-url and --ethereum-rpc
boolean
Enable debug logging

Advanced Configuration

For complex deployments, use a TOML configuration file instead of command-line arguments:
This is useful for:
  • Multiple PostgreSQL databases (sharding)
  • Multiple blockchain networks
  • Advanced indexing and query node separation
  • Custom deployment rules

Environment Variables

Many aspects of Graph Node can be configured via environment variables:

System Requirements

Minimum Requirements

  • CPU: 4 cores
  • RAM: 8GB
  • Disk: 50GB SSD (more for indexing mainnet)
  • Network: Stable broadband connection
  • CPU: 16+ cores
  • RAM: 32GB+
  • Disk: 500GB+ NVMe SSD
  • Network: 1Gbps connection
  • PostgreSQL: Dedicated database server with tuning

Troubleshooting

Ensure you have the latest stable Rust:
Install system dependencies:
Verify the connection string:
Check PostgreSQL is running:
Ensure required extensions are installed:
Verify IPFS is running:
Check IPFS configuration:
Reduce parallel compilation jobs:
Or build without release optimizations initially:
Test your Ethereum endpoint:
Ensure your RPC provider supports required methods:
  • eth_getLogs
  • eth_getBlockByNumber
  • eth_call
  • debug_traceBlockByNumber (for traces)

GraphMan CLI Tool

Graph Node includes graphman, a CLI tool for database management:

Next Steps