3

If I need the history of some state address what should I do ?

Is it possible to use the REST API to retrieve all the transactions that changed a leaf state address ?

Or the only way to gather the "history" is by running trough all the transactions and gathering only the ones that I need ?

ludeed
  • 443
  • 6
  • 17

1 Answers1

4

The history of state can be retrieved by querying the state endpoint with the different head block ids. To get transactions that changed the state, each transactions will have to be queried.

If possible, a good pattern to follow would be to have an event listener that monitor state changes and keep track of changes and the needed transaction ids in a separate DB.

shonjs
  • 256
  • 1
  • 6
  • The event listener would subscribe to "sawtooth/state-delta" events for a specific state address. Every delta is linked with a block so the REST-API could be queried for the block and its transactions. Am I interpreting this correctly? – Luis F. Mar 03 '21 at 13:37