Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
020ee3d
Merge pull request #24 from telosnetwork/master
tomtomcrypto Jan 28, 2023
69292bc
incremental pooling, api improvments, refactor
tomtomcrypto Jan 28, 2023
36ebc53
fix
tomtomcrypto Jan 28, 2023
bb5745f
Fix merge
tomtomcrypto Jan 28, 2023
5c0bb1d
Update TelosHandler.ts
tomtomcrypto Jan 28, 2023
d28717d
Update TokenPoller.ts
tomtomcrypto Jan 28, 2023
258b13d
db connection fix, rpc query fix, misc fixes & ref
tomtomcrypto Jan 30, 2023
1ae5cf8
fixed db connection ending unexpectedly
tomtomcrypto Jan 31, 2023
419c12b
voter time fix
tomtomcrypto Feb 1, 2023
1cfab57
sample env
tomtomcrypto Feb 1, 2023
7749113
Delete yarn-error.log
tomtomcrypto Feb 1, 2023
6ddad77
Delete package-lock.json
tomtomcrypto Feb 1, 2023
3b054c3
Delete yarn.lock
tomtomcrypto Feb 1, 2023
5b78db7
added balance cleanup after dotoken
tomtomcrypto Feb 1, 2023
2c16f31
Merge branch 'incremental' of https://github.com/telosnetwork/obe-ind…
tomtomcrypto Feb 1, 2023
fb0bc7a
README update
tomtomcrypto Feb 1, 2023
4ffde58
README update
tomtomcrypto Feb 1, 2023
330ee69
README update
tomtomcrypto Feb 1, 2023
793f52e
API fix for holders & delegations
tomtomcrypto Feb 2, 2023
abc8c12
added totalVoters & totalHolders to respective API routes
tomtomcrypto Feb 3, 2023
3ebe2b9
fixed incremental delegations amounts conversions
tomtomcrypto Feb 3, 2023
5ee4ea2
removed chain tag
tomtomcrypto Feb 3, 2023
c35a27f
Update README.md
tomtomcrypto Feb 3, 2023
695efeb
Update README.md
tomtomcrypto Feb 3, 2023
1d31bbe
Update README.md
tomtomcrypto Feb 3, 2023
2325dfe
added toWei util, fix conversion
tomtomcrypto Feb 3, 2023
cfb409b
Merge branch 'incremental' of https://github.com/telosnetwork/obe-ind…
tomtomcrypto Feb 3, 2023
270b898
fix undelegatebw comparaison
tomtomcrypto Feb 3, 2023
4dff0a3
made base antelope currency configurable
tomtomcrypto Feb 3, 2023
52639a0
added voters/{voter} route
tomtomcrypto Feb 5, 2023
569a32a
added producers tag to differentiate from voters route
tomtomcrypto Feb 5, 2023
53eccf6
removed env file, ref config load, added base currency config in API
tomtomcrypto Feb 6, 2023
49dd1f8
more network variables display, added documentationUrl, better config…
tomtomcrypto Feb 6, 2023
1f11c39
fixed parameter not used in SQL query (hardcoded)
tomtomcrypto Feb 6, 2023
68906f8
ref, type casting sql results
tomtomcrypto Feb 7, 2023
19483f4
removed actions limit, fix, ref
tomtomcrypto Feb 7, 2023
bb17853
ref action block ISO
tomtomcrypto Feb 7, 2023
b3949da
added block offset back, ref, misc
tomtomcrypto Feb 7, 2023
a21fd74
ref action last block save (since removed limit)
tomtomcrypto Feb 7, 2023
eedd4c6
enforced 404 on missing ressources
tomtomcrypto Feb 8, 2023
0ee0cb1
refactor db pool creation, logger log level load
tomtomcrypto Feb 8, 2023
73618ee
ref, test stub
tomtomcrypto Feb 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
INDEXER_LOG_LEVEL=debug
API_LOG_LEVEL=info
MODE=dev
89 changes: 46 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
# YAAI - Yet Another Antelope Indexer
# OBE Indexer - Antelope Indexer for Open Block Explorer

This is an Antelope indexer developed for our [Open Block Explorer](https://github.com/telosnetwork/open-block-explorer)

## Requirement

This repository's instructions requires Docker to be installed but alternatively you can install Postgres without it.

## Developer Setup

### Docker
**Install node v.16**

```curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -```
```sudo apt-get install -y nodejs```

**Clone the OBE Indexer**

```git clone https://github.com/telosnetwork/obe-indexer```

**Copy example.config.json to config.json and edit it for your DB, Hyperion and Nodeos connection.**

Make sure to note the default port for psql is 5432. The config in git is set differently for the docker dev version. Also be sure the `nodeosUrl` is pointed to your node running in irreversible mode.

```read-mode = irreversible```

**Install Yarn**

```sudo npm install --global yarn```

**Install Dependencies**

```yarn ```

**Setup postgres**

Using `bash runDockerPostgres.sh` or

```bash
docker run \
Expand All @@ -14,69 +45,41 @@ docker run \
postgres
```

Then connect `psql -U postgres -h localhost -p 5455` and create the db
Then connect `psql -U postgres -h localhost -p 5455` and create the database and privileged user by pasting the following snippet:

```postgresql
CREATE DATABASE obeindex;
CREATE USER obe WITH ENCRYPTED PASSWORD 'obe';
GRANT ALL PRIVILEGES ON DATABASE obeindex to obe;
```

Now paste all the tables in there and create those too, or write a script and put it
Now paste all the tables defined in `src/tables` and create those too, or write a script to do it

```bash
HERE
```

## Operator Setup
## Nodeos Setup

Nodeos Setup:
The OBE Indexer does not have functionality for handeling forks so it must be pointed at a nodeos instance running in irreversible mode. More on that can be read here: https://developers.eos.io/manuals/eos/v2.2/nodeos/features/storage-and-read-modes
The OBE Indexer does not have functionality for handling forks so it must be pointed at a nodeos instance running in irreversible mode. More on that can be read here: https://developers.eos.io/manuals/eos/v2.2/nodeos/features/storage-and-read-modes

Within your nodeos config.ini file you will use with the indexer, be sure to include the option:
```read-mode = irreversible```

Install node v.16
```curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -```
```sudo apt-get install -y nodejs```

Install jq
```sudo apt install jq```

Install Postgresql
```sudo apt install postgresql postgresql-contrib```

Edit pg_hba.conf to allow password access locally
```sudo vi /etc/postgresql/14/main/pg_hba.conf```

Change the below line under "local" to password from peer.
```# "local" is for Unix domain socket connections only
local all all password
```

Elevate to psql console
```sudo -u postgres psql```
```read-mode = irreversible```

Create user and database:
```create user USER with encrypted password 'PASSWORD';```
```create database DBNAME;```
```grant all privileges on database yaai to yaai;```
## Build
Build the Indexer with

Clone the OBE Indexer
```git clone https://github.com/telosnetwork/obe-indexer```

Import tables as the DB user you just created using https://github.com/telosnetwork/obe-indexer/blob/master/src/tables/tokens.sql
```yarn run build```

Copy example.config.json to config.json and edit it for your DB, Hyp and Nodeos connection. Make sure to note the default port for psql is 5432. The config in git is set differently for the docker dev version. Also be sure the `nodeosUrl` is pointed to your node running in irreversible mode.
## Run
Run the Indexer with

Install Yarn
```sudo npm install --global yarn```
```nohup node dist/indexer.js > obeIndexer.log 2>&1 &```

Buld the Indexer
```yarn run build```
Run the API with

Run the Indexer
```nohup node dist/indexer.js > obeIndexer.log 2>&1 &```
```nohup node dist/api.js > obeApi.log 2>&1 &```



52 changes: 36 additions & 16 deletions example.config.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
{
"networkName": "telos-mainnet",
"apiPort": 5000,
"apiAddress": "0.0.0.0",
"apiHost": "localhost:5000",
"apiProtocols": ["https", "http"],
"apiInstances": 4,
"tokenListUrl": "https://raw.githubusercontent.com/telosnetwork/token-list/main/telosmain.json",
"nodeosUrl": "https://mainnet.telos.net",
"hyperionUrl": "https://mainnet.telos.net",
"dbHost": "localhost",
"dbPort": 5455,
"dbName": "obeindex",
"dbUser": "obe",
"dbPass": "obe"
}
{
"indexerLogLevel": "debug",
"apiLogLevel": "debug",
"mode": "dev",
"apiVersion": "1.0.0",
"networkName": "telos-mainnet",
"displayNetworkName": "Telos",
"documentationUrl": "https://docs.telos.net",
"baseCurrencyContract": "eosio.token",
"baseCurrencySymbol": "TLOS",
"baseCurrencyDecimals": 4,
"apiPort": 5555,
"apiAddress": "0.0.0.0",
"apiHost": "localhost:5555",
"apiProtocols": ["http"],
"apiInstances": 4,
"tokenListUrl": "https://raw.githubusercontent.com/telosnetwork/token-list/main/telosmain.json",
"nodeosUrl": "https://telos.caleos.io",
"hyperionUrl": "https://telos.caleos.io",
"dbHost": "localhost",
"dbPort": 5432,
"dbName": "obeindex",
"dbUser": "obe",
"dbPass": "obe",
"dbMaximumPoolSize": 50,
"dbConnectionRetries": 5,
"dbConnectionTimeout": 30000,
"hyperionIncrementLimit": 1000,
"fetchRetryCount": 100,
"fetchRetryDelay": 1000,
"tokenListInterval": 120,
"tokenPollInterval": 2,
"rexPollInterval": 2,
"voterPollInterval": 2,
"bpPollInterval": 720
}
171 changes: 0 additions & 171 deletions package-lock.json

This file was deleted.

Loading