{"id":50211461,"url":"https://github.com/ch4r10t33r/zig-discv5","last_synced_at":"2026-05-26T05:37:41.937Z","repository":{"id":356815645,"uuid":"1234176289","full_name":"ch4r10t33r/zig-discv5","owner":"ch4r10t33r","description":"Pure Zig Ethereum Node Discovery v5 (discv5)","archived":false,"fork":false,"pushed_at":"2026-05-09T22:51:41.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-09T23:21:17.867Z","etag":null,"topics":["discv5","ethereum","libp2p","zig","zig-discv5"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ch4r10t33r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-09T21:02:54.000Z","updated_at":"2026-05-09T22:51:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ch4r10t33r/zig-discv5","commit_stats":null,"previous_names":["ch4r10t33r/zig-discv5"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ch4r10t33r/zig-discv5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4r10t33r%2Fzig-discv5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4r10t33r%2Fzig-discv5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4r10t33r%2Fzig-discv5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4r10t33r%2Fzig-discv5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ch4r10t33r","download_url":"https://codeload.github.com/ch4r10t33r/zig-discv5/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4r10t33r%2Fzig-discv5/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33506509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discv5","ethereum","libp2p","zig","zig-discv5"],"created_at":"2026-05-26T05:37:41.255Z","updated_at":"2026-05-26T05:37:41.932Z","avatar_url":"https://github.com/ch4r10t33r.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zig-discv5\n\nPure Zig implementation of the Ethereum [**Node Discovery Protocol v5**](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md) (discv5). The goal is a small library suitable for embedding in clients and tooling, with a single Zig dependency ([**zig-varint**](https://github.com/ch4r10t33r/zig-varint)) for shared varint encoding.\n\n**Latest release:** [v0.1.0](https://github.com/ch4r10t33r/zig-discv5/releases/tag/v0.1.0) — semantic version in `build.zig.zon` must match the git tag (without the `v` prefix).\n\n## Status\n\nThe codebase is modular and **0.1.0** includes a working **local node** (`node`): inbound `handleReceive`, outbound handshake initiation, session cache, encrypted **PING/PONG**, **FINDNODE/NODES** (cached peer ENRs, chunked replies), and **TALKREQ/TALKRESP** (default echo). Routing follows discv5-theory (e.g. FINDNODE only returns **ping_replied** peers). Optional **ingress** rate limits and **egress** limits in the UDP pump share `ingress_limit`.\n\n**Experimental / incomplete relative to the full spec:** non-final [topic advertisement](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md) message types (0x07–0x0a) are gated behind `-Dexperimental_topic_wire` (default **on**); turn it **off** for strict “unknown type” rejection. Production hardening, interoperability against every client, and topic-advertisement wire finalization are still evolving.\n\n| Area | Module | Notes |\n|------|--------|--------|\n| Shared errors | `errors` | Common error sets (includes `NotImplemented` for unused API placeholders) |\n| Varint | `varint` | Unsigned LEB128 (`u64`), minimal encoding, strict decode |\n| RLP | `rlp` | Strings and lists for devp2p payloads |\n| Wire | `wire` | `MessageKind` + re-exports of `varint`, `packet`, `message`, `message_crypto`, etc. |\n| Message | `message` | Ordinary message RLP encode/decode; REGTOPIC/TICKET/REGCONFIRMATION/TOPICQUERY (0x07–0x0a) decode only when `-Dexperimental_topic_wire=true` (default). Encode helpers exist for tooling. |\n| Message crypto | `message_crypto` | AES-128-GCM for ordinary message ciphertext (spec section 2.3) |\n| ENR | `enr` | EIP-778 textual `enr:` decode (base64url + RLP layout checks) |\n| Handshake | `handshake` (alias `crypto`) | HKDF session keys, identity-proof SHA-256 |\n| Identity v4 | `identity_v4` | Compressed pubkey, ECDH (`eph`), ECDSA identity proof (64-byte raw signature) |\n| Packet | `packet` | UDP bounds, header unmask, static header + auth layouts |\n| Routing | `routing` | Kademlia table: 256 buckets (k=16), per-bucket replacement cache, LRU/MRU, closest + FINDNODE export |\n| Session | `session` | LRU session table (node id + UDP endpoint), cached keys, GCM nonce helper |\n| Topic | `topic` | Topic table per discv5-theory: FIFO queues, per-topic and global caps, `target_ad_lifetime` purge, registration wait hints |\n| Ingress limits | `ingress_limit` | Sliding-window datagram limits (per-peer and global); used by `Node` and `udp_runtime` egress |\n| Node | `node` | Discovery node state machine: sessions, challenges, encrypted messages, routing integration, configurable TTLs and caps |\n| UDP runtime | `udp_runtime` | libc IPv4 UDP socket helpers and receive/emit loop into `Node.handleReceive` (`link_libc` required on the module) |\n\n## Requirements\n\n- [Zig](https://ziglang.org/) **0.16.0** or newer (see `build.zig.zon`).\n\n## Versioning\n\nThis package follows [Semantic Versioning](https://semver.org/). The current version is declared in `build.zig.zon` (`version` field) and should be bumped on release.\n\n## Build and test\n\n```sh\nzig build test\nzig fmt --check .\n```\n\nBuild option (non-final [topic advertisement](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md) wire):\n\n```sh\nzig build test -Dexperimental_topic_wire=false\n```\n\n## Use as a dependency\n\nAdd `zig_discv5` as a path or URL dependency in your `build.zig.zon`, then import the module in `build.zig`:\n\n```zig\nconst discv5 = b.dependency(\"zig_discv5\", .{\n    .target = target,\n    .optimize = optimize,\n}).module(\"zig_discv5\");\n```\n\nExact `dependency` shape depends on whether you consume the package from a git URL, tarball, or local path.\n\n## Continuous integration\n\n- [`.github/workflows/ci.yml`](.github/workflows/ci.yml) — on pushes and PRs to `main`: format check, `zig build test`, and the same tests with `-Dexperimental_topic_wire=false`.\n\n## Releases\n\nManual release (creates a GitHub Release and tag at the current commit):\n\n1. Ensure `version` in `build.zig.zon` matches the tag without the `v` prefix (e.g. tag `v0.1.0` ↔ version `0.1.0`).\n2. Actions → **Release** → **Run workflow** → set tag (default `v0.1.0`).\n\nWorkflow: [`.github/workflows/release.yml`](.github/workflows/release.yml).\n\n## Specification\n\n- [discv5.md](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md) — overview  \n- [discv5-wire.md](https://github.com/ethereum/devp2p/blob/master/discv5/discv5-wire.md) — wire encoding  \n- [discv5-theory.md](https://github.com/ethereum/devp2p/blob/master/discv5/discv5-theory.md) — algorithms  \n\n## Repository\n\nhttps://github.com/ch4r10t33r/zig-discv5\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fch4r10t33r%2Fzig-discv5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fch4r10t33r%2Fzig-discv5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fch4r10t33r%2Fzig-discv5/lists"}