How georgepeg/copychain works
CopyChain is a web app for recording and checking copyright registrations using a locally persisted blockchain. The main workflow is: a creator submits a file, the API hashes it and queues a registration, mining commits pending registrations into a block, and users can verify files or inspect the chain. The app also documents peer registration and consensus-based chain resolution. The excerpts show the API, blockchain implementation, and parts of the browser client; UI wiring beyond those excerpts is omitted where it cannot be verified.
Main entry points: script.js Browser interactions · blockchain.py Block chain · main.py File verification · index.html Copyright page
Components 16
Web interface
- Copyright page
templates/index.html - Browser interactions
static/js/script.js
API service
- FastAPI endpoints
main.py - File registration
main.py - File verification
main.py - Mining endpoint
main.py - Chain query
main.py - Node endpoints
main.py
Copyright ledger
- File hashing
blockchain.py - Pending registrations
blockchain.py - Proof of Work
blockchain.py - Block chain
blockchain.py - JSON chain storage
blocks
Peer network
- Chain validation / consensus
blockchain.py - Peer node
Other components
- Creator / user
Connections 21
- Creator / user → Copyright page: uses
ReadMe.md - Copyright page → Browser interactions: hosts interactions
- Browser interactions → File registration: submits file
static/js/script.js - Browser interactions → File verification: submits file
static/js/script.js - Browser interactions → Mining endpoint: requests mining
static/js/script.js - Browser interactions → Chain query: requests chain
static/js/script.js - FastAPI endpoints → Copyright page: serves
main.py - File registration → File hashing: hashes upload
main.py - File registration → Pending registrations: queues registration
main.py - File verification → File hashing: hashes upload
main.py - File verification → Block chain: searches records
main.py - File verification → Pending registrations: searches pending
main.py - Mining endpoint → Pending registrations: checks pending
main.py - Mining endpoint → Proof of Work: computes proof
main.py - Mining endpoint → Block chain: creates block
main.py - Chain query → Block chain: reads chain
main.py - Node endpoints → Chain validation / consensus: resolves conflicts
main.py - Node endpoints → Chain validation / consensus: registers peers
main.py - Chain validation / consensus → Peer node: fetches peer chain
blockchain.py - Chain validation / consensus → Block chain: replaces chain
blockchain.py - Block chain → JSON chain storage: saves / loads
blockchain.py