Overview
UniSat Indexer (libbrc20-indexer) is an open-source library written in Go that fully implements the BRC-20 protocol specification for indexing Ordinals-based token activity. Designed for developers who need a reliable way to parse and index blockchain data related to BRC-20 tokens, the library offers both reusable packages and a sample command-line tool that demonstrates how to analyze blocks, extract token events, and aggregate token and holder state. The project is published under the MIT license and is maintained within the UniSat organization on GitHub.
Core Capabilities
- Protocol Compliance: The library aims to fully implement the BRC-20 specification so that events and token states follow expected semantics.
- Indexer Engine: A modular indexing engine parses incoming block data, recognizes BRC-20 inscriptions and operations, and updates token metadata.
- Data Aggregation: The indexer maintains aggregated metrics such as minted supply, valid/invalid operation counts, holder balances, transfer histories, and token counts.
- Extensible Architecture: The codebase is organized into subpackages (cmd, indexer, loader, model, utils, etc.) to make it straightforward to integrate components into custom services.
- Command-line Example: A reference
cmd/main.godemonstrates how to build and run a simple program that processes input data and prints detailed token and holder summaries.
-
Protocol parsing and event detection: The library inspects inscription payloads and transaction content to detect BRC-20 lifecycle events such as mint, deploy, and transfer. It classifies operations into valid and invalid actions based on the specification.
-
Token and holder indexing: UniSat Indexer aggregates per-token statistics (history length, minted amount, valid operation counts) and per-holder balances and token holdings. This enables quick retrieval of token metadata and top-holders for analytic use cases.
-
Pluggable loading and storage: The project separates the data-loading layer from indexing logic, allowing you to plug custom loaders that feed block data or use the provided sample loader for tests and demos.
-
Diagnostics and reporting: The sample CLI demonstrates runtime reporting such as processed tickers, numbers of users and tokens indexed, and counts of valid versus invalid transfers. This assists in debugging and validating indexing results.
-
Go-native, production-friendly design: With idiomatic Go modules, the repository facilitates compilation into stand-alone tools and easy import into existing Go projects. Its code structure is suited for embedding into explorers, wallet backends, and analytics pipelines.
Getting started
- Clone the repository and review the README and example
cmd/main.goto understand expected input and output formats. - Build the sample CLI using the provided Go tooling (
go build ./cmd/main.go) and run it against a set of blocks or test data to observe token summaries and holder reports. - Integrate the indexer package into your application: use the loader to supply block data, call the indexer to update token and holder state, and persist results to your database.
Recommended Reasons
UniSat Indexer is recommended for developers building tools around BRC-20 tokens because it provides a focused, protocol-complete indexing toolkit in Go, a clean separation of concerns for loaders and indexers, and practical examples to accelerate adoption. Its aggregated outputs — token supplies, holder balances, and event classification — make it well suited for explorers, wallets, analytics dashboards, and automated monitoring systems. The MIT license and active releases (including recent support for a BRC-20 swap module) make it straightforward to adopt and extend in production environments.


