What is NEAR Indexer?
As scaling dApps enter NEAR’s mainnet, an issue may arise: how do they quickly and efficiently access state from our deployed smart contracts, and cut out the cruft? Contracts may grow to have complex data structures and querying the network RPC may not be the optimal way to access state data.
The NEAR Indexer is a micro-framework specifically designed to handle real-time events on the blockchain, allowing to capture and index streams of blocks in a customized manner.
With the NEAR Indexer, developers can perform both high-level data aggregation and low-level introspection of blockchain events.
For those searching to not build their own indexer, the NEAR Lake Framework provides a simpler way to access blockchain data in real-time
How It Works
The NEAR Indexer works by running a node and processing blocks as they are added to the blockchain. The framework provides a stream of blocks, allowing developers to subscribe and process these blocks in real-time.
Learn how to run it following the tutorial.
Comparison with NEAR Lake Framework
Comparing to NEAR Lake Framework in terms of latency the NEAR Indexer is significantly faster as it reads data directly from the blockchain the same way as RPC nodes do.
| Feature | Indexer Framework | Lake Framework |
|---|---|---|
| Allows to follow the blocks and transactions in the NEAR Protocol | Yes | Yes (but only mainnet and testnet networks) |
| Decentralized | Yes | No (Pagoda Inc dumps the blocks to AWS S3) |
| Reaction time (end-to-end) | minimum 3.8s (estimated average 5-7s) | minimum 3.9s (estimated average 6-8s) |
| Reaction time (framework overhead only) | 0.1s | 0.2-2.2s |
| Estimated cost of infrastructure | $500+/mo | $20/mo |
| Ease of maintenance | Advanced (need to follow every nearcore upgrade, and sync state) | Easy (deploy once and forget) |
| How long will it take to start? | days (on mainnet/testnet) | seconds |
| Ease of local development | Advanced (localnet is a good option, but testing on testnet/mainnet is too heavy) | Easy (see tutorials) |
| Programming languages that a custom indexer can be implemented with | Rust only | Any (currently, helper packages are released in Python, JavaScript, and Rust) |