Skip to content

discv5::discv5Config

Configuration for the discv5 client and crawler. More...

#include <discv5_types.hpp>

Public Attributes

Name
std::string bind_ip
Bind address for the local UDP socket.
uint16_t bind_port
UDP port to bind. 0 → OS-assigned ephemeral port.
uint16_t tcp_port
TCP port advertised to peers (for RLPx dial-back).
std::array< uint8_t, kPrivateKeyBytes > private_key
secp256k1 private key (32 bytes). Must be set before start().
NodeId public_key
secp256k1 public key (64 bytes, uncompressed, no 0x04 prefix).
std::vector< std::string > bootstrap_enrs
Bootstrap ENR URI strings ("enr:…"). At least one is required.
size_t max_concurrent_queries
Maximum number of concurrent FINDNODE queries.
uint32_t query_interval_sec
Seconds between full crawler sweeps.
uint32_t peer_expiry_sec
Seconds before a discovered peer is considered stale and evicted.
std::optional< ForkId > required_fork_id

Detailed Description

struct discv5::discv5Config;

Configuration for the discv5 client and crawler.

All numeric fields default to the values defined in discv5_constants.hpp.

Public Attributes Documentation

variable bind_ip

std::string bind_ip = "0.0.0.0";

Bind address for the local UDP socket.

variable bind_port

uint16_t bind_port = kDefaultUdpPort;

UDP port to bind. 0 → OS-assigned ephemeral port.

variable tcp_port

uint16_t tcp_port = kDefaultTcpPort;

TCP port advertised to peers (for RLPx dial-back).

variable private_key

std::array< uint8_t, kPrivateKeyBytes > private_key {};

secp256k1 private key (32 bytes). Must be set before start().

variable public_key

NodeId public_key {};

secp256k1 public key (64 bytes, uncompressed, no 0x04 prefix).

variable bootstrap_enrs

std::vector< std::string > bootstrap_enrs {};

Bootstrap ENR URI strings ("enr:…"). At least one is required.

variable max_concurrent_queries

size_t max_concurrent_queries = kDefaultMaxConcurrent;

Maximum number of concurrent FINDNODE queries.

variable query_interval_sec

uint32_t query_interval_sec = kDefaultQueryIntervalSec;

Seconds between full crawler sweeps.

variable peer_expiry_sec

uint32_t peer_expiry_sec = kDefaultPeerExpirySec;

Seconds before a discovered peer is considered stale and evicted.

variable required_fork_id

std::optional< ForkId > required_fork_id {};

When set, only peers whose ENR "eth" entry matches this fork are forwarded to the peer-discovered callback.


Updated on 2026-04-13 at 23:22:46 -0700