Skip to content

PascuEric/blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain Explorer — Java

A visual blockchain implementation in Java with a Swing GUI. Demonstrates core blockchain concepts: blocks, hashing, proof-of-work, transactions, and wallet management.

Features

  • 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

Project Structure

    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

Requirements

  • Java 11+ (Java 17 recommended)
  • No external dependencies

Check your version: java -version

Running

Linux / macOS

chmod +x build-and-run.sh
./build-and-run.sh

Manual compile

mkdir -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

How It Works

  1. Add wallets — each wallet starts with 100 coins
  2. Queue transactions — choose sender, recipient, and amount
  3. Mine a block — pending transactions are hashed + proof-of-work solved
  4. View the chain — the visual panel shows each block with its hash linkage
  5. Remove a block — watch chain validity break (for educational purposes)

Key Concepts Demonstrated

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

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors