0

I have created an address and some payload serialised with protobuf. I have then stored this serialised bytes on this address

 context.set_state({address: account.SerializeToString()},
                                self._timeout)

Now, Lets say i have chnaged the payload and uploaded to this address. I just want to know, If i can get the history of all the changes made to this address alongwith the present payload stored at this address.

GraphicalDot
  • 2,644
  • 2
  • 28
  • 43

1 Answers1

2

First: There is no immediate or obvious api to fetch the history of data for a specific address.

That being said, each transaction, as you know, does get a context which is what is then written through to global state. The merkle tree maintains that transaction context however.

You have three choices:

  1. Using the /blocks endpoint, iterate through each transaction in each block. From the transaction use the state root hash field in the head field of the /state endpoint along with the address of interest.
  2. Using the /transactions endpoint to get the list of transactions, using the same fields described in #1
  3. Instrument your TP to emit Events and, using an off chain event listener, capture relevant information to an off-chain DB to index and queried as desired.
Frank C.
  • 7,758
  • 4
  • 35
  • 45