The indexer listens to each block that gets stored in the Lake S3 bucket, by using the near-lake-framework, and reacts to only function calls sent to the Horizon smart contract.
Here is the flow outline of how this happens:
- A new block is read from the S3 bucket
- For each shard in the block, iterate over the transactions and filter out the transaction hash and receipt ID if the transaction receiver ID is of interest - source
- Collect those receipt IDs and transaction hashes in a
HashMap
- source - Filter out the current block's receipts based on the map of receipt IDs
and transaction hashes, and get their
ExecutionOutcome
s with the same transaction hashes - source - Process each outcome in order to extract all actions that are of interest and format them in the correct struct - source
- Store the collected actions in our database - source
- Store the last visited block height - source
NOTE: Keep track of the migration to 0.8.0.