This is an API which queries a list of RPCs for top of block and low latency.
To run this. Make sure you have Python +3.9 installed, web3 +6.0.0
pip install fastapi aiohttp web3 uvicorn
python .\main.pyIn API.py - Change the latency filter to whatever time you want and update the RPC list to match your RPCs. This should work with any RPC list.
GET /toprpc{
"rpc_url": "URL_ADDRESS",
"blocknumber": INT_BLOCKNUMBER
}
I would like to add multiple chains to this api in the future, but I am working mainly on Optimism for now.