I implemented a multithreaded blockchain simulation in Java with support for concurrent miners and transaction processing. The system includes core components such as Block, Blockchain, Miner, and Transaction, where miners compete to generate valid blocks using a proof-of-work mechanism. Each block contains transaction data, a hash of the previous block, and a computed hash based on its content and a difficulty constraint. I also implemented a dynamic difficulty adjustment mechanism that increases or decreases the mining difficulty based on how quickly blocks are generated. Transactions are validated using RSA digital signatures to ensure integrity and authenticity before being added to the pending pool. The blockchain maintains thread safety for critical operations such as block addition and transaction handling. I covered the system with unit tests using JUnit 5, including parameterized tests and reflection-based tests for private logic. Additionally, I addressed concurrency issues and ensured consistent behavior under parallel execution of multiple miners.
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|