A compact C++ console application that simulates a simple blockchain ledger. Each block records an index, UTC timestamp, previous hash, current hash, difficulty, and nonce. The program assembles a small chain, validates it, and prints a readable ledger view.
- Simple proof-of-work with configurable difficulty
- Genesis block creation and sequential block appends
- Hash and previous-link validation across the chain
- Clean console output suitable for demos and quick evaluations
Requirements:
- C++17-capable compiler (GCC, Clang, MSVC)
Examples:
- GCC/Clang:
g++ -std=c++17 -O2 -o crypto-ledger main.cpp - MSVC (Developer Prompt):
cl /std:c++17 /O2 main.cpp
./crypto-ledger
- A short chain with sample entries
- Per-block details: index, time, previous hash, hash, difficulty, nonce, and payload
- A validation summary of the chain state
The implementation is intentionally self-contained with no third-party dependencies, focusing on the data model and ledger flow. It is not intended for production use.