MCPcopy Index your code
hub / github.com/ChainSafe/nodewatch-api

github.com/ChainSafe/nodewatch-api @v1.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.0 ↗ · + Follow
524 symbols 1,349 edges 36 files 87 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Eth2 Crawler

Eth2 Crawler is Ethereum blockchain project that extracts eth2 node information from the network save it to the datastore. It also exposes a graphQL interface to access the information saved in the datastore.

Getting Started

There are three main components in the project: 1. Crawler: crawls the network for eth2 nodes, extract additional information about the node and save it to the datastore 2. MongoDB: datastore to save eth2 nodes information 3. GraphQL Interface: provide access the stored information

Prerequisites

  • docker
  • docker-compose

Environment Setup

Before building, please make sure environment variables RESOLVER_API_KEY(which is used to fetch information about node using IP) is setup properly. You can get your key from IP data dashboard. To setup the variable, create an .env in the same folder as of docker-compose.yaml

Example .env File

RESOLVER_API_KEY=your_ip_data_key

Configs and Flags

Eth2 crawler support config through yaml files. Default yaml config is provided at cmd/config/config.dev.yaml. You can use your own config file by providing it's path using the -p flag

Usage

We use docker-compose for testing locally. Once you have defined the environment variable in the .env file, you can start the server using:

make run

Additional Commands

  • make run - run the crawler service
  • make lint - run linter
  • make test - runs the test cases
  • make license - add license to the missing files
  • make license-check - checks for missing license headers

LICENSE

See the LICENSE file for license rights and limitations (lgpl-3.0).

Extension points exported contracts — how you extend this code

Host (Interface)
Host represent p2p services [1 implementers]
crawler/p2p/host.go
Provider (Interface)
Provider represents store provider interface that can be implemented by different DB engines
store/record/store.go
Provider (Interface)
Provider represents store provider interface that can be implemented by different DB engines
store/peerstore/store.go
RequestPayloadHandler (FuncType)
RequestPayloadHandler processes a request (decompressed if previously compressed), read from r. The handler can respond
crawler/rpc/request/handle_request.go
Provider (Interface)
(no doc)
resolver/resolver.go
ResponseChunkHandler (FuncType)
ResponseChunkHandler is a function that processes a response chunk. The index, size and result-code are already parsed.
crawler/rpc/request/handle_response.go
ResponseHandler (FuncType)
ResponseHandler processes a response by internally processing chunks, any error is propagated up.
crawler/rpc/request/handle_response.go
Codec (Interface)
(no doc) [1 implementers]
crawler/rpc/request/rpc_method.go

Core symbols most depended-on inside this repo

Decode
called by 14
crawler/rpc/request/rpc_method.go
String
called by 9
models/peer.go
Close
called by 8
crawler/rpc/request/encode.go
AddPeerFilterToQueryPipeline
called by 7
store/peerstore/mongo/mongo.go
String
called by 6
crawler/util/util.go
Write
called by 5
crawler/rpc/request/encode.go
MaxEncodedLen
called by 4
crawler/rpc/request/compression.go
EncodeHeaderAndPayload
called by 4
crawler/rpc/request/encode.go

Shape

Method 384
Function 53
Struct 49
Interface 17
FuncType 11
TypeAlias 10

Languages

Go100%

Modules by API surface

graph/generated/generated.go250 symbols
crawler/rpc/request/rpc_method.go62 symbols
store/peerstore/mongo/mongo.go20 symbols
models/peer.go20 symbols
crawler/crawl/crawl.go15 symbols
crawler/util/util.go14 symbols
store/peerstore/store.go13 symbols
graph/schema.resolvers.go13 symbols
crawler/rpc/request/encode.go13 symbols
crawler/p2p/host.go13 symbols
crawler/rpc/request/compression.go10 symbols
graph/model/models_gen.go8 symbols

Datastores touched

(mongodb)Database · 1 repos

For agents

$ claude mcp add nodewatch-api \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact