Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
c043aa5
fix(informative): batch insert by max postgres limit
traviolus Feb 18, 2025
06eb7e0
Merge pull request #20 from initia-labs/fix/psql-limit
SeUkKim Feb 18, 2025
ae45d57
Merge pull request #19 from initia-labs/feat/bump-movevm
traviolus Feb 18, 2025
6c4a621
feat(actions): dispatch workflow for interwoven-1
traviolus Mar 12, 2025
fa8c044
bump modules
SeUkKim Mar 18, 2025
5380cb2
impv: improve docs + moved local setup out of dockerfiles/
WasinWatt Mar 31, 2025
b477c16
Merge pull request #21 from initia-labs/feat/bump-modules
traviolus Mar 31, 2025
726e251
Merge pull request #22 from initia-labs/impv/readme-and-local-structure
traviolus Mar 31, 2025
3bf0a1c
feat(informative): bump dependencies
traviolus Apr 1, 2025
e64e8fe
Merge pull request #23 from initia-labs/feat/bump-dependencies
traviolus Apr 1, 2025
56e1a15
feat(actions): update go version
traviolus Apr 1, 2025
bb2a36c
fix(informative): finalize block event mode extraction
traviolus Apr 1, 2025
f038482
feat(informative): get latest indexed height from faster table query
traviolus Apr 1, 2025
19371ee
Merge pull request #24 from initia-labs/fix/events-mode
SeUkKim Apr 1, 2025
ae22906
chore(deps): bump golang.org/x/net in /informative-indexer (#61)
dependabot[bot] Jul 13, 2025
89f37e3
chore: remove unnecessary extension from docker and use alpine (#117)
Vritra4 Jul 16, 2025
dc2ec60
fix dockerfile (#119)
Vritra4 Jul 16, 2025
a5c3a8f
Revert "fix dockerfile (#119)"
Vritra4 Jul 19, 2025
97839e3
Revert "chore: remove unnecessary extension from docker and use alpin…
Vritra4 Jul 19, 2025
ea036b7
V2 (#155)
songwongtp Aug 20, 2025
07dc4d8
refactor: ci workflow (#156)
LizJeong Aug 20, 2025
40fd989
feat(indexer): add version validation in parseBlockAndRebalanceRPCCli…
Benzbeeb Aug 20, 2025
19fe360
chore(deps): bump github.com/gofiber/fiber/v2 in /api (#159)
dependabot[bot] Aug 21, 2025
bc979f2
refactor: remove apperror package and update error handling (#158)
Benzbeeb Aug 21, 2025
4a8cb93
feat(readme): update v2 (#160)
traviolus Aug 21, 2025
bd20f4c
fix: proposal ignore conflict (#162)
songwongtp Aug 23, 2025
3cff3c5
fix: update get tx by hash error message response (#161)
Poafs1 Aug 23, 2025
f55ecf3
chore: update .gitignore and clean up test code (#164)
Benzbeeb Aug 27, 2025
ce4cf38
fix: event indexer tx events (#165)
songwongtp Aug 27, 2025
6ad9e8a
feat(mocks): add mock implementations for various repositories and se…
Benzbeeb Aug 28, 2025
88d4e37
Fix: get tx by hash (#166)
Poafs1 Sep 5, 2025
eea20a5
fix: tx struct (#167)
Poafs1 Sep 5, 2025
875f7ae
Fix tx reponse uploader (#168)
Benzbeeb Sep 12, 2025
bde7da1
fix: address hex lower (#169)
songwongtp Sep 17, 2025
7f1096f
feat: api address types (#170)
songwongtp Sep 22, 2025
b0ec450
Feat: add get txs by account (#171)
Poafs1 Sep 22, 2025
4dda9de
feat: initialize tracking with current state in indexer (#174)
Benzbeeb Oct 13, 2025
8fff7e9
Revert "feat: initialize tracking with current state in indexer (#174…
Benzbeeb Oct 14, 2025
b83d566
refactor: update database connection string and optimize block reposi…
Benzbeeb Oct 20, 2025
d971834
feat: initialize opinitTransactions in processor (#176) (#178)
Benzbeeb Nov 5, 2025
53d82bd
feat: enhance pagination and repository query handling (#177)
Benzbeeb Nov 6, 2025
6a6e88b
feat: enhance GetTxByHash to support multiple unmarshal attempts (#179)
Benzbeeb Nov 6, 2025
779b94d
feat: parse coins (#180)
songwongtp Nov 20, 2025
825a098
fix: update TxParseError message for clarity (#182)
Benzbeeb Nov 25, 2025
8f1c4f1
chore: update dependencies and remove opinit processor (#181)
Benzbeeb Nov 25, 2025
9535027
chore: update go.sum with dependency version changes (#183)
Benzbeeb Nov 25, 2025
c995d6e
chore: update Dockerfile to include go mod tidy before build (#184)
Benzbeeb Nov 25, 2025
c9be67e
Fix build error (#185)
Benzbeeb Nov 25, 2025
b304aa5
chore: update go.mod and go.sum with new indirect dependencies (#186)
Benzbeeb Nov 25, 2025
2a52e9d
chore: update go.mod and go.sum with new indirect dependencies (#187)
Benzbeeb Nov 25, 2025
ae4d61a
feat: implement patcher functionality and enhance indexing process (#…
Benzbeeb Dec 19, 2025
cc55538
fix update expidited (#189)
Benzbeeb Dec 19, 2025
b221261
modify cd workflow (#190)
LizJeong Dec 22, 2025
819bee2
feat: add tx response in informative (#191)
songwongtp Dec 23, 2025
3ac2b61
fix: add header (#192)
songwongtp Dec 23, 2025
7871bbe
fix: avg block time (#193)
songwongtp Jan 8, 2026
1803fbe
feat: implement Keybase service with caching for validator images (#194)
Benzbeeb Feb 18, 2026
756d9a7
Fix/validator cron unbonded (#198)
Benzbeeb Feb 23, 2026
6acffb9
feat: add bimg dependency for image processing (#199)
Benzbeeb Feb 23, 2026
34bd6f0
refactor: update validator image query to remove unnecessary conditio…
Benzbeeb Feb 23, 2026
8882599
fix: update Swagger documentation endpoint path (#201)
Benzbeeb Feb 27, 2026
e371414
chore: update Go modules and dependencies across multiple components …
Benzbeeb Apr 1, 2026
6620e70
chore: update Go module dependencies to latest versions (#204)
Benzbeeb Apr 1, 2026
17fcd94
chore: update MOVEVM_VERSION to v1.2.0 in multiple Dockerfiles (#205)
Benzbeeb Apr 1, 2026
53819aa
chore: update initia dependency to v1.4.2 across multiple modules (#206)
Benzbeeb Apr 2, 2026
955f385
chore: update initia dependency to v1.4.3 across multiple modules (#207)
Benzbeeb Apr 3, 2026
5d8ce2e
feat: implement custom memory-based LRU cache, add runtime debug metr…
songwongtp May 6, 2026
91e8088
fix: enhance error handling in GetBlock and GetBlockResults methods (…
Benzbeeb May 6, 2026
71e3236
refactor: replace utils.CountWithTimeout with db.CountWithTimeout acr…
Benzbeeb May 6, 2026
1cd889a
chore: remove hardcoded environment variables and clean up Helm chart…
songwongtp May 6, 2026
f20d185
fix: dependabot issues (#211)
songwongtp May 7, 2026
a8af40f
feat: separate pruner
songwongtp Feb 18, 2026
29e9f25
fix: pruner docker
songwongtp Feb 18, 2026
2472c5a
fix: sync once
songwongtp Feb 23, 2026
618f3d6
chore: update dependencies in go.mod
songwongtp May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 14 additions & 2 deletions .github/workflows/informative-indexer-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.7'
go-version: '1.23.7'
cache: true

- name: Run Tests
Expand Down Expand Up @@ -88,4 +88,16 @@ jobs:
body: '{ "event_type": "core_informative_indexer", "client_payload": { "network": "initia", "chain_id": "initiation-2", "sha_short": ${{ needs.push.outputs.sha_short }} } }'
timeout: 10000
log-response: true
retries: 3
retries: 3

- id: dispatch-interwoven-1
name: Dispatch to alleslabs/celatone-infrastructure for interwoven-1
uses: indiesdev/curl@v1.1
with:
url: https://api.github.com/repos/alleslabs/celatone-infrastructure/dispatches
method: "POST"
headers: '{ "Accept": "application/vnd.github.everest-preview+json", "Authorization": "token ${{ steps.token.outputs.github_token }}" }'
body: '{ "event_type": "core_informative_indexer", "client_payload": { "network": "initia", "chain_id": "interwoven-1", "sha_short": ${{ needs.push.outputs.sha_short }} } }'
timeout: 10000
log-response: true
retries: 3
65 changes: 65 additions & 0 deletions .github/workflows/unified-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Core Indexer Unified Deployment

on:
workflow_dispatch:
push:
tags:
- "v*"

env:
REGISTRY: ghcr.io

jobs:
docker:
name: build-image
runs-on: ubuntu-latest

strategy:
matrix:
service:
- { name: core-indexer-api, dockerfile: dockerfiles/Dockerfile.api }
- { name: event-indexer, dockerfile: dockerfiles/Dockerfile.event }
- { name: generic-indexer, dockerfile: dockerfiles/Dockerfile.generic }
- { name: informative-indexer, dockerfile: dockerfiles/Dockerfile.informative }
- { name: pruner, dockerfile: dockerfiles/Dockerfile.pruner }
- { name: sweeper, dockerfile: dockerfiles/Dockerfile.sweeper }
- { name: uploader, dockerfile: dockerfiles/Dockerfile.uploader }

env:
IMAGE_NAME: ${{ matrix.service.name }}
DOCKERFILE_NAME: ${{ matrix.service.dockerfile }}

permissions:
contents: read
packages: write

outputs:
tags: ${{ steps.meta.outputs.tags }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE_NAME }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_SHA=${{ github.sha }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,14 @@ __pycache__
venv
*.bin
.env

tmp

sweeper/sweeper
informative-indexer/informative-indexer
generic-indexer/generic-indexer

# Go binaries (e.g. from go build in api/)
api/api
event-indexer/event-indexer
tx-response-uploader/tx-response-uploader
118 changes: 103 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,117 @@
# Core Indexer

## Informative Indexer
## Components

### Components
### API
REST API service that provides endpoints for querying indexed blockchain data. Built with Fiber framework and includes comprehensive Swagger documentation.

**Sweeper** - Polls the RPC for new block data and submits it to the message queue.
**Features:**
- Account data queries
- Block information retrieval
- Module transaction tracking
- NFT data and transaction history
- Governance proposal information
- Transaction details and history
- Validator information and metrics
- Health check endpoints
- CORS support and request logging

**Flusher** - Consumes messages from the queue and processes them into the database.
### Event Indexer
Specialized indexer for blockchain events with comprehensive event tracking capabilities. Processes transaction events, block events, and Move smart contract events.

**Prunner** - Periodically prunes the database and stores backups in a cloud storage service.
**Features:**
- Transaction event processing and indexing
- Block finalization event capture
- Move smart contract event tracking
- Database migration management
- Data pruning with cloud storage backup
- Command-line interface with multiple modes

### Workflow Summary
**Commands:**
- `indexer` - Main indexing process
- `migrate` - Database migration operations
- `prunner` - Data pruning and archival

Each service runs continuously and must be executed together for the indexer to function properly.
### Generic Indexer
General-purpose blockchain data indexer with both continuous and scheduled processing capabilities. Handles comprehensive blockchain state tracking and account management.

**Features:**
- Continuous block processing
- Cron-based batch operations
- Account data indexing
- Block result processing
- Validator state tracking
- Batch insertion optimization
- Multi-mode operation support

**Commands:**
- `indexer` - Continuous indexing mode
- `indexercron` - Scheduled batch processing mode

### Informative Indexer
Comprehensive blockchain data processor with specialized module processors for different blockchain components. Features advanced state tracking and caching mechanisms.

**Features:**
- Modular processor architecture (auth, bank, IBC, move, OPinit, gov, staking)
- State tracking and management
- Data caching for performance optimization
- Genesis block processing
- Event processing utilities
- Validator uptime tracking
- Batch state updates

**Commands:**
- `indexer` - Main processing engine
- `migrate` - Database schema management

### Sweeper
High-performance data collection service that polls RPC endpoints for new blockchain data and distributes it via message queues.

**Features:**
- RPC endpoint polling
- Block data retrieval
- Message queue publishing
- Database migration on startup
- Error handling and retry logic
- Configurable polling intervals

### TX Response Uploader
Message queue consumer that processes transaction response data and uploads it to cloud storage systems with support for large message handling.

**Features:**
- Kafka message consumption
- Cloud storage integration (GCS)
- Claim check pattern support for large messages
- Dead letter queue error handling
- Retry mechanisms with exponential backoff
- Transaction response archival
- Sentry integration for monitoring

## Workflow Summary

The indexer ecosystem consists of multiple specialized services that work together to provide comprehensive blockchain data indexing and querying capabilities.

**Core Data Flow:**

1. **Sweeper** retrieves new block data from RPC endpoints and publishes it to message queues
2. **Indexers** (Event, Generic, Informative) consume messages and process blockchain data into the database
3. **API** serves the indexed data through REST endpoints
4. **TX Response Uploader** handles transaction response storage in cloud services
5. **Pruners** manage data lifecycle and storage optimization

**Sweeper**

1. Retrieves the latest indexed block from the database.
2. Fetches data for the next block using the RPC methods `/block` and `/block_results`.
3. Publishes the block data as a message to the message queue.
1. On startup, applies any pending database migrations.
2. Retrieves the latest indexed block from the database.
3. Fetches data for the next block using the RPC methods `/block` and `/block_results`.
4. Publishes the block data as a message to the message queue.

**Flusher**
**Indexers**

1. Subscribes to and reads messages from the queue.
2. Processes each message and inserts the data into the database.
1. Subscribe to and read messages from the queue.
2. Process each message using specialized processors for different blockchain modules.
3. Insert processed data into the database with batch operations for efficiency.
4. Handle state tracking and caching for optimized performance.

**Prunner**

Expand All @@ -34,6 +122,6 @@ Each service runs continuously and must be executed together for the indexer to
2. Uploads the data to a cloud storage service.
3. Deletes the fetched rows from the database.

### Running Locally
## Running Locally

Follow the guide for running the Informative Indexer with Docker: [dockerfiles/README.md](dockerfiles/README.md).
To run the Informative Indexer with Docker locally, follow this [guide](local/README.md).
5 changes: 5 additions & 0 deletions api/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_CONNECTION_STRING_RO=postgres://readonly:password@localhost:5432/initiation-2?sslmode=disable
ENVIRONMENT=local
CHAIN_ID=initiation-2
BUCKETS=newer-bucket-name,legacy-bucket-name
PORT=8080
72 changes: 72 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Core Indexer API

This is the API service for the Core Indexer project, built with Go Fiber.

## Prerequisites

- Go 1.21 or higher
- Git
- Air (for hot reloading)

## Setup

1. Install dependencies:

```bash
go mod download
```

2. Create a `.env` file in the root directory (optional):

```bash
PORT=8080
```

## Running the Application

### Development Mode (with Hot Reload)

To run the application with hot reload (recommended for development):

```bash
air
```

The server will automatically restart when you make changes to the code.

### Production Mode

To run the application without hot reload:

```bash
go run main.go
```

The server will start on port 3000 by default (or the port specified in your .env file).

## API Endpoints

- `GET /`: Welcome message
- `GET /indexer/swagger/*`: Swagger documentation

## Project Structure

```
api/
├── main.go # Application entry point
├── routes/ # Route definitions
│ └── routes.go
├── dto/ # Data Transfer Objects
│ └── nft.go
├── go.mod # Go module file
├── .air.toml # Air configuration
└── README.md # This file
```

## Development

To add new routes:

1. Create new handler functions in the appropriate package
2. Add the routes in `routes/routes.go`
3. Import and use the handlers in your routes
23 changes: 23 additions & 0 deletions api/apperror/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package apperror

// Common error messages
const (
ErrMsgBadRequest = "Invalid request"
ErrMsgUnauthorized = "Unauthorized"
ErrMsgNotFound = "Resource not found"
ErrMsgInternal = "Internal server error"
ErrMsgProposalId = "Proposal id is not a valid int32 integer"
ErrMsgBlocks = "Blocks argument is not a valid integer"
ErrMsgBlocksZero = "Blocks must be greater than 0"
ErrMsgBlocksRequired = "Blocks parameter is required"
ErrMsgModuleNotFound = "Module not found"
ErrMsgDuplicateStatus = "Duplicate status in query"
ErrMsgTxNotFound = "Transaction not found for hash %s"
ErrMsgNoValidTxFiles = "No valid transaction files found for hash %s"
ErrMsgInvalidLimit = "Limit must be between 1 and 1000"
ErrMsgLimitInteger = "Limit must be in integer format"
ErrMsgOffsetInteger = "Offset must be in integer format"
ErrMsgReverse = "Reverse must be a boolean"
ErrMsgCountTotal = "CountTotal must be a boolean"
ErrMsgHeightInteger = "Height must be in integer format"
)
Loading