A revolutionary intellectual property protection system that combines AI-powered repository analysis with Filecoin blockchain technology to provide immutable, decentralized protection for your GitHub repositories.
- Smart contract repository registration on Filecoin Calibration testnet
- Immutable proof of ownership and creation dates
- Decentralized evidence storage via IPFS
- AI-powered infringement detection
- Automatic DMCA notice generation with legal templates
- Blockchain-backed evidence storage
- PDF generation with C2PA metadata support
- Earn rewards for reporting infringements
- Community-driven IP protection network
- Automated verification and payment system
- Cryptographic repository fingerprinting
- Extensive commit history analysis
- Secret detection across entire project history
- Blockchain evidence preservation
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β GitHub Repo ββββββ Analysis Agent ββββββ Filecoin Chain β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
ββββββββββββββββββββ βββββββββββββββββββ
β IPFS Storage ββββββ Smart Contractsβ
ββββββββββββββββββββ βββββββββββββββββββ
| Contract | Address | Purpose |
|---|---|---|
GitHubRepoProtection |
0x19054030669efBFc413bA3729b63eCfD3Bdc22B5 |
Main repository registration and violation tracking |
LinkRegistry |
0x5fa19b4a48C20202055c8a6fdf16688633617D50 |
License and DMCA document registry |
LinkRegistryWithDeals |
0x25bc04a49997e25B7482eEcbeB2Ec67740AEd5a6 |
Enhanced registry with Filecoin deal support |
InfringementBounty |
0xA2cD4CC41b8DCE00D002Aa4B29050f2d53705400 |
Bounty system for community reporting |
DealClient |
0x592eC554ec3Af631d76981a680f699F9618B5687 |
Filecoin storage deal management |
Follow these steps to set up and run the CodeShield AI GitHub Protection Agent locally.
First, clone the project from GitHub and navigate into the newly created directory.
git clone [https://github.com/CodeShieldAI/backend.git](https://github.com/CodeShieldAI/backend.git)
cd backendThe agent requires API keys and a wallet private key to function. These are managed through a .env file in the project's root directory.
-
Create the
.envfile by copying the example template:cp .env.example .env
-
Edit the
.envfile with your favorite editor (e.g.,nano .envorcode .env) and add your credentials.# REQUIRED: Your Filecoin wallet private key for transactions. # This wallet must be funded with tFIL tokens. See step 3. PRIVATE_KEY="0xyour_filecoin_wallet_private_key" # REQUIRED: Your OpenAI API Key for AI-powered analysis. # Get one from [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys) OPENAI_API_KEY="sk-your_openai_api_key" # RECOMMENDED: Your GitHub API token for higher API rate limits. # Generate one at [https://github.com/settings/tokens](https://github.com/settings/tokens) (with 'repo' scope). GITHUB_TOKEN="ghp_your_github_token" # OPTIONAL: Credentials for a dedicated IPFS pinning service like Pinata. # Get these from [https://www.pinata.cloud/](https://www.pinata.cloud/) PINATA_API_KEY="your_pinata_api_key" PINATA_API_SECRET="your_pinata_api_secret"
To pay for transactions on the Filecoin network (like registering a repository), your wallet needs testnet tokens (tFIL).
Visit the Filecoin Calibration Faucet to get free tFIL tokens sent to the wallet address associated with your PRIVATE_KEY.
The backend is built with Python. Install the required packages using pip.
pip install -r requirements.txtBefore running the agent, use the built-in validator to ensure your environment is configured correctly. This script checks everything from API keys and network connectivity to your wallet balance.
python github_protection_agent/setup_validator.pyIf all checks pass, you are ready to proceed. The validator will provide clear instructions for fixing any issues it finds.
You can run the backend as an interactive shell or by passing commands directly via the command line.
This mode starts an interactive shell where you can run commands one by one.
- Start the agent from the root directory:
python github_protection_agent/main.py
- Once initialized, you will see a welcome banner and a command prompt
π‘οΈ FilecoinAgent>. - Type
helpto see a full list of commands.
You can also execute commands directly. The script run_agent.py is a convenient wrapper for this.
Usage:
python run_agent.py <command> [arguments...]Example:
# Register a repository from the command line
python run_agent.py register [https://github.com/your-username/your-repo](https://github.com/your-username/your-repo) MIT
# Run a security audit
python run_agent.py audit [https://github.com/your-username/your-repo](https://github.com/your-username/your-repo)Here is a list of the primary commands available in both modes:
- validate
- Run complete system validation (blockchain, IPFS, AI).
- Example:
validate
- status
- Check blockchain connection, account balance, and IPFS services.
- Example:
status
- register
<url>[license_type]- Register a repository on Filecoin with license generation.
- License types: MIT, Apache-2.0, GPL-3.0, BSD-3-Clause, Custom-AI.
- Example:
register https://github.com/user/repo MIT
- query
[start_id][limit]- Query repositories from the blockchain.
- Example:
query 1 10
- workflow
<url>- Run the complete protection workflow (register + audit + scan).
- Example:
workflow https://github.com/user/repo
- analyze
<url1><url2>- Compare two repositories for similarity.
- Example:
analyze github.com/user1/repo1 github.com/user2/repo2
- audit
<url>[--extensive]- Run a security audit with blockchain evidence storage.
- Example:
audit github.com/user/repo --extensive
- scan
[repo_id]- Scan for violations and file DMCA notices.
- Example:
scan 1
- bounty
<infringing_url>[original_repo_id]- Report an infringement to earn bounty rewards.
- Example:
bounty github.com/bad/repo 1
- help - Show the complete command reference.
- quit/exit - Exit the interactive agent.
The frontend provides a user-friendly web interface for the agent.
- Navigate into the frontend directory:
cd frontend - Install the necessary NPM packages:
npm install
- Start the frontend development server:
npm run dev
- Open your web browser and go to
http://localhost:3000(or the URL shown in your terminal) to access the application.
All documents are stored on IPFS for decentralized access:
- License PDFs: Generated with legal templates
- DMCA Notices: Professional takedown requests
- Security Reports: Comprehensive audit results
- Evidence Files: Cryptographic proof of violations
- Repository Fingerprinting: Unique cryptographic signatures
- Code Similarity Detection: Advanced ML algorithms
- Security Scanning: 50+ vulnerability patterns
- Commit History Analysis: Full project lifecycle review
| Operation | Gas | Cost (tFIL) |
|---|---|---|
| Register Repository | ~200,000 | ~0.002 |
| Report Violation | ~150,000 | ~0.0015 |
| File DMCA | ~100,000 | ~0.001 |
| Add Link | ~100,000 | ~0.001 |
- Valid Infringement Report
- DMCA Takedown Success
- Community Verification
- Blockchain Immutability: Records cannot be altered
- IPFS Persistence: Documents remain accessible
- Cryptographic Signatures: Tamper-proof evidence
- C2PA Metadata: Content authenticity verification
- GDPR Compliant: Right to erasure supported
- DMCA Compliant: Legal framework adherence
- Open Source: Transparent and auditable
- Decentralized: No single point of failure
- Chain ID: 314159 (0x4cb2f)
- Currency: tFIL
- Block Time: ~30 seconds
- Explorer: https://calibration.filscan.io
- Faucet: https://faucet.calibration.fildev.network/
# Primary (Ankr)
https://rpc.ankr.com/filecoin_testnet
# Alternative endpoints
https://api.calibration.node.glif.io/rpc/v1
https://filecoin-calibration.chainup.net/rpc/v1- Filecoin for decentralized storage infrastructure