This is a basic blockchain implementation in Java, demonstrating core blockchain concepts like blocks, mining, transactions, digital signatures, and wallets.
Crypto/
├── src/
│ └── main/
│ └── java/
│ └── org/
│ └── arun/
│ ├── Block.java
│ ├── NoobChain.java
│ ├── StringUtil.java
│ ├── Transaction.java
│ ├── TransactionInput.java
│ ├── TransactionOutput.java
│ └── Wallet.java
├── pom.xml
└── README.md
- Java 8 or higher
- Maven
- IDE (e.g., IntelliJ IDEA)
Make sure your pom.xml includes the following (already set if you're running correctly):
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.13.1</version>
</dependency>
</dependencies>- Hashing with SHA-256
- Proof-of-Work mining with adjustable difficulty
- Transactions and Merkle root calculation
- ECDSA-based digital signatures for verification
- Basic wallet system with UTXO model
- Chain validation
Run the NoobChain.java main class from your IDE or via terminal:
mvn compile
mvn exec:java -Dexec.mainClass="org.arun.NoobChain"Creating and Mining Genesis block...
Transaction Successfully added to Block
Block Mined!!! : 000dda84948cae9926cfe5981e389403441ba26dad12dc04be214bf36c05bb73
WalletA's balance is: 100.0
WalletA is Attempting to send funds (40) to WalletB...
Transaction Successfully added to Block
Block Mined!!! : 0003ac3480367f5ffb1fab75ebd18f58ec8c92e598c96be8cbf8d75d80ed9535
WalletA's balance is: 60.0
WalletB's balance is: 40.0
WalletA Attempting to send more funds (1000) than it has...
#Not Enough funds to send transaction. Transaction Discarded.
Block Mined!!! : 00053b3d124413dfaa74f99ad180ba8e1030a7f2bdcdb7661eece79f246f6e17
WalletA's balance is: 60.0
WalletB's balance is: 40.0
WalletB is Attempting to send funds (20) to WalletA...
Transaction Successfully added to Block
WalletA's balance is: 80.0
WalletB's balance is: 20.0
Blockchain is valid
- Implement network communication (P2P)
- Persistent storage (e.g., via database or file)
- Improved transaction pool and mempool logic
- Blockchain explorer (web UI)
This project is licensed under the MIT License.
Arun –