ETHCore is a comprehensive Go library that provides utilities and implementations for interacting with Ethereum networks. Developed by ethpandaops, it offers tools for both consensus and execution layer interactions, node discovery, and network analysis.
- Discovery v5 Protocol: Full implementation of Ethereum's discovery v5 protocol for finding peers
- Manual Discovery: Support for manually specified bootstrap nodes
- Flexible Interface: Pluggable discovery mechanisms through common interfaces
- Network Crawler: Connect to beacon nodes and crawl the network topology
- Status Monitoring: Request and track node status updates
- P2P Communication: Built on libp2p for robust peer-to-peer messaging
- Protocol Support: Implements beacon chain networking protocols
- Client Mimicry: Connect to execution layer nodes as a lightweight client
- RLPx Protocol: Full RLPx protocol implementation for execution layer communication
- Message Handling: Support for blocks, transactions, receipts, and other protocol messages
- Network Analysis: Tools for analyzing execution layer network behavior
- Multi-Network Support: Configurations for various Ethereum networks
- Fork Management: Handle Ethereum protocol upgrades and forks
- Serialization: Utilities for Ethereum data serialization/deserialization
- Client Utilities: Common functionality for building Ethereum clients
go get github.com/ethpandaops/ethcore
- Go 1.24.0 or higher
- Dependencies are managed via Go modules
import (
"context"
"github.com/ethpandaops/ethcore/pkg/discovery"
"github.com/ethpandaops/ethcore/pkg/discovery/disc_v5"
)
// Create a new Discovery v5 service
config := disc_v5.NewConfig()
discovery, err := disc_v5.New(ctx, config)
if err != nil {
log.Fatal(err)
}
// Start discovery
if err := discovery.Start(ctx); err != nil {
log.Fatal(err)
}
// Find nodes
nodes := discovery.FindNodes(ctx, 10)
import (
"github.com/ethpandaops/ethcore/pkg/consensus/mimicry/crawler"
)
// Create and start a beacon chain crawler
crawler := crawler.New(crawlerConfig)
if err := crawler.Start(ctx); err != nil {
log.Fatal(err)
}
import (
"github.com/ethpandaops/ethcore/pkg/execution/mimicry"
)
// Connect to an execution layer node
client := mimicry.New(executionConfig)
if err := client.Connect(ctx, nodeAddress); err != nil {
log.Fatal(err)
}
ethcore/
βββ pkg/
β βββ consensus/ # Consensus layer implementations
β β βββ mimicry/ # Beacon chain client mimicry
β βββ discovery/ # Node discovery protocols
β β βββ disc_v5/ # Discovery v5 implementation
β β βββ manual/ # Manual peer discovery
β βββ ethereum/ # Core Ethereum utilities
β β βββ beacon/ # Beacon chain utilities
β β βββ clients/ # Client implementations
β β βββ config/ # Configuration management
β β βββ fork/ # Fork handling
β β βββ networks/ # Network configurations
β β βββ serialize/ # Serialization utilities
β βββ execution/ # Execution layer implementations
β βββ mimicry/ # Execution client mimicry
# Run all tests
go test ./...
# Run tests with race detection
go test -race ./...
# Run tests with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run linter
golangci-lint run