Stop wasting time looking for block numbers on block explorers. Instead, use Pinax’s new Block Time service.
Follow along with Étienne, an analytics developer at Pinax, as he showcases Block Time, a revolutionary service that allows you to retrieve data using specific dates rather than block numbers.
Thanks to Substreams technology, you can get the information you need from the blockchain using dates and timestamps.
What is Block Time?
To use a Substream or any Substream-related technology, you have to input a block range. For example, start at this block and end at this block. The challenge is that you can’t query historical data more intuitively using dates.
This is where Pinax’s Block Time can help. It translates a block number into a timestamp (and vice versa).
How does it work?
The Block Time service allows you to get a block number from a timestamp or partial date. So if you query a start date and (an optional) end date, you will get the block numbers associated with that date range.
The service uses a key-value (kv) store, and to populate that store with the data you want, you use Substreams sink kv, developed by the StreamingFast team.
You can use any compatible database for your kv store. This demo uses BadgerDB, but you could also use Zigbee or Redis, for example.
Watch the video above to see the full process.
How can you use it?
Use Block Time instead of hunting through a block explorer to find where a date starts in the chain.
You can also use Block Time as a template to build your own services with Substreams.
Explore the GitHub repository to use it as a starting point for customizing your own service and building your own kv service with Substreams.
No Comments