简体   繁体   English

根据时间戳获取块详细信息

[英]Getting block details based on timestamp

I am trying to tackle an issue of getting the block details based on the start date and end date using JAVASCRIPT, Geth1.4.11 . 我正在尝试使用JAVASCRIPT Geth1.4.11根据开始日期和结束日期来解决获取块详细信息的问题。

WHAT I WANT ? 我想要的是 ?

I want to get input of Start date and End date from user and using that start and end date i need to search the block , whatever blocks comes in between those dates have to be traced and data of those block has to be obtained. 我想从用户那里获取开始日期和结束日期的输入,并且需要使用该开始日期和结束日期来搜索该块,因此必须跟踪这些日期之间的任何块,并且必须获取这些块的数据。

eg :: Assume there are 1000 blocks created between month January and March . 例如:::假设在1月到3月之间创建了1000个块。 I need to get the from,to and value details in the block from February 1st to February 28th . 我需要在2月1日至2月28日的区块中获取from,to和value的详细信息。

WHAT I WORKED ON? 我在做什么? (My Approach) (我的方法)

Assigned start and End date into variable , obtained from user. 将开始日期和结束日期分配给从用户获得的变量。

Traverse from 0 to endBlock. 从0遍历到endBlock。 Get timestamp of the traversed block number. 获取遍历的块号的时间戳。

Compare the obtained timestamp with the user inputted Start date timestamp, if matched, traverse to capture end date timestamp and compare. 将获得的时间戳与用户输入的开始日期时间戳进行比较,如果匹配,则遍历以捕获结束日期时间戳并进行比较。

Record the blockNumber at which the start and end date were obtained and then traverse through the StartBlock and EndBlock fetching from ,to and Value. 记录获得起始日期和结束日期的blockNumber ,然后遍历从,到和值中获取的StartBlockEndBlock

Problems facing 面临的问题

The traverse crashes my webpage since it has lot of blocks to traverse through. 遍历使我的网页崩溃,因为它有许多遍历的块。

WHAT I AM LOOKING FOR 我在找什么

An API which takes start date and end date as input and gives the from, to and value. 一个以开始日期和结束日期为输入并提供从,到和值的API

A Optimized way to jump to the block of start date and end date and use traversal. 跳转到开始日期和结束日期并使用遍历的一种优化方法。

or any as such function. 或任何此类功能。

The traverse crashes my webpage since it has lot of blocks to traverse through. 遍历使我的网页崩溃,因为它有许多遍历的块。

This is not a standard way to load so much data all at a time. 这不是一次加载所有数据的标准方法。 What I suggest you do is pagination . 我建议你做的是pagination This way you can send chunks of data time by time. 这样,您可以一次发送一次数据块。 This will make your page much responsive and will prevent it from crashing 这将使您的页面响应速度更快,并防止崩溃

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM