- Installation Prerequisites
- Running the Subgraph Locally with Docker Compose
- How to Deploy a Subgraph Using TKN Hosted Service
- Additional Resources
- 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:
- 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
- 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:
- 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
Before running the subgraph locally, ensure that you have installed the following:
git clone https://github.com/protofire/tkn-subgraph
cd tkn-subgraphStart the necessary services (IPFS, Postgres, and Graph Node) using Docker Compose:
docker-compose up -dThis 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.
You should clone your subgraph repo:
git clone https://github.com/your-subgraph/repo ce repo
yarn install
graph codegen
graph buildOnce 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-localAfter deployment, you can query your subgraph using the following GraphQL endpoint:
http://localhost:8000/subgraphs/name/<your-subgraph-name>
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 |
Before deploying the subgraph using the TKN Hosted Service, ensure that you have installed the following:
git clone https://github.com/your-subgraph/repo
cd repoyarn install
graph codegen
graph buildOnce 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]For more information about subgraphs, visit The Graph documentation: