Server backend for indexed ETH IPLD objects
Go to file
2022-11-14 23:09:45 -06:00
.github/workflows Optimize GQL and getBlock APIs (#201) 2022-11-04 10:02:09 +05:30
cmd Support debug_traceCall API (#192) 2022-09-21 17:15:03 +05:30
documentation Cerc refactor (#193) 2022-09-20 11:52:06 -04:00
environments Remove watched addresses fill service code 2022-05-23 10:37:59 +05:30
monitoring monitoring documentation, prometheus config, grafana dashboard 2020-10-21 15:38:48 +03:00
pkg Use new get_storage_at DB functions. 2022-11-14 23:09:45 -06:00
scripts Update transactions, receipts and logs queries (#173) 2022-07-12 13:40:45 +05:30
test Support debug_traceCall API (#192) 2022-09-21 17:15:03 +05:30
test_config Cerc refactor (#193) 2022-09-20 11:52:06 -04:00
version Optimize getLogs GQL API (#198) 2022-10-05 15:14:17 +05:30
.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
chain.json integration tests: fix issue with eth_call (pass chain config via json file to match geth chain config) 2021-04-23 12:46:35 +03:00
docker-compose.test.yml Remove dapptools and update test readme to use stack-orchestrator 2022-05-05 14:34:09 +05:30
docker-compose.yml Cerc refactor (#193) 2022-09-20 11:52:06 -04:00
Dockerfile Cerc refactor (#193) 2022-09-20 11:52:06 -04:00
entrypoint.sh Remove migration from dockerfile. 2021-10-13 12:18:31 +05:30
go.mod dependency updates for geth 1.10.26 (#204) 2022-11-08 15:38:40 -05:00
go.sum dependency updates for geth 1.10.26 (#204) 2022-11-08 15:38:40 -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 Cerc refactor (#193) 2022-09-20 11:52:06 -04:00
Makefile Optimize getLogs GQL API (#198) 2022-10-05 15:14:17 +05:30
README.md Cerc refactor (#193) 2022-09-20 11:52:06 -04: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 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.18)
  • 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/cerc-io/ipld-eth-server/v4

cd $GOPATH/src/github.com/cerc-io/ipld-eth-server/v4@v4.x.x

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
    graphql = true # $SERVER_GRAPHQL
    graphqlEndpoint = "" # $SERVER_GRAPHQL_ENDPOINT

[ethereum]
    chainID = "1" # $ETH_CHAIN_ID
    defaultSender = "" # $ETH_DEFAULT_SENDER_ADDR
    rpcGasCap = "1000000000000" # $ETH_RPC_GAS_CAP
    httpPath = "127.0.0.1:8545" # $ETH_HTTP_PATH
    nodeID = "arch1" # $ETH_NODE_ID
    clientName = "Geth" # $ETH_CLIENT_NAME
    genesisBlock = "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" # $ETH_GENESIS_BLOCK
    networkID = "1" # $ETH_NETWORK_ID

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, and can optionally be used to configure a remote eth node to forward cache misses to

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_call
eth_getBalance
eth_getStorageAt
eth_getCode
eth_getProof
eth_blockNumber
eth_getHeaderByNumber
eth_getHeaderByHash
eth_getBlockByNumber
eth_getBlockByHash
eth_getTransactionCount
eth_getBlockTransactionCountByHash
eth_getBlockTransactionCountByNumber
eth_getTransactionByHash
eth_getRawTransactionByHash
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getRawTransactionByBlockHashAndIndex
eth_getRawTransactionByBlockNumberAndIndex
eth_getTransactionReceipt
eth_getLogs
eth_getUncleCountByBlockHash
eth_getUncleCountByBlockNumber
eth_getUncleByBlockHashAndIndex
eth_getUncleByBlockNumberAndIndex

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

CLI Options and Environment variables

CLI Option Environment Variable Default Value Comment
database-hostname DATABASE_HOSTNAME localhost IPLD database host
database-port DATABASE_PORT 5432 IPLD database port
database-name DATABASE_NAME vulcanize_public IPLD database name
database-user DATABASE_USER IPLD database user
database-password DATABASE_PASSWORD IPLD database password
eth-server-graphql ETH_SERVER_GRAPHQL false If true enable Eth GraphQL Server
eth-server-graphql-path ETH_SERVER_GRAPHQLPATH If eth-server-graphql set to true, endpoint url for graphql server (host:port)
eth-server-http ETH_SERVER_HTTP true If true enable Eth HTTP JSON-RPC Server
eth-server-http-path ETH_SERVER_HTTPPATH If eth-server-http set to true, endpoint url for Eth HTTP JSON-RPC server (host:port)
eth-server-ws ETH_SERVER_WS false If true enable Eth WS JSON-RPC Server
eth-server-ws-path ETH_SERVER_WSPATH If eth-server-ws set to true, endpoint url for Eth WS JSON-RPC server (host:port)
eth-server-ipc ETH_SERVER_IPC false If true enable Eth IPC JSON-RPC Server
eth-server-ipc-path ETH_SERVER_IPC_PATH If eth-server-ws set to true, path for Eth IPC JSON-RPC server
ipld-server-graphql IPLD_SERVER_GRAPHQL false If true enable IPLD GraphQL Server
ipld-server-graphql-path IPLD_SERVER_GRAPHQLPATH If ipld-server-graphql set to true, endpoint url for graphql server (host:port)
ipld-postgraphile-path IPLD_POSTGRAPHILEPATH If ipld-server-graphql set to true, http url for postgraphile server on top of IPLD db
tracing-http-path TRACING_HTTPPATH If ipld-server-graphql set to true, http url for tracing server
tracing-postgraphile-path TRACING.POSTGRAPHILEPATH If ipld-server-graphql set to true, http url for postgraphile server on top of tracing db

Testing

Follow steps in test/README.md

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