Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx committed Jan 17, 2025
1 parent 9760679 commit de838fd
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
Binary file added .github/assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/grafana-dashboard-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 78 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
# PostgreSQL Gno indexer and dashboard
# TM2 Indexer

![TM2 Indexer](https://github.com/gnoverse/tm2-indexer/.github/assets/banner.png)

<img src="https://github.com/gnoverse/tm2-indexer/blob/master/.github/assets/banner.png?raw=true" width="400" height="400"/>

The TM2 Indexer is a robust and efficient indexing solution designed for Tendermint 2 based blockchain.
It provides developers and operators with fast, reliable access to blockchain data for analytics, monitoring, and integration with external systems.

## Features

### Grafana dashboards

![example grafana dashboard](https://github.com/gnoverse/tm2-indexer/blob/master/.github/assets/grafana-dashboard-1.png)

## Installation

### Prerequisites

- [Go](https://golang.org/) 1.22+
- A Tendermint 2.0 node endpoint
- [PostgreSQL](https://www.postgresql.org/) (or compatible database)

### Clone the Repository

```bash
$ git clone https://github.com/gnoverse/tm2-indexer.git
$ cd tm2-indexer
```

### Build the Project

```bash
$ go build ./cmd/tm2-indexer
# or
$ make build
```

### Run Tests

```bash
$ go test -v ./...
```

## Configuration

TM2 Indexer uses a configuration file to specify database connections, Tendermint node settings, and indexing options. Example configuration:

```yaml
[rpc]
endpoint = "http://localhost:26657"

[database]
endpoint = "postgresql://postgres:[email protected]:5432/tm2-indexer?sslmode=disable"

[chain]
[chain.validators]
core-val-01 = "g1xxxxxx"
core-val-02 = "g1yyyyyy"
core-val-03 = "g1zzzzzz"

[scrapper]
batch_write = 300
goro_block_parser = 32

buffer_chan_blocks = 1000
buffer_chan_heights = 10000
```

## Usage

### Running Locally

Start the indexer with your configuration file:

```bash
$ ./tm2-indexer -config config.yaml
```
5 changes: 5 additions & 0 deletions internal/db/schemas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ CREATE TABLE IF NOT EXISTS messages (

-- TODO: create a table events for all the emits data from BlockResults

CREATE INDEX IF NOT EXISTS idx_block_signatures_block_height_signed ON block_signatures (block_height, signed);
CREATE INDEX IF NOT EXISTS idx_blocks_height ON blocks (height);
CREATE INDEX IF NOT EXISTS idx_validators_validator_addr ON validators (validator_addr);

CREATE INDEX IF NOT EXISTS idx_blocks_time ON blocks(time);
CREATE INDEX IF NOT EXISTS idx_block_signatures_block_height ON block_signatures(block_height);
CREATE INDEX IF NOT EXISTS idx_block_signatures_validator_addr ON block_signatures(validator_addr);
Expand All @@ -75,3 +79,4 @@ CREATE INDEX IF NOT EXISTS idx_messages_tx_hash_index ON messages(tx_hash,
-- gave read only access to grafana user for dashboards
-- GRANT USAGE ON SCHEMA public to grafana;
-- GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana;

0 comments on commit de838fd

Please sign in to comment.