Skip to content

Latest commit

 

History

History
130 lines (101 loc) · 6.19 KB

discovery.md

File metadata and controls

130 lines (101 loc) · 6.19 KB

Discovery

Client that uses go-ethereum's implementation of Node Discovery Protocol v5 and Node Discovery Protocol v4 to discover ethereum nodes around the network and send them to a xatu server. If xatu P2P configuration is used, the client will periodically update the discovery boot nodes from the xatu server.

The client also requests a list of execution layer node records from the xatu server and tries to connect. If the connection is successful it sends data back to the xatu server with a summary of the RLPx hello and Etherum Wire Protocol status responses from the peer.

Table of contents

Usage

Discovery requires a config file.

Usage:
  xatu discovery [flags]

Flags:
      --config string   config file (default is discovery.yaml) (default "discovery.yaml")
  -h, --help            help for discovery

Requirements

At least one Server running with the Coordinator service enabled.

Configuration

Discovery requires a single yaml config file. An example file can be found here

Name Type Default Description
logging string warn Log level (panic, fatal, warn, info, debug, trace)
metricsAddr string :9090 The address the metrics server will listen on
pprofAddr string The address the pprof server will listen on. When ommited, the pprof server will not be started
coordinator object Coordinator configuration
coordinator.address string The address of the xatu server
coordinator.maxQueueSize int 51200 The maximum queue size to buffer node records for delayed processing. If the queue gets full it drops the node records
coordinator.batchTimeout string 5s The maximum duration for constructing a batch. Processor forcefully sends available node records when timeout is reached
coordinator.exportTimeout string 30s The maximum duration for exporting node records. If the timeout is reached, the export will be cancelled
coordinator.maxExportBatchSize int 512 MaxExportBatchSize is the maximum number of node records to process in a single batch. If there are more than one batch worth of node records then it processes multiple batches of node records one batch after the other without any delay
coordinator.concurrentExecutionPeers string 100 Max number of simultaneous executions that will be dialed
p2p.type string Type of output (xatu, static)
p2p.config object P2P type configuration xatu/static

P2P xatu configuration

P2P configuration to get node records to discover from the Xatu server coordinator.

Name Type Default Description
p2p.config.address string The address of the server receiving events
p2p.config.tls bool Server requires TLS
p2p.config.headers object A key value map of headers to append to requests
p2p.config.discV4 bool true enable Node Discovery Protocol v4 Note: both Node Discovery Protocol v4 and v5 can be enabled at the same time
p2p.config.discV5 bool true enable Node Discovery Protocol v5 Note: both Node Discovery Protocol v4 and v5 can be enabled at the same time
p2p.config.restart string 2m Time between initiating discovery scans and fetching new node record, will generate a fresh private key each time
p2p.config.networkIds array List of network ids to filter node records by (decimal format, eg. '1' for mainnet)
p2p.config.forkIdHashes array List of Fork ID hash to filter node records by (hex string)

P2P static configuration

P2P configuration to statically set discovery node records (boot nodes).

Name Type Default Description
p2p.config.discV4 bool true enable Node Discovery Protocol v4 Note: both Node Discovery Protocol v4 and v5 can be enabled at the same time
p2p.config.discV5 bool true enable Node Discovery Protocol v5 Note: both Node Discovery Protocol v4 and v5 can be enabled at the same time
p2p.config.restart string 2m Time between initiating discovery scans, will generate a fresh private key each time
p2p.config.bootNodes array List of boot nodes to connect to

Simple Static Example

logging: info
metricsAddr: :9090
pprofAddr: :6060

coordinator:
  address: localhost:8080
  concurrentExecutionPeers: 100

p2p:
  type: static
  config:
    discV4: true
    discV5: true
    restart: 2m
    bootNodes:
      - enr:-Jq4QItoFUuug_n_qbYbU0OY04-np2wT8rUCauOOXNi0H3BWbDj-zbfZb7otA7jZ6flbBpx1LNZK2TDebZ9dEKx84LYBhGV0aDKQtTA_KgEAAAD__________4JpZIJ2NIJpcISsaa0ZiXNlY3AyNTZrMaEDHAD2JKYevx89W0CcFJFiskdcEzkH_Wdv9iW42qLK79ODdWRwgiMo

Simple Xatu Example

logging: info
metricsAddr: :9090
pprofAddr: :6060

coordinator:
  address: localhost:8080
  concurrentExecutionPeers: 100

p2p:
  type: xatu
  config:
    address: localhost:8080
    discV4: true
    discV5: true
    restart: 2m
    networkIds: [1]
    forkIdHashes: [0xf0afd0e3]

Running locally

# docker
docker run -d --name xatu-discovery -v $HOST_DIR_CHANGE_ME/config.yaml:/opt/xatu/config.yaml -p 9090:9090 -it ethpandaops/xatu:latest discovery --config /opt/xatu/config.yaml
# build
go build -o dist/xatu main.go
./dist/xatu discovery --config discovery.yaml
# dev
go run main.go discovery --config discovery.yaml