Goals

The goal of this project is to build a separate endpoint to serve the heavy RPC calls like eth_getLogs calls.

Context

eth_getLogs call is a very heavy call as it may go through all the blockchain blocks from genesis to the latest blocks to find the transaction data. The current implementation of getLogs RPC handler in Harmony wasn’t optimized to serve thousands of requests as it was only designed to handle a single user’s request.

Based on the shared experience of Infura, the getLogs RPC request could serve users better using a separate indexed DB, such like postgres.

Architecture

From the public end point, the payload needs to be parsed to identify the eth_getLogs call and redirect the request to the specific load balancer to serve the requests. The logLB is using the reader/writer architecture to serve scalable requests.

Additional indexer has to be built to index the receipt and put into the indexed postgres DB. This is the writer of the DB.

Scalable readers can read from the DB and serve the RPC requests. This is the reader of the DB.

Action Items

Reference

https://blog.infura.io/ethereum-rpcs-methods/

Infura has a cap on requests of 10,000 events per query.
Best practice is to request a single block, as we’ve done in this example,
and do that for each mined block.

https://blog.infura.io/building-better-ethereum-infrastructure-48e76c94724b/?&utm_source=infurablog&utm_medium=referral&utm_campaign=tutorials&utm_content=eth_call_tutorial

RPC ethLogs PR https://github.com/harmony-one/explorer-v2-backend/pull/19/files