This project is a basic implementation of a blockchain written in Java, inspired by the tutorial "Create Simple Blockchain - Java Tutorial From Scratch". The primary goal is to understand the fundamentals of how a blockchain works.
- Basic blockchain implementation in Java.
- Block validation using hash functions.
- Ability to store custom data in blocks.
- Designed for easy learning and experimentation.
Make sure you have the following installed on your system:
- Java Development Kit (JDK): Version 8 or higher.
- Maven (optional): For building and managing dependencies.
- A code editor or IDE, such as IntelliJ IDEA or Eclipse.
- Clone this repository:
git clone https://github.com/franklinsrr/jblockchain
- Navigate to the project directory:
cd simple-blockchain-java - Open the project in your preferred Java IDE.
- Run the main method in the Blockchain class.
- Experiment by adding blocks with custom data and observe the behavior of the blockchain.
- Modify the code to add more features or enhance the functionality.
- Each block contains:
-
- Index: The block's position in the chain.
-
- Timestamp: When the block was created.
-
- Data: Custom data stored in the block.
-
- Previous Hash: The hash of the previous block.
-
- Hash: The block's unique identifier, calculated based on its contents.
- Blocks are linked together, forming a chain, and the integrity of the chain is ensured by validating hashes.