cops-sol
v1.3.1
Published
GitHub proves you pushed. COPS proves you wrote. Stake-backed proof of authorship on Solana with AI-rewrite detection.
Maintainers
Readme
COPS — Code Ownership Proven on Solana
Fingerprint your code, register it on-chain with stake-backed provenance, detect AI rewrites, and resolve disputes deterministically.
Install
npm install -g cops-solPrerequisites
- Node.js 18+
- Solana CLI (for wallet management):
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" - Create a wallet (one-time):
solana-keygen new solana config set --url devnet - Fund your wallet (devnet):
If airdrop fails (rate-limited), use https://faucet.solana.comsolana airdrop 2 --url devnet
Quick Start
cd your-project
cops init # initialize tracking
cops publish origin main # fingerprint + register + push
cops status # check on-chain stateCommands
Publish (register + push)
cops publish origin main --stake 0.2- Fingerprints all source files (SHA-256 Merkle tree + AST structural hashes)
- Scans on-chain registry for lineage/overlap
- Registers on Solana with SOL stake (default: 0.1 SOL)
- Uploads file hashes + structural hashes on-chain
git pushto your remote
Verify (check any code against on-chain records)
cops verify ./suspect-code
cops verify ./suspect-code --json # machine-readable output
cops verify ./suspect-code --verbose # show all function matchesCompares a local directory against all registered projects. Reports:
- Content overlap %
- Structural overlap % (AST-level, catches AI rewrites)
- Signature/skeleton overlap
- AI rewrite score (0-100)
- Composite verdict with confidence
Clone (with provenance check)
cops clone https://github.com/user/repo.gitStatus
cops statusLineage
cops lineage # show ancestry tree + overlap scan
cops lineage --jsonChallenge (V2 Provenance Court)
cops challenge <defendant-pda>File a dispute against a project you believe copied your code. Compares file hashes on-chain and submits overlap proof.
Resolve
cops resolve <dispute-pda>Resolve an open dispute. Deterministic: >=40% overlap = challenger wins, <40% = defendant wins. Stake transfers to the winner.
Withdraw
cops withdrawReclaim your stake after verification or 30-day period.
Disputes
cops disputes # disputes for current project
cops disputes --all # all disputes on-chainHow It Works
COPS creates a multi-layer fingerprint of your source code:
- File hashes — SHA-256 of each source file (CRLF/LF normalized)
- Merkle root — Merkle tree of all file hashes
- Structural hashes — AST-level function fingerprints (catches AI rewrites where every line is different but the structure is the same)
- Function signatures — name + param count hashing for cross-file rename detection
These are stored in Solana PDAs tied to your wallet and project name. The V2 Provenance Court adds:
- Stake-backed registration — put SOL behind your claim of originality
- On-chain challenges — anyone can dispute with overlap proof
- Deterministic resolution — hash comparison on-chain, no subjective judging
- Stake slashing — plagiarists lose their stake to the challenger
Program
- Network: Solana Devnet
- Program ID:
5bHSYFLoEtoxQnqi6vuDvjFGbcuwnLJbi6wJbHmHW8R4 - Explorer: https://explorer.solana.com/address/5bHSYFLoEtoxQnqi6vuDvjFGbcuwnLJbi6wJbHmHW8R4?cluster=devnet
License
MIT
