flow-go-sdk
flow-go-sdk copied to clipboard
Add support for querying blocks near a timestamp
Is your feature request related to a problem? Please describe.
Would like to query chain state via ExecuteScript at the last block before a given timestamp. Currently, this involves finding the block corresponding to the desired timestamp on the application side.
Describe the solution you'd like
GetBlockBeforeTimestamp and GetBlockAfterTimestamp endpoints. Possibly even ExecuteScriptBeforeTimestamp/ExecuteScriptAfterTimestamp.
Describe alternatives you've considered
Current alternative I'm using is performing a binary search from latest block to 0 in order to find the block just before a timestamp. However, this pushes extra processing/complexity to the application.
Additional context
This issue should be moved to the flow-go AN repository since the SDK can not implement such a feature if the AN doesn't support it.
Unlikely to be implemented in Go SDK. Usage of archive node would be appropriate.