A visual blockchain implementation in Java with a Swing GUI. Demonstrates core blockchain concepts: blocks, hashing, proof-of-work, transactions, and wallet management.
- Visual chain — animated block-by-block chain diagram with hover details
- Wallet management — add/remove wallets with starting balances
- Transactions — queue coin transfers between wallets
- Mining — proof-of-work mining commits transactions into blocks
- Chain validation — verify hash integrity across the whole chain
- Event log — real-time log of all blockchain activity
src/
├── Main.java # Entry point
├── core/
│ ├── Block.java # Block with SHA-256 hashing & PoW
│ ├── Transaction.java # Transaction model
│ └── Blockchain.java # Chain logic, wallets, mining
└── gui/
└── BlockchainGUI.java # Swing GUI visualizer
- Java 11+ (Java 17 recommended)
- No external dependencies
Check your version: java -version
chmod +x build-and-run.sh
./build-and-run.shmkdir -p out
javac -d out -sourcepath src src/Main.java src/core/*.java src/gui/*.java
jar cfe blockchain-explorer.jar Main -C out .
java -jar blockchain-explorer.jar- Add wallets — each wallet starts with 100 coins
- Queue transactions — choose sender, recipient, and amount
- Mine a block — pending transactions are hashed + proof-of-work solved
- View the chain — the visual panel shows each block with its hash linkage
- Remove a block — watch chain validity break (for educational purposes)
| Concept | Implementation |
|---|---|
| Immutability | SHA-256 hash of block contents |
| Chain linking | Each block stores previousHash |
| Proof of Work | Hash must start with N zeros |
| Distributed validation | isChainValid() checks all hashes |
| Wallets | Balance computed from transaction history |