Skip to content

protofire/kakarot-subgraph

Repository files navigation

Kakarot Sepolia Subgraph

This is a demo test version of a subgraph for tracking Transfer events in the Kakarot contract on the Sepolia network. The subgraph indexes account data and tracks the number of transactions for each account.

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/kakarot-subgraph
cd kakarot-subgraph

Step 2: Build the Subgraph

yarn install
graph codegen
graph build

Step 3: 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 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 Kakarot Hosted Service

Kakarot Hosted Services (KHS) for The Graph is a platform that let you deploy subgraphs in our infrastructure.

https://ui.kakarot.protofire.io/

Prerequisites

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

Step 1: Download the Repository

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

Step 2: Build the Subgraph

yarn install
graph codegen
graph build

Step 3: Get Credentials

You'll need credentials to use the Kakarot hosted service. Complete this form to request permission to deploy a subgraph:

Request Permissions

Step 4: Deploy the Subgraph

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

graph create --node https://user:[email protected] kakarot/UniswapV2
graph deploy kakarot/UniswapV2 --version-label kakarot/UniswapV2 --headers "{\"Authorization\": \"Basic user:password encoded\"}" --ipfs https://ipfs.kakarot.protofire.io --node https://user:[email protected]

Additional Resources

For more information about subgraphs, visit The Graph documentation:

The Graph Documentation

About

Repo for Kakarot network based on UniswapV2 contract

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •