{"id":51231124,"url":"https://github.com/egpivo/rust-p2p-protocol-lab","last_synced_at":"2026-06-28T16:30:37.221Z","repository":{"id":358202445,"uuid":"1236147767","full_name":"egpivo/rust-p2p-protocol-lab","owner":"egpivo","description":"Blockchain P2P network security lab in Rust — classic attacks with a simulation gym.","archived":false,"fork":false,"pushed_at":"2026-06-16T01:34:34.000Z","size":157,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-16T03:19:26.252Z","etag":null,"topics":["blockchain","cybersecurity","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/egpivo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-12T01:51:07.000Z","updated_at":"2026-06-16T01:34:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/egpivo/rust-p2p-protocol-lab","commit_stats":null,"previous_names":["egpivo/rust-p2p-protocol-lab"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/egpivo/rust-p2p-protocol-lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egpivo%2Frust-p2p-protocol-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egpivo%2Frust-p2p-protocol-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egpivo%2Frust-p2p-protocol-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egpivo%2Frust-p2p-protocol-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egpivo","download_url":"https://codeload.github.com/egpivo/rust-p2p-protocol-lab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egpivo%2Frust-p2p-protocol-lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34896652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["blockchain","cybersecurity","rust"],"created_at":"2026-06-28T16:30:36.222Z","updated_at":"2026-06-28T16:30:37.214Z","avatar_url":"https://github.com/egpivo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-p2p-protocol-lab\n\nA series of network programming and blockchain security experiments in Rust.\n\nBuilt as a learning path toward blockchain security engineering — each phase adds one concept on top of the last.\n\n---\n\n## What's Here\n\n| Phase | Crate | What |\n|-------|-------|------|\n| 1–4 | — | TCP fundamentals, length-prefix framing, proxy |\n| 5–6 | — | TCP proxy, IDS |\n| 7 | — | Honeypot with fake SSH + credential logging |\n| 8 | — | Concurrent password brute forcer |\n| 9 | `p2p-node` | P2P node with peer discovery |\n| 10–13 | `p2p-lab` | Crawler, Sybil, Eclipse, IDS monitor |\n| 14–15 | `p2p-env` | P2P Security Gym |\n| 16–20 | `p2p-viz` | Live attack visualizer (TLS, Noise, Eclipse, Sybil) |\n\n---\n\n## P2P Security Gym\n\nSimulate blockchain P2P attacks with one command.\n\n```bash\n# Sybil attack — fill peer slots with fake identities\ncargo run -p p2p-env -- --honest 4 --attack sybil --sybil 10\n\n# Eclipse attack — isolate a node, feed it fake chain state\ncargo run -p p2p-env -- --honest 4 --attack eclipse --sybil 20\n\n# Network partition — split the network into two isolated groups\ncargo run -p p2p-env -- --honest 6 --attack partition\n```\n\nAdding a new attack = implementing one trait:\n\n```rust\npub trait Attack: Send + Sync {\n    fn name(\u0026self) -\u003e \u0026str;\n}\n```\n\n---\n\n## Viz Frontend\n\nInteractive attack visualizer with live SSE replay.\n\n```bash\ncargo run -p p2p-viz          # serves http://localhost:3000\n```\n\nPick a scenario (Sybil / Eclipse / Partition / Noise / TLS MITM), hit Run, watch the graph animate in real time.\n\n---\n\n## Crate Structure\n\n```\ncrates/\n├── p2p-core/   Message, NodeId\n├── p2p-node/   Honest P2P node (lib + binary)\n├── p2p-lab/    Attack tools: crawl, sybil, eclipse, monitor\n├── p2p-env/    Security gym: NetworkEnv, Attack trait, CLI\n└── p2p-viz/    Live attack visualizer (Axum + SSE + D3)\n```\n\n---\n\n## Run the Network\n\n```bash\n# Terminal A — seed node\ncargo run -p p2p-node -- 9000\n\n# Terminal B, C — join the network\ncargo run -p p2p-node -- 9001 127.0.0.1:9000\ncargo run -p p2p-node -- 9002 127.0.0.1:9000\n\n# Attack tools\ncargo run -p p2p-lab -- crawl 127.0.0.1:9000\ncargo run -p p2p-lab -- sybil 127.0.0.1:9000 20\ncargo run -p p2p-lab -- eclipse 127.0.0.1:9000\ncargo run -p p2p-lab -- monitor 127.0.0.1:9000\n```\n\n---\n\n## Protocol\n\nNewline-delimited JSON over TCP.\n\n```json\n{\"Hello\":{\"node_id\":12345,\"listen_addr\":\"127.0.0.1:9001\",\"peers\":[]}}\n{\"Ping\"}\n{\"Pong\"}\n{\"GetPeers\"}\n{\"Peers\":[\"127.0.0.1:9001\",\"127.0.0.1:9002\"]}\n{\"Tip\":{\"height\":100,\"hash\":\"abc123\"}}\n```\n\n---\n\n## Notes\n\nImplementation notes for each phase are in [`notes/`](notes/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegpivo%2Frust-p2p-protocol-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegpivo%2Frust-p2p-protocol-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegpivo%2Frust-p2p-protocol-lab/lists"}