Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

protofire/tkn-subgraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

TKN Subgraph

Table of Contents

Installation Prerequisites

How to Install Node.js and npm

  • Description: Node.js is a server platform for running JavaScript, which includes npm (Node Package Manager).
  • Usage: Required for installing dependencies and running development tools like Graph CLI.
  • Installation: Download and install Node.js and npm from the official website:

How to Install Yarn

  • Description: Yarn is an alternative to npm for managing project dependencies. It is used for fast and reliable package installation.
  • Installation: Install Yarn via npm:
    npm install -g yarn

How to Install Docker and Docker Compose

  • Description: Docker is a containerization platform that allows running applications in isolated containers. Docker Compose is a tool for managing multi-container applications.
  • Usage: Used for deploying services like IPFS, Postgres, and Graph Node, which are necessary for running subgraphs locally.
  • Installation: Download and install Docker from the official website:

How to Install Graph CLI

  • Description: Graph CLI is a command-line tool for creating, building, and deploying subgraphs.
  • Installation: Install Graph CLI via npm:
    npm install -g @graphprotocol/graph-cli

Running the Subgraph Locally with Docker Compose

Prerequisites

Before running the subgraph locally, ensure that you have installed the following:

Step 1: Clone the Repository

git clone https://github.com/protofire/tkn-subgraph
cd tkn-subgraph

Step 2: Start the Docker Services

Start the necessary services (IPFS, Postgres, and Graph Node) using Docker Compose:

docker-compose up -d

This command will start the following services:

  • IPFS: InterPlanetary File System for decentralized file storage.
  • Postgres: Database service for storing indexed data.
  • Graph Node: The service responsible for indexing and serving queries.

Step 3: Build the Subgraph

You should clone your subgraph repo:

git clone https://github.com/your-subgraph/repo ce repo

yarn install
graph codegen
graph build

Step 4: Deploy Your Subgraph Locally

Once the services are running, you can deploy your subgraph locally:

graph create --node http://localhost:8020/ <your-subgraph-name>
graph deploy <your-subgraph-name> --ipfs http://localhost:5001 --node http://localhost:8020/

Replace <your-subgraph-name> with the name of your subgraph.

Alternatively, you can use the following yarn scripts:

yarn create-local
yarn deploy-local

Step 5: Querying the Subgraph

After deployment, you can query your subgraph using the following GraphQL endpoint:

http://localhost:8000/subgraphs/name/<your-subgraph-name>

How to Deploy a Subgraph Using TKN Hosted Service

TKN Hosted Services (TKN-HS) for The Graph is a platform that let you deploy subgraphs in our infrastructure.

Endpoints Explanation
Index https://index.graph.tkn.xyz This endpoint is used to deploy the subgraph.
Query https://query.graph.tkn.xyz This endpoint is used to get data from the subgraph.
IPFS https://ipfs.graph.tkn.xyz This endpoint is used to store data builded by the subgraph.
Grafana https://grafana.graph.tkn.xyz Monitoring dashboards for The Graph

Prerequisites

Before deploying the subgraph using the TKN Hosted Service, ensure that you have installed the following:

Step 1: Download the Repository

git clone https://github.com/your-subgraph/repo
cd repo

Step 2: Build the Subgraph

yarn install
graph codegen
graph build

Step 3: Deploy the Subgraph

Once you have your credentials (user and password), you can deploy the subgraph:

graph create --node https://user:[email protected] tkn/example1
graph deploy tkn/example1 --version-label tkn/example1 --headers "{\"Authorization\": \"Basic user:password encoded\"}" --ipfs https://ipfs.graph.tkn.xyz --node https://user:[email protected]

Additional Resources

For more information about subgraphs, visit The Graph documentation:

The Graph Documentation

About

How to deploy a subgraph

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published