Agent skill

Devp2p Peer Discovery

by Nethereum in Nethereum/Nethereum

Help users discover Ethereum peer addresses over devp2p when they don't have an enode:// URL yet — discv4 Kademlia UDP discovery, discv5 authenticated discovery, DNS ENR-tree bootstrapping…

MITAuto-check passedBackend & APIs

Install Devp2p Peer Discovery

skills CLI
$ npx skills add Nethereum/Nethereum --skill devp2p-peer-discovery -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Nethereum/Nethereum devp2p-peer-discovery --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Nethereum/Nethereum.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/nethereum-skills/skills/devp2p-peer-discovery .claude/skills/devp2p-peer-discovery && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
devp2p-peer-discovery
GitHub stars
2.3k
Token cost
~2.7k tokens
SKILL.md length
1,044 words
Files
1
Skills in repo
71
Repo updated
First seen
Licence
MIT

At a glance

Help users discover Ethereum peer addresses over devp2p when they don't have an enode:// URL yet — discv4 Kademlia UDP discovery, discv5 authenticated discovery, DNS ENR-tree bootstrapping…

  • The user mentions peer discovery
  • SKILL.md covers Package, Persist your node identity, Mental model: three ways to… and Discover peers with discv5…, plus 7 more sections
  • Calls dotnet
  • Finding Ethereum nodes

What it does

Devp2p Peer Discovery is an agent skill from Nethereum/Nethereum. Help users discover Ethereum peer addresses over devp2p when they don't have an enode:// URL yet — discv4 Kademlia UDP discovery, discv5 authenticated discovery, DNS ENR-tree bootstrapping (EIP-1459), or persisting a stable node identity/peer cache with Nethereum (.NET). Use this skill whenever the user mentions peer discovery, discv4, discv5, ENR, enode, finding Ethereum nodes, bootnodes, DNS discovery tree, or persisting a node key/peer list across restarts.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs. It works with Ethereum and .NET. The repository describes itself as: Ethereum .Net cross platform integration library. The licence is MIT.

When your agent uses it

  • The user mentions peer discovery
  • Finding Ethereum nodes
  • DNS discovery tree
  • Persisting a node key/peer list across restarts

Example prompts

  • “/devp2p-peer-discovery”

What it can do on your machine

Read from SKILL.md and the folder at commit 229f278. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dotnet

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.nethereum.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Devp2p Peer Discovery loads about 2.7k tokens when it runs. Until then it costs about 122 tokens; SKILL.md has 1,044 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~122
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Nethereum/Nethereum at commit 229f278, republished under its MIT licence (© Nethereum). 1,044 words, ~2,691 tokens.

Download SKILL.mdSave it as .claude/skills/devp2p-peer-discovery/SKILL.md (or your agent's skills folder).
name
devp2p-peer-discovery
description
Help users discover Ethereum peer addresses over devp2p when they don't have an enode:// URL yet — discv4 Kademlia UDP discovery, discv5 authenticated discovery, DNS ENR-tree bootstrapping (EIP-1459), or persisting a stable node identity/peer cache with Nethereum (.NET). Use this skill whenever the user mentions peer discovery, discv4, discv5, ENR, enode, finding Ethereum nodes, bootnodes, DNS discovery tree, or persisting a node key/peer list across restarts.
user-invocable
true

Peer Discovery — Nethereum.DevP2P

Dialing a peer (see devp2p-peer-connect) assumes you already have an enode:// URL. In practice, a node starting cold has none — it needs to find other nodes on the network before it can dial anyone. This skill covers the three discovery mechanisms Nethereum implements — discv4 (the original Kademlia UDP protocol), discv5 (its authenticated successor), and DNS ENR-tree lookup (EIP-1459, for bootstrapping from a small number of well-known DNS names) — plus two supporting pieces every long-running node needs: a stable node identity and a memory of which peers were worth reconnecting to.

Package

bash
dotnet add package Nethereum.DevP2P

You'll want a persisted node identity (below) rather than a throwaway EthECKey.GenerateKey() — discovery is precisely the mechanism by which other nodes learn your enode:// and remember you, so a node-id that changes every restart defeats the point.

Persist your node identity

A stable enode across restarts is what lets a remote peer durably trust your node by node-id — bond once, reconnect for weeks. NodeKeyStore.LoadOrCreate loads a raw 32-byte private key from path, or generates and saves one on first run:

csharp
using Nethereum.DevP2P.NodeDb;

// EthECKey LoadOrCreate(string path, Action<string> log = null)
var localKey = NodeKeyStore.LoadOrCreate("nodekey");

Run this once at node startup instead of EthECKey.GenerateKey(). The first run creates nodekey on disk; every subsequent run loads the same key, so your node's identity (and any reputation peers have built for it) survives restarts.

Mental model: three ways to find a node

MechanismTransportUse when
discv4Unencrypted, signed UDP (Kademlia)Talking to older/simpler clients; bonding with a known seed list
discv5Authenticated UDP (WHOAREYOU + HKDF session keys, AES-GCM)Mainnet-style discovery; the modern default with TalkReq/TalkResp extensibility
DNS ENR-tree (EIP-1459)DNS TXT recordsBootstrapping from a small number of trusted, well-known hostnames rather than hardcoded IPs

All three ultimately hand you the same thing: a list of enode (or ENR) addresses to feed into StaticPeerConnector/RlpxConnection (see devp2p-peer-connect). They differ in how much trust and infrastructure they assume up front.

Discover peers with discv5 (the one-line quickstart)

Discv5Discovery.StartMainnet is the fastest way to get a discv5 node walking the network: it builds the listener, signs a local ENR, seeds the mainnet bootnodes, starts the routing-table walk, and hands back both objects — you own teardown of each:

csharp
using Nethereum.DevP2P.Discv5;
using Nethereum.Signer;

var localKey = EthECKey.GenerateKey();

var (discovery, listener) = Discv5Discovery.StartMainnet(
    localKey,
    enqueueEnode: enode => Console.WriteLine($"discovered {enode}"));   // feed your dial loop here

// ... on shutdown — the service does NOT dispose the listener it walks:
await discovery.StopAsync();
await listener.DisposeAsync();

Every enode string handed to enqueueEnode is a live candidate — pass it straight into StaticPeerConnector.ConnectAsync, or queue it for your own dial scheduler. Note the two-step shutdown: Discv5Discovery stops the periodic walk, but it doesn't own the listener's socket, so you dispose that separately.

The full signature exposes tuning most callers don't need day one — a custom bind address/port, a logger, and a pre-dial fork-ID filter so you never bother dialing peers on the wrong chain:

csharp
(Discv5PeerDiscoveryService Discovery, Discv5Listener Listener) StartMainnet(
    EthECKey localKey,
    Action<string> enqueueEnode,
    IPAddress bindAddress = null,
    int udpPort = 0,
    Action<string> log = null,
    Func<byte[], bool> ethForkIdFilter = null,
    CancellationToken ct = default)

See the underlying protocol: discv4 ping/pong

Discv5Discovery is a convenience wrapper; underneath, discovery is a signed UDP request/response protocol. This is easiest to see with the older discv4 protocol, whose ping/pong bonding is exercised directly by a test — two Discv4Listeners on loopback, each auto-responding to the other's messages:

csharp
var keyA = EthECKey.GenerateKey();
var keyB = EthECKey.GenerateKey();

var tableA = new Discv4RoutingTable(keyA.GetPubKeyNoPrefix());
var tableB = new Discv4RoutingTable(keyB.GetPubKeyNoPrefix());

using var nodeA = new Discv4Listener(keyA, tableA);
using var nodeB = new Discv4Listener(keyB, tableB);

nodeA.Start(udpPort: 0, bindAddress: IPAddress.Loopback);
nodeB.Start(udpPort: 0, bindAddress: IPAddress.Loopback);

nodeB.PingReceived += async (_, e) =>
{
    var pong = new Discv4PongMessage
    {
        To = new Discv4Endpoint { IP = e.Sender.Address, UdpPort = (ushort)e.Sender.Port, TcpPort = 0 },
        PingHash = e.PingHash,
        Expiration = DateTimeOffset.UtcNow.AddMinutes(1).ToUnixTimeSeconds()
    };
    await nodeB.SendPongAsync(e.Sender, pong);
};

var ping = new Discv4PingMessage
{
    Version = 4,
    From = new Discv4Endpoint { IP = IPAddress.Loopback, UdpPort = (ushort)nodeA.Port, TcpPort = 30303 },
    To = new Discv4Endpoint { IP = IPAddress.Loopback, UdpPort = (ushort)nodeB.Port, TcpPort = 0 },
    Expiration = DateTimeOffset.UtcNow.AddMinutes(1).ToUnixTimeSeconds()
};
await nodeA.SendPingAsync(new IPEndPoint(IPAddress.Loopback, nodeB.Port), ping);

// After the round trip, both routing tables have learned about each other:
// tableA.Count >= 1 and tableB.Count >= 1

This is the EIP-868 endpoint-proof bonding step: a node only adds a peer to its Kademlia routing table after a successful ping/pong round trip, which is what makes discv4 resistant to naive amplification/spoofing attacks. Discv4Listener has AutoRespond = true by default, so in practice you rarely wire the PingReceived handler yourself — the harvester below does it for you.

The high-level discv4 harvester

For day-to-day use you don't drive ping/pong by hand — PeerDiscoveryService.DiscoverAsync bonds with a list of seed enodes and returns the flat list of enodes it discovered:

csharp
Task<List<string>> DiscoverAsync(
    IEnumerable<string> seedEnodes, TimeSpan perSeedTimeout, CancellationToken ct)

Feed it your bootnodes (or a previously-discovered peer list — see the persistent cache below) and it returns candidates ready for StaticPeerConnector.

Note: this signature is verified against src/Nethereum.DevP2P/README.md, but no tagged doc-example test exercises the harvester end-to-end — only the lower-level Discv4Listener ping/pong above is test-backed.

Show full SKILL.md (436 more words)Show less

DNS ENR-tree discovery (EIP-1459)

Some networks publish their bootstrap peer list as a DNS TXT-record tree rather than a hardcoded list — this is how go-ethereum distributes its mainnet bootnodes, for example. EnrTreeResolver.ResolveAsync walks an enrtree:// URL into a flat list of enode URLs:

csharp
Task<List<string>> ResolveAsync(
    string enrtreeUrl, TimeSpan timeout, int maxLeaves, CancellationToken ct)

EnrTreeResolver falls back from OS DNS to a public resolver if needed, and Nethereum ships the mainnet all/snap/les tree URLs baked in, so you rarely need to source one yourself. Use this when you want to bootstrap a node with zero hardcoded IPs — just the tree's root name.

Node identity concepts

Two different identifiers are in play across discv4 and discv5, and mixing them up is a common source of confusion:

  • enode id (discv4) — the raw 64-byte secp256k1 public key.
  • discv5 node id — keccak256(pubkey), a further hash of that same key.

ENR records (EnrRecord, from Nethereum.Model.Enr) carry a node's discv5 identity and are set on a listener via LocalEnrEncoded / LocalEnrSequence.

Remember which peers were worth reconnecting to

Discovery finds candidates; it doesn't know which of them turned out to be reliable. PersistentPeerCache records dial success/failure per peer and returns your preferred enodes across restarts, so a node doesn't have to rediscover its whole working peer set from scratch every time it starts.

Note: PersistentPeerCache is documented in src/Nethereum.DevP2P/README.md as a bullet point (recording dial success/failure, returning preferred enodes) but has no method signature block in the README and no tagged doc-example test — its role is verified from the README prose only.

Common mistakes

SymptomCauseFix
Discv5Discovery.StartMainnet never calls enqueueEnodeBound to an address/port that's unreachable from the internet (e.g. behind strict NAT with no port forwarding), or outbound UDP blockedConfirm the UDP port is reachable; check firewall/NAT
discv4 PingReceived never fires in your own listener codeAutoRespond already handled it — you don't usually need to also handle PingReceived yourself unless customizing bondingOnly hook PingReceived/PongReceived for diagnostics or custom logic
Node's peer reputation resets every deployUsing EthECKey.GenerateKey() at startup instead of NodeKeyStore.LoadOrCreatePersist the node key; see "Persist your node identity" above
DNS ENR-tree resolution times outtimeout/maxLeaves too small for the tree's depth, or OS DNS is filtering TXT recordsIncrease timeout; EnrTreeResolver falls back to a public resolver automatically

Decision guidance

I want to…Use
Get discovering with the least setup (mainnet-style)Discv5Discovery.StartMainnet
Match an older/simpler peer set, or need fine control over bondingDiscv4Listener + PeerDiscoveryService.DiscoverAsync
Bootstrap with zero hardcoded IPsEnrTreeResolver.ResolveAsync against a known enrtree:// root
Keep working peers across restartsPersistentPeerCache
Keep the same node-id across restartsNodeKeyStore.LoadOrCreate

Once you have candidate enodes, dial them with StaticPeerConnector.ConnectAsync — see the devp2p-peer-connect skill.

For full documentation, see: https://docs.nethereum.com/docs/devp2p/guide-peer-discovery

© Nethereum, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/nethereum-skills/skills/devp2p-peer-discovery of Nethereum/Nethereum.

Open the folder on GitHubat commit 229f278

Compare with similar skills

Devp2p Peer Discovery next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Devp2p Peer Discovery compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Devp2p Peer Discovery this skillNethereum/Nethereum2.3k—~2.7kAutomated safety check: PassMIT
FoundatioFoundatioFx/Foundatio2.1k—~3.9kAutomated safety check: PassApache-2.0
Aspnet Corefanslead/ReverseProxy.Store1632 repos~1.4kAutomated safety check: PassApache-2.0
Msal Auth Code FlowAzureAD/microsoft-authentication-library-for-dotnet1.5k—~917Automated safety check: PassMIT
Tsp Csharpquerylenshq/ef-querylens225—~1.3kAutomated safety check: PassMIT
Msal Client CredentialsAzureAD/microsoft-authentication-library-for-dotnet1.5k—~1.1kAutomated safety check: PassMIT

Similar skills

  • Foundatio

    FoundatioFx/Foundatio

    A skill your agent uses when working with Foundatio infrastructure abstractions for .NET -- caching, queuing, messaging, file storage, distributed locking, or background jobs.

    2.1k GitHub stars~3.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Aspnet Core

    fanslead/ReverseProxy.Store

    Build, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development.

    163 GitHub starsUsed in 2 repos~1.4k tokens
    Backend & APIsAuto-check passed
  • Msal Auth Code Flow

    AzureAD/microsoft-authentication-library-for-dotnet

    Authorization Code Flow for web applications using MSAL.NET confidential client to sign in users and access APIs on their behalf

    1.5k GitHub stars~917 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Tsp Csharp

    querylenshq/ef-querylens

    Comprehensive C and .NET development skill for TSP projects.

    225 GitHub stars~1.3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Msal Client Credentials

    AzureAD/microsoft-authentication-library-for-dotnet

    Client Credentials Flow for service-to-service (daemon) authentication in MSAL.NET without user involvement

    1.5k GitHub stars~1.1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Verify Authendpoints

    madeyoga/AuthEndpoints

    Drive the AuthEndpoints HTTP API via the in-repo test host (cookie sessions, Identity bearer, Simple JWT, CSRF, ReAuth).

    121 GitHub stars~2.7k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from Nethereum/Nethereum

All 71 skills in this repo
  • Aa Batching Paymasters

    Nethereum/Nethereum

    Help users batch multiple calls into a single UserOperation and sponsor gas with paymasters using Nethereum Account Abstraction.

    2.3k GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed
  • Aa Bundler

    Nethereum/Nethereum

    Help users run an ERC-4337 bundler using Nethereum — set up in-process or standalone bundlers with mempool, validation, reputation, and JSON-RPC server.

    2.3k GitHub stars~1.2k tokensUpdated 4 days ago
    Auto-check passed
  • Abi Encoding

    Nethereum/Nethereum

    Encode and decode Ethereum ABI data with Nethereum. An agent skill from Nethereum/Nethereum.

    2.3k GitHub stars~1.3k tokensUpdated 4 days ago
    Auto-check passed
  • Abi Retrieval

    Nethereum/Nethereum

    Fetch contract ABIs from Sourcify, Etherscan, and 4Byte Directory using the composite ABIInfoStorage pattern (.NET/C).

    2.3k GitHub stars~1.5k tokensUpdated 4 days ago
    Auto-check passed
  • Account Abstraction

    Nethereum/Nethereum

    Help users implement ERC-4337 Account Abstraction with Nethereum — send UserOperations, use smart accounts, route contract calls through a bundler, enable gasless transactions, or work with AA in…

    2.3k GitHub stars~1.7k tokensUpdated 4 days ago
    Auto-check passed
  • Address Utils

    Nethereum/Nethereum

    Validate and format Ethereum addresses with Nethereum. An agent skill from Nethereum/Nethereum.

    2.3k GitHub stars~1.2k tokensUpdated 4 days ago
    Auto-check passed

Works with

Categories

Questions about Devp2p Peer Discovery

What does Devp2p Peer Discovery do?

Help users discover Ethereum peer addresses over devp2p when they don't have an enode:// URL yet — discv4 Kademlia UDP discovery, discv5 authenticated discovery, DNS ENR-tree bootstrapping…. Devp2p Peer Discovery is an agent skill from Nethereum/Nethereum.NET).

When should I use Devp2p Peer Discovery?

Devp2p Peer Discovery fits situations like: the user mentions peer discovery; finding Ethereum nodes; DNS discovery tree; persisting a node key/peer list across restarts.

How do I install Devp2p Peer Discovery in Claude Code?

Run `npx skills add Nethereum/Nethereum --skill devp2p-peer-discovery -a claude-code`. Or copy the skill folder (plugins/nethereum-skills/skills/devp2p-peer-discovery in Nethereum/Nethereum) into .claude/skills/devp2p-peer-discovery in your project. Claude Code loads it when a task matches its description.

How do I install Devp2p Peer Discovery in Codex?

Run `npx skills add Nethereum/Nethereum --skill devp2p-peer-discovery -a codex`. Or copy the skill folder (plugins/nethereum-skills/skills/devp2p-peer-discovery in Nethereum/Nethereum) into .agents/skills/devp2p-peer-discovery in your project. Codex loads it when a task matches its description.

Can I use Devp2p Peer Discovery in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Nethereum/Nethereum --skill devp2p-peer-discovery -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/devp2p-peer-discovery, .gemini/skills/devp2p-peer-discovery, .github/skills/devp2p-peer-discovery and .opencode/skills/devp2p-peer-discovery in your project.

What does Devp2p Peer Discovery need to run?

Going by SKILL.md and its folder, Devp2p Peer Discovery needs the command-line tools its instructions call (dotnet).

Does Devp2p Peer Discovery access the network?

SKILL.md names 1 domain. As links in the text: docs.nethereum.com. This is read from the text; nothing was executed.

Is Devp2p Peer Discovery safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Devp2p Peer Discovery use?

Devp2p Peer Discovery is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Devp2p Peer Discovery use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Devp2p Peer Discovery?

Skills that share tags, products or a category with Devp2p Peer Discovery: Foundatio (FoundatioFx/Foundatio, 2.1k stars), Aspnet Core (fanslead/ReverseProxy.Store, 163 stars), Msal Auth Code Flow (AzureAD/microsoft-authentication-library-for-dotnet, 1.5k stars) and Tsp Csharp (querylenshq/ef-querylens, 225 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Devp2p Peer Discovery?

Nethereum (a GitHub organization) maintains it in Nethereum/Nethereum, which has 2,260 GitHub stars. The repository holds 71 skills in this directory. The repository was last updated on October 5, 2026.

Source: Nethereum/Nethereum on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.