https://github.com/maticnetwork/ethstats-backend
Ethstats Backend collects ethstats data from Bor and stores important metrics in postgresDB. Comes bundled with Hasura for better querying capabilities.
https://github.com/maticnetwork/ethstats-backend
Last synced: about 1 year ago
JSON representation
Ethstats Backend collects ethstats data from Bor and stores important metrics in postgresDB. Comes bundled with Hasura for better querying capabilities.
- Host: GitHub
- URL: https://github.com/maticnetwork/ethstats-backend
- Owner: maticnetwork
- Created: 2021-11-09T14:37:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-13T08:59:37.000Z (about 3 years ago)
- Last Synced: 2025-04-19T10:28:09.928Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 112 KB
- Stars: 8
- Watchers: 4
- Forks: 11
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ethstats-server
## Development
Run postgresql (user=postgresql(default), pass=postgrespassword):
```
$ make postgresql-test
```
Run postgresql admin panel (email=postgres@gmail.com, pass=postgrespassword, http=localhost:80):
```
$ make postgresql-test-admin
```
Run ethstats backend:
```
$ go run main.go server \
--collector.secret secret \
--db-endpoint "postgres://postgres:postgrespassword@127.0.0.1:5432/postgres?sslmode=disable" \
--frontend.addr ws://localhost:3000/api \
--frontend.secret secret2
```
Start geth client:
```
$ geth --dev --dev.period 1 --ethstats a:secret@localhost:8000
```
Run ethstats frontend ([goerli/ethstats-server repo](https://github.com/goerli/ethstats-server)):
```
$ npm ci
$ grunt poa
$ WS_SECRET="secret2" npm start
```
## Flags
- db-endpoint: Database endpoint to store the data.
- collector.addr (default=localhost:8000): Websocket address to collect metrics.
- collector.secret (default=''): Secret for the local websocket collector.
- log-level (default=info): Level to log the output.
- frontend.addr: Address of the ethstats frontend to proxy the data.
- frontend.secret: Secret to be used in the ethstats proxy.
- save-block-txs: Whether block transactions should be written to database.
## Run local docker compose environment
- ``` git clone https://github.com/maticnetwork/reorgs-frontend.git```
- ```cd reorgs-frontend```
- ```git checkout localhost```
- ```sudo docker build -t ethstats-frontend .```
- ```cd ..```
- ```sudo docker build -t ethstats-backend .```
- ```docker-compose up -d```
- go to ```localhost:8080``` to see the hasura frontend
- click on ```settings``` on top-right corner
- click on ```import metadata```
- select ```hasura_metadata_example.json``` from the root directory of this repo
- go to ```localhost:3000``` to see the frontend
### Add ethstats flag in bor commands to send bor data to ethstats-backend
- ```--ethstats :@:```
- for local setup : ```--ethstats node1:hello@localhost:8000```