Re: Get previous states of a key

Jay Guo

I don't think `GetHistoryForKey` would be the best API for your use
case. Instead, you probably want to insert a new entry for each data
point, which is indexed by location and time, so you could perform a
rich query via `GetQueryResult` (rich query).

The reason is that time is merely a "special" field in your data
point, which blockchain itself is not aware of.

- J

On Thu, Jun 3, 2021 at 4:11 PM Nikos Karamolegkos <nkaram@...> wrote:

In case that I write to BC ledger some IoT measurements every 1 hour
(eg. key=device1, value={temp=15, humidity=65}) can I retrieve them for
a specific time window (e.g last 5 hours)? Also, can I somehow know in
which block each measurement was written to ledger?

Join to automatically receive all group messages.