Reads all timestamps for a block range in a single call... you can get 1,000s of timestamps with a single API request
Uses GoEthereum standard /grapql endpoint
Best for in-house hosted nodes
Does not work with any commercial SaaS node provider because they do not support /graphql
To be able to have commercial SaaS node providers as a fallback option for JSON-RPC, we need to be able to read block timestamps so that their nodes do not complain.
Commercial SaaS vendors provide their incompatible proprietary APIs for tasks like reading multiple block headers
This is exactly like of proprietary low-quality APIs you can think of
As first commercial SaaS vendor to pilot out we'd like to try Ankr
ank_getBlocks proprietary API can read blocks in batch up to 20 blocks at a time
Ankr claims to support up to API 1500 request/minute
Ankr offer pay-as-you-go plan so it is easy get started with them
[x] Create has_ankr_support method in eth_defi.chain
[x] Create AnkrReorganisationMonitor that is similar to GraphQLReorganisationMonitor - using the underlying extract_timestamps_ankr_get_block
[x] Add a compatibility check in create_reorganisation_monitor that will automatically create AnkrReorganisationMonitor if we are connected to Ankr node
[x] Create an integration test that take JSON_RPC_ANKR_PRIVATE as the environment variable input to test these against a live Ankr plan
Block timestamps are needed for mass event ingestion with
eth_getLogs
. We need to map block number -> timestamp.Currently we offer two ways to do it
eth_getBlockByNumber
for the range of all blocks (start, end) we need to get events frometh_getBlockByNumber
returns 8 MB data and we often need to read 100 - 1,000 blocks once/grapql
endpoint/graphql
To be able to have commercial SaaS node providers as a fallback option for JSON-RPC, we need to be able to read block timestamps so that their nodes do not complain.
As first commercial SaaS vendor to pilot out we'd like to try Ankr
ank_getBlocks
proprietary API can read blocks in batch up to 20 blocks at a timeFor the task
reader/ankr.py
moduleextract_timestamps_ankr_get_block
methodhas_ankr_support
method ineth_defi.chain
AnkrReorganisationMonitor
that is similar toGraphQLReorganisationMonitor
- using the underlyingextract_timestamps_ankr_get_block
create_reorganisation_monitor
that will automatically createAnkrReorganisationMonitor
if we are connected to Ankr nodeJSON_RPC_ANKR_PRIVATE
as the environment variable input to test these against a live Ankr plan