ethcore

module
v0.0.0-...-d6e472d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: MIT

README

ETHCore

Go Reference codecov Go Report Card License

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.

Features

Node Discovery
  • 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
Consensus Layer (Beacon Chain)
  • 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
Execution Layer
  • 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
Ethereum Utilities
  • 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

Installation

go get github.com/ethpandaops/ethcore

Requirements

  • Go 1.24.0 or higher
  • Dependencies are managed via Go modules

Usage Examples

Using the Discovery Service
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)
Consensus Layer Crawler
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)
}
Execution Layer Client
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)
}

Project Structure

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

Development

Running Tests
# Run all tests
make test
Linting
# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

# Run linter
golangci-lint run

Directories

Path Synopsis
pkg
consensus/mimicry/p2p/eth
Package eth provides Ethereum consensus layer p2p communication utilities.
Package eth provides Ethereum consensus layer p2p communication utilities.
consensus/mimicry/p2p/eth/examples
Package examples provides practical examples of using the eth p2p library.
Package examples provides practical examples of using the eth p2p library.
consensus/mimicry/p2p/pubsub/v1
Package v1 provides a type-safe, production-ready wrapper around libp2p's gossipsub implementation, specifically designed for Ethereum consensus layer communication.
Package v1 provides a type-safe, production-ready wrapper around libp2p's gossipsub implementation, specifically designed for Ethereum consensus layer communication.
ethereum
Package ethereum provides Ethereum beacon node functionality
Package ethereum provides Ethereum beacon node functionality
ethereum/node/enr
Package enr provides utilities for parsing and extracting data from Ethereum Node Records (ENR).
Package enr provides utilities for parsing and extracting data from Ethereum Node Records (ENR).
execution/mimicry
eth protocol block bodies https://github.com/ethereum/devp2p/blob/master/caps/eth.md#blockbodies-0x06
eth protocol block bodies https://github.com/ethereum/devp2p/blob/master/caps/eth.md#blockbodies-0x06
testutil/kurtosis
Package kurtosis provides shared test utilities for managing Kurtosis networks across the ethcore test suite.
Package kurtosis provides shared test utilities for managing Kurtosis networks across the ethcore test suite.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL