Skip to content

Issue 10: Create Lisk L2 Indexer #11

@product-labo

Description

@product-labo

Description:
Build an indexer that connects to Lisk L2’s op-reth RPC and stores block and transaction data for analytics.

Tasks:

Create a service /indexer.

Connect to RPC:

import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("http://op-reth:8551");

Listen for new blocks:

provider.on("block", async (blockNumber) => {
const block = await provider.getBlock(blockNumber, true);
// Store block + txs
});

Parse and save data to PostgreSQL:

Block number, hash, timestamp

Transaction hash, from, to, gas, status

Add log decoding for events (use ABI decoder for known contracts).

Write sync script for missed blocks.

Deliverable:
Functional indexer syncing L2 blocks and transactions in near real-time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions