Skip to content

Commit

Permalink
Update indexers.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bucanero committed Sep 1, 2023
1 parent b5e90fc commit 0a161da
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/bos/community/indexers.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can request access through [this link](https://near.org/dev-queryapi.datapla

## How it Works

This works by:
QueryAPI works by:

1. Writing the indexer name to the blockchain, registering its creation;
2. Creating the tables as specified in the schema to the GraphQL database, exposing a GraphQL endpoint to query the data;
Expand Down Expand Up @@ -58,6 +58,17 @@ This is the interface through which you can create a new Indexer. On here you ca
* the indexer name on Indexer Name
* from which block to start indexing on Specific Block Height or From Latest Block Height (selected by default)

### Design Workflow

To design and create your indexer, you can follow this recommended workflow:

1. Using [nearblocks.io](https://nearblocks.io), find transactions to smart contracts that you want to index
2. Take the block `height` and put it into the [Debug Mode filter](../queryapi/index-function.md#local-debug-mode), open your browser's _Developer Console_, and hit <kbd>Play</kbd>
4. Inspect the block and write JavaScript code using [NEAR Lake Primitives](../../2.develop/lake/lake-primitives.md) to extract data from a `block` object. (This JS code will be your [`IndexingLogic.js`](#indexinglogicjs))
> **Tip:** Use `context.log` for debugging to ensure you are getting the right results
4. Add more blocks for debugging, or start following the blockchain to see how new blocks are handled
5. Create tables that you need to store the data using Postgres [CREATE table syntax](https://www.postgresql.org/docs/current/sql-createtable.html). (This SQL code will be your [`schema.sql`](#schemasql))


:::tip Video Walkthrough

Expand Down

0 comments on commit 0a161da

Please sign in to comment.