1.0.43 • Published 12 months ago

@aleph-indexer/indexer-example v1.0.43

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

Aleph Indexer Example

This README provides an overview of a simple indexer built using the Aleph Indexer Framework. The example indexer demonstrates the process of indexing transactions, logs, and instructions from multiple blockchains, including

  • Ethereum
  • Solana
  • and Binance Smart Chain (BSC).

The primary purpose of this example is to showcase the functionality of the Aleph Indexer Framework.

Overview

The indexer is designed to listen for events on supported blockchains and process them according to the specified filtering and indexing logic. In this example, the indexing operations only log the processed data. However, you can easily extend the indexer to store the indexed data in a database or perform more complex processing to meet your project's specific requirements.

Main Domain

The MainDomain class is responsible for account discovery. It returns a list of accounts to be indexed for each supported blockchain. This class extends the IndexerMainDomain from the Aleph Indexer Framework and implements the IndexerMainDomainWithDiscovery interface.

Account Discovery

The discoverAccounts function in the MainDomain class returns an array of AccountIndexerConfigWithMeta objects, containing the blockchain ID, account address, meta information, and indexing configuration for each supported blockchain.

Stats Calculation

The IndexerMainDomainWithStats interface extends the capabilities of the MainDomain class by introducing methods for calculating and retrieving statistics about indexed accounts on supported blockchains. By implementing this interface, the main domain can update, retrieve, and transform time-series stats for specified accounts, as well as obtain global stats for those accounts.

An stub example can be found here: Stats Calculation

Worker Domain

The WorkerDomain class implements the filtering and indexing logic for transactions, logs, and instructions on each supported blockchain. This class extends the IndexerWorkerDomain from the Aleph Indexer Framework and implements the interfaces for Ethereum, Solana, and BSC indexer worker domains.

Filtering

The WorkerDomain class contains filtering functions for transactions, logs, and instructions on each supported blockchain. In this example, all transactions, logs, and instructions are allowed to pass through the filters.

Indexing

The WorkerDomain class contains indexing functions for transactions, logs, and instructions on each supported blockchain. In this example, the indexing functions only log the processed data, but you can extend the functionality to store the data in a database or perform additional processing.

Getting Started

To start using this example indexer, follow these steps:

  • Clone the repository and install dependencies.
  • Configure the environment variables according to the Aleph Indexer Framework documentation.
  • Run the indexer using the provided scripts in the package.json file.

With these steps, you'll have a fully functional indexer that demonstrates the capabilities of the Aleph Indexer Framework. Customize the filtering and indexing logic or extend the functionality to fit your specific project requirements.

1.0.43

12 months ago

1.0.42

12 months ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.40

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.29

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago