Skip to main content

This page presents an example of how SDK packages can be combined into a working indexer (called squid) on Neon EVM Devnet. This squid example tracks transfers of WNEON on Neon EVM Devnet, then save the resulting data to PostgreSQL and serve it as a GraphQL API.


Subsquid Network is a decentralized query engine optimized for batch extraction of large volumes of data. It currently serves historical on-chain data ingested from 100+ EVM and Substrate networks, including event logs, transaction receipts, traces and per-transaction state diffs.

Here's an example of how SDK packages can be combined into a working indexer (called squid). This example uses WNEON contract.


  • NodeJS 16.x or newer
  • Docker

How to run a squid on Neon EVM Devnet

Step 1: Initialize a node project

Create an empty project directory and navigate to it and run:

npm init

Step 2: Install dependencies

npm i @subsquid/evm-processor @subsquid/typeorm-store @subsquid/typeorm-migration @subsquid/graphql-server

npm i typescript @subsquid/typeorm-codegen @subsquid/evm-typegen @@subsquid/util-internal-validation --save-dev

Step 3: Add tsconfig.json to the project's root directory

"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"module": "commonjs",
"target": "es2020",
"esModuleInterop": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true

Step 4: Define the schema for both the database and the core GraphQL API in schema.graphql in the project's root directory

type Transfer @entity {
id: ID!
src: String! @index
dst: String! @index
wad: BigInt!

Step 5: Generate TypeORM classes based on the schema

npx squid-typeorm-codegen

The TypeORM classes will be available at src/model/index.ts.

Step 6: Prepare the database

6.1 Create .env file in the project's root directory and paste the following lines -


6.2 Create docker-compose.yaml file in the project's root directory and paste the following lines -

version: "3"
image: postgres:15
- "${DB_PORT}:5432"

6.3 Start the database container -

docker compose up -d

6.4 Compile the TypeORM classes -

npx tsc

6.5 Generate the migration file -

npx squid-typeorm-migration generate

6.6 Apply the migration with -

npx squid-typeorm-migration apply

Step 7: Generate utility classes for decoding WNEON contract data based on its ABI

7.1 Create a folder named abi under src (src/abi).

7.2 Create wneon.json file under src/abi (src/abi/wneon.json) and paste the contracts's ABI ( into it.

7.3 Run -

npx squid-evm-typegen src/abi ./src/abi/wneon.json

The utility classes will be available at src/abi/wneon.ts.

Step 8: Create an executable file main.ts under src folder (src/main.ts)

Paste the following lines of code into main.ts -

import { EvmBatchProcessor } from "@subsquid/evm-processor";
import { TypeormDatabase } from "@subsquid/typeorm-store";
import * as wneonAbi from "./abi/wneon";
import { Transfer } from "./model";

const processor = new EvmBatchProcessor()
// set RPC endpoint in .env
url: process.env.RPC_NEON_HTTP,
//rateLimit: 10,
.setBlockRange({ from: 177455580 }) // Neon EVM Devnet genesis block
.setFinalityConfirmation(75) // 15 mins to finality
address: ["0x11adC2d986E334137b9ad0a0F290771F31e9517F"], // WNEON contract address on Neon EVM Devnet
topic0: [],

const db = new TypeormDatabase();, async (ctx) => {
const transfers: Transfer[] = [];
for (let block of ctx.blocks) {
for (let log of block.logs) {
let { src, dst, wad } =;
new Transfer({

Step 9: Compile the project and start the processor process

npx tsc
node -r dotenv/config lib/main.js

Step 10: Start the GraphQL server

In a separate terminal, run the graphql server -

npx squid-graphql-server

The finished GraphQL API with GraphiQL will be available at localhost:4350/graphql.


Please follow the quick start github tutorial Subsquid SDK Example.

Changes needed to run a squid on Neon EVM Mainnet

To run a squid on Neon EVM Mainnet, there needs to be some changes to some of the above mentioned steps.

  1. Replace RPC_NEON_HTTP= to RPC_NEON_HTTP= in the .env file in Step 6.1

  2. Get the WNEON contract's ABI from the mainnet ( in Step 7.2

  3. In Step 8, change to the following in the src/main.ts file:

  • setGateway("")
  • setBlockRange({ from: 195350522 }) (Neon EVM Mainnet genesis block)
  • address: ["0x202c35e517fa803b537565c40f0a6965d7204609"] (WNEON contract address on Neon EVM Mainnet)
Was this page helpful?