Server backend for indexed ETH IPLD objects
Go to file
Ramil Amerzyanov df1a233028
Merge pull request #15 from n0cte/metrics
Metrics and http server
2020-10-21 19:42:04 +03:00
.github/workflows github actions (pull request, master, release) 2020-09-07 16:31:18 +03:00
cmd monitoring documentation, prometheus config, grafana dashboard 2020-10-21 15:38:48 +03:00
db update migrations; update go modules 2020-10-20 21:12:59 -05:00
documentation continue refactor/purge 2020-09-01 16:15:31 -05:00
environments fixes after dirty rebase; canonical hash/header finder function is in this commit now 2020-10-20 15:36:51 -05:00
monitoring monitoring documentation, prometheus config, grafana dashboard 2020-10-21 15:38:48 +03:00
pkg monitoring documentation, prometheus config, grafana dashboard 2020-10-21 15:38:48 +03:00
scripts update deps/paths/names 2020-08-31 10:52:47 -05:00
test_config updat dep and serve cmd 2020-09-02 10:19:25 -05:00
version 'bump' version (alight with next tagged release) 2020-10-20 16:03:00 -05:00
.dockerignore Add container service files and docker README 2019-02-11 11:26:12 +01:00
.gitignore update deps/paths/names 2020-08-31 10:52:47 -05:00
docker-compose.yml fix postgraphile image tag 2020-09-09 23:04:15 +03:00
Dockerfile docker compose for dapptools, postgraphile, eth-indexer and eth-server 2020-09-06 12:32:11 +03:00
entrypoint.sh remove unused commented lines 2020-09-09 23:06:43 +03:00
go.mod Merge remote-tracking branch 'remotes/vulc/master' into metrics 2020-10-21 13:53:38 +03:00
go.sum update migrations; update go modules 2020-10-20 21:12:59 -05:00
LICENSE Edits to address PR issues; change license from apache to AGPL; and work 2018-11-15 12:32:52 -06:00
main.go watch => serve 2020-08-31 10:59:41 -05:00
Makefile docker compose for dapptools, postgraphile, eth-indexer and eth-server 2020-09-06 12:32:11 +03:00
README.md monitoring documentation, prometheus config, grafana dashboard 2020-10-21 15:38:48 +03:00

ipld-eth-server

Go Report Card

ipld-eth-server is the server backend for indexed ETH IPLD objects

Table of Contents

  1. Background
  2. Install
  3. Usage
  4. Contributing
  5. License

Background

NOTE: WIP

ipld-eth-server is used to service queries against the indexed Ethereum IPLD objects indexed by ipld-eth-indexer.

It exposes standard Ethereum JSON RPC endpoints on top of the database, in some cases these endpoints can leverage the unique indexes to improve query performance. Additional, unique endpoints are exposed which utilize the new indexes and state diff data objects.

Dependencies

Minimal build dependencies

  • Go (1.13)
  • Git
  • GCC compiler
  • This repository

External dependency

Install

Start by downloading ipld-eth-server and moving into the repo:

GO111MODULE=off go get -d github.com/vulcanize/ipld-eth-server

cd $GOPATH/src/github.com/vulcanize/ipld-eth-server

Then, build the binary:

make build

Usage

After building the binary, run as

./ipld-eth-server serve --config=<the name of your config file.toml>

Configuration

Below is the set of parameters for the ipld-eth-server command, in .toml form, with the respective environmental variables commented to the side. The corresponding CLI flags can be found with the ./ipld-eth-server serve --help command.

[database]
    name     = "vulcanize_public" # $DATABASE_NAME
    hostname = "localhost" # $DATABASE_HOSTNAME
    port     = 5432 # $DATABASE_PORT
    user     = "postgres" # $DATABASE_USER
    password = "" # $DATABASE_PASSWORD

[log]
    level = "info" # $LOGRUS_LEVEL

[server]
    ipcPath = "~/.vulcanize/vulcanize.ipc" # $SERVER_IPC_PATH
    wsPath = "127.0.0.1:8081" # $SERVER_WS_PATH
    httpPath = "127.0.0.1:8082" # $SERVER_HTTP_PATH

[ethereum]
    chainID = "1" # $ETH_CHAIN_ID
    defaultSender = "" # $ETH_DEFAULT_SENDER_ADDR

The database fields are for connecting to a Postgres database that has been/is being populated by ipld-eth-indexer. The server fields set the paths for exposing the ipld-eth-server endpoints The ethereum fields set the chainID and default sender address to use for EVM simulation

Endpoints

IPLD subscription

TODO: Port the IPLD RPC subscription endpoints after the decoupling

Ethereum JSON-RPC

ipld-eth-server currently recapitulates portions of the Ethereum JSON-RPC api standard.

The currently supported standard endpoints are:
eth_blockNumber
eth_getLogs
eth_getHeaderByNumber
eth_getBlockByNumber
eth_getBlockByHash
eth_getTransactionByHash

TODO: Add the rest of the standard endpoints add unique endpoints (e.g. getSlice)

Testing

make test will run the unit tests
make test setups a clean vulcanize_testing db

Monitoring

  • Enable http server and metrics using parameters --http --metrics
  • ipld-eth-server exposes prometheus metrics at /metric endpoint
  • start prometheus using monitoring/prometheus.yml config (prometheus --config.file=monitoring/prometheus.yml)
  • start grafana, connect to prometheus datasource and import dashboard from monitoring/grafana/dashboard_main.json

Contributing

Contributions are welcome!

VulcanizeDB follows the Contributor Covenant Code of Conduct.

License

AGPL-3.0 © Vulcanize Inc