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.
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.