A decentralized, CPU-driven Proof-of-Work shield to protect open-source repositories from AI-generated Pull Request spam.
The Vision
Drawing directly from the core economic principles of Bitcoin's Proof-of-Work, HashGuard flips the asymmetry of open-source spam. It costs a bad actor nothing to generate a fake PR with an LLM, but reviewing it drains valuable maintainer time.
By requiring new contributors to compute a SHA-256 hash that meets an adjustable difficulty target, we create a computational tollbooth. Genuine human developers won't notice a 5-second CLI operation, but automated botnets will instantly burn through their server compute budgets trying to spam the repository.
🛠️ Maintainer Setup (Under 2 Minutes)
No centralized SaaS dependencies. No API keys. Just pure Rust and standard GitHub Actions.
The Difficulty Dial: Create a .github/pow_difficulty.txt file at your repository root containing a single integer (e.g., 4). If the repo falls under a bot attack, simply bump this number to 6 or 7 to exponentially raise the computational cost for attackers.
The Validator: Drop the HashGuard validation workflow into your .github/workflows/ directory.
💻 Contributor Workflow
When your code is ready, run the lightweight Rust miner locally against the target repo and your working branch:
Generating Your Proof-of-Work
Before submitting your Pull Request, you must generate a cryptographic nonce.
Check the .github/pow_difficulty.txt file in your repository to find the current difficulty requirement, then run the miner locally:
# Syntax: cargo run --release <repo-target> <your-branch> <difficulty>
cargo run --release username/repo my-fix-branch 4Where:
-
username/repo: The target repository you are submitting the PR to. -
my-fix-branch: The exact name of your branch. -
4: The current difficulty level (found inpow_difficulty.txt).
Paste the resulting cryptographic block at the bottom of your PR description:
POW-NONCE: 84729
The GitHub Action will validate your hash instantly, signaling to the maintainers that your Pull Request is backed by genuine computational effort and ready for review.
Built for the Open-Source Hackathon by Ifeanyichukwu Amajuoyi.