8000 GitHub - ethpandaops/ethcore: 🌏 Go library for Ethereum network interactions - consensus/execution layers, node discovery, and network analysis tools
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🌏 Go library for Ethereum network interactions - consensus/execution layers, node discovery, and network analysis tools

License

Notifications You must be signed in to change notification settings

ethpandaops/ethcore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

93 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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
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

Linting

# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

# Run linter
golangci-lint run

About

🌏 Go library for Ethereum network interactions - consensus/execution layers, node discovery, and network analysis tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 5

Languages

0