All Projects
Backend

Blockchain from Scratch — Spring Boot

A pedagogical blockchain in Java/Spring Boot: blocks, a transaction pool (mempool), SHA-256 hashing, Proof-of-Work mining and full chain validation — all driven through a REST API, plus AES and asymmetric-encryption crypto demos.

Proof of Work
Consensus
SHA-256
Hashing
6
REST endpoints
AES + RSA
Crypto demos
Approach

Implement blocks + mempool + PoW mining + chain validation, all exposed and testable via REST

Tech Stack
Java 17Spring Boot 3.0SHA-256AES / asymmetric cryptoMaven
Keywords
BlockchainProof of WorkSHA-256CryptographySpring BootRESTAES
Deep Dive

A from-scratch blockchain implementation that makes the core mechanics visible and testable through a REST API.

Core components

ComponentRole
Blockindex, timestamp, previous/current hash, nonce, data
BlockchainaddBlock, mineBlock, validateChain
Transaction / TransactionPoolpending transactions (mempool)
HashUtilSHA-256 hashing
examples/hashing, symmetric (AES) & asymmetric encryption demos

REST API

GET  /blockchain                 → full chain
POST /blockchain/transaction     → add tx to the pool
POST /blockchain/mine            → mine a new block (Proof of Work)
GET  /blockchain/block/{index}   → block at index
GET  /blockchain/transaction-pool→ pending transactions
GET  /blockchain/validate        → verify chain integrity

Concepts demonstrated

  • Blocks chained by hash (each block stores the previous hash)
  • SHA-256 for cryptographic integrity
  • Proof of Work — nonce search until the hash meets the difficulty target
  • Mempool of pending transactions consumed at mining time
  • Chain validation detects any tampering by re-hashing the whole chain

Runs on :9999 via ./mvnw spring-boot:run; WORKSHOP.md is a step-by-step build guide.