Skip to main content
If you plan to update or redeploy your subgraph in the future, create and use a tag before you start querying the endpoint. Tags let you hot-swap new deployments under the same URL later without changing your front-end code.

Prerequisite

Getting started

  1. Log in to Ormi and go to your dashboard.
  2. From the dashboard, create an API key.
0xGraph graph init
Note: Keep this page open, we’ll need the API key later to deploy a subgraph.

Install Graph CLI

On your local machine, run the following in your terminal:

Create a directory for your subgraph

We’ll call the folder katana-blocks in this example.

Initialize Node project

Run bash in the directory folder

Install dependencies

Create the required files

You will need:
  • subgraph.yaml
  • schema.graphql
  • mappings/blocks.ts
  • abis/Dummy.json

subgraph.yaml

Note: Dummy.json is required because every data source must include at least one ABI, even if unused. Just put [] inside it.

schema.graphql

Mapping files in typescript

Directory layout

You’ll also see node_modules/ after installing dependencies - that’s expected.

Build the subgraph

Generate types:
0xGraph graph init
Now run:
0xGraph graph init

Deploy the Subgraph to Ormi 0xGraph

Return to your API key from the dashboard. Replace graph-name and API key with your actual values
0xGraph graph init

Track sync status

You can check syncing in the dashboard by going to the Subgraphs tab:
0xGraph graph init

Query Katana blocks

Click on the button where the red arrow is pointing.
0xGraph graph init
Once synced, click the GraphQL endpoint link in the dashboard.
0xGraph graph init

Sample query

Run this query to fetch the latest 5 blocks
0xGraph graph init

Done!

You now have a live subgraph indexing Katana blocks through Ormi’s 0xGraph.

Next steps