Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Enhancement: Implement binary Merkle tree root in Block header

Open
#27 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@sohanjadyal is already working on this.

Since Oct 13, 2026.

  • #28 by @sohanjadyal — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start with Block.java, Transaction.java, Blockchain.java, and Main.java to trace how transaction data is hashed, addresses are assigned, and RSA keys sign transactions. Then review BlockchainTest.java and Storage.java for the affected behavior. Done means transaction hashes include all listed fields, blocks use a Merkle root, addresses derive from public keys, and signing uses Ed25519 with updated tests and storage.

Written by the indexing model from the issue text.

Description

advanced feature

Summary

The current cryptographic implementation and block hashing mechanisms in mini-chain rely on deprecated primitives (RSA-1024), fragile string formatting (toString()), and unverified string aliases.

This issue proposes modernizing the project's cryptographic and data architecture to reflect production blockchain standards while keeping zero external dependencies (leveraging native Java 17 features).


Current Problems & Proposed Solutions

1. Merkle Trees for Block Transactions
  • Location: Block.java
  • Current Behavior: Transactions are hashed using basic string concatenation:
    String content = index + "|" + timestamp + "|" + previousHash + "|" + nonce + "|" + transactions;
    
  • Problem: Blocks do not use a cryptographic accumulator tree. This prevents demonstrating Merkle inclusion proofs and SPV (Simplified Payment Verification).
  • Proposed Solution: Build a binary Merkle Tree from transaction hashes and store the resulting 32-byte merkleRoot in the Block header instead of concatenating transaction lists.

2. Decouple Block Hashing from Transaction.toString()
  • Location: Block.java & Transaction.java
  • Current Behavior: Concatenating transactions invokes Transaction.toString(), which only returns:
    return from + " -> " + to + ": " + amount;
    
  • Problem: Crucial fields like id, senderKey, and signature are completely excluded from the block hash. Modifying any of these fields on an existing transaction in a block leaves block.computeHash() unchanged.
  • Proposed Solution: Introduce a deterministic hash() method on Transaction that hashes all fields (id, from, to, amount, senderKey, signature), and compute the block hash/Merkle root strictly from transaction hashes.

3. Cryptographic Address Derivation (Prevent Name Squatting)
  • Location: Blockchain.java
  • Current Behavior: The chain associates a human-readable string (e.g. "asha") with the first public key seen in knownKeys:
    PublicKey known = knownKeys.get(tx.from());
    if (known == null) {
        knownKeys.put(tx.from(), tx.senderKey());
    }
    
  • Problem: Front-running vulnerability — anyone can claim and lock another user's name before that user broadcasts their first transaction.
  • Proposed Solution: Derive user addresses directly from public keys (e.g., hex-encoded SHA-256 of the public key), decoupling identities from vulnerable arbitrary usernames.

4. Transition from RSA-1024 to Native Ed25519 Signatures
  • Location: Main.java, Transaction.java, BlockchainTest.java
  • Current Behavior: Uses RSA 1024-bit key pairs and SHA256withRSA.
  • Problem: RSA-1024 is cryptographically deprecated, produces large keys/signatures, and is not representative of modern blockchains.
  • Proposed Solution: Migrate to Java 17’s native built-in EdDSA (Ed25519) using:
    KeyPairGenerator.getInstance("Ed25519");
    Signature.getInstance("Ed25519");
    
    This delivers compact 32-byte public keys and 64-byte signatures natively with zero third-party dependencies.

Action Items

  • Add Transaction.hash() incorporating all record fields.
  • Implement binary Merkle Tree computation in Block and replace transactions in computeHash() with merkleRoot.
  • Migrate key generation and signing from RSA-1024 to standard Java 17 Ed25519.
  • Derive account addresses from public key hashes to eliminate name squatting.
  • Update BlockchainTest.java and Storage.java to support the updated structure.
Dominant language
Java
Stars
0
Forks
3
Avg merge
16h 38m
Merged PRs (30d)
7

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from techcsispit/mini-chain

All issues in techcsispit/mini-chain

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.