Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Enhancement: Migrate to native Ed25519 signatures and public-key address derivation

オープン
#31 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@sohanjadyal がすでに取り組んでいます。

2026年10月16日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java

調査の方向性

Start with Main.java, Transaction.java, and Blockchain.java to trace key generation, signing, address validation, and CLI wallet handling; then review BlockchainTest.java, SignatureTamperingTest.java, and ReadmeRulesTest.java. Implementing the proposed migration spans identity, transaction validation, wallet behavior, and existing tests. Done means Ed25519 signatures verify, mismatched sender addresses are rejected, recipients can receive spendable funds, and the listed tests cover the changes.

索引モデルが issue の本文から書いたものです。

説明

Summary

The current cryptographic identity implementation in mini-chain relies on deprecated 1024-bit RSA keys and allows accounts to use arbitrary human-readable string aliases (e.g., "Alice", "Asha").

This architecture introduces two primary vulnerabilities:

  1. Deprecated Cryptography: 1024-bit RSA keys and signatures are bulky, slow, and cryptographically deprecated. Modern blockchains exclusively utilize Elliptic Curve cryptography (such as Ed25519 or secp256k1).
  2. Name Squatting & Front-Running: In Blockchain.java, the chain associates an arbitrary username with whichever public key is submitted first in knownKeys. A malicious participant can observe a pending transaction or front-run an identity, registering another user's name with their own key.

This issue proposes migrating key pairs and digital signatures to Java 17's native Ed25519 algorithm, deriving account addresses cryptographically from public keys, and ensuring recipient wallets are automatically initialized in the CLI.


Current Behavior & Code References

  1. RSA-1024 Key Generation & Signatures:
    • Main.java (L21–22): KeyPairGenerator.getInstance("RSA") with 1024-bit key length.
    • Transaction.java (L30, L44): Signature.getInstance("SHA256withRSA").
  2. Vulnerable Plaintext Key Binding:
    • Blockchain.java (L38–43):
      PublicKey known = knownKeys.get(tx.from());
      if (known == null) {
          knownKeys.put(tx.from(), tx.senderKey());
      } else if (!known.equals(tx.senderKey())) {
          throw new IllegalArgumentException("Transaction uses a different key...");
      }
      
      Because tx.from() is an arbitrary string, anyone can claim and lock another user's name before that user broadcasts their first transaction.

Proposed Solution

1. Upgrade Signatures to Native Java 17 Ed25519
  • Migrate key generation and signing to Ed25519 (EdDSA) with zero external dependencies:
    KeyPairGenerator generator = KeyPairGenerator.getInstance("Ed25519");
    Signature sig = Signature.getInstance("Ed25519");
    
  • Produces compact 32-byte public keys and 64-byte signatures natively supported in Java 17+.
2. Cryptographic Address Derivation
  • Add a helper method in Blockchain / Transaction:
    public static String deriveAddress(PublicKey key) {
        // Hex-encoded SHA-256 digest of key.getEncoded()
        ...
    }
    
  • Enforce in Blockchain.addTransaction() that for non-network transactions:
    • tx.from() must match the derived address of tx.senderKey().
    • Eliminates arbitrary username hijacking and front-running.
3. Recipient Wallet Handling in CLI (Main.java)
  • Update CLI address resolution so users can continue interacting with friendly names while underlying transactions bind cryptographically:
    • Map names to wallets locally in wallets.dat.
    • When sending to a new recipient name, automatically generate and save their wallet key pair (getWallet(to)) so funds sent to any user remain spendable.
4. Unit & Integration Tests
  • Update all test cases in BlockchainTest.java, SignatureTamperingTest.java, and ReadmeRulesTest.java to use Ed25519.
  • Add tests verifying:
    • Valid Ed25519 signing and verification.
    • Rejection of transactions where from does not match the derived address of senderKey.
    • Front-running protection across accounts.
主要言語
Java
スター
0
フォーク
3
平均マージ
1日 22時間
マージ済み PR(30日)
10

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

techcsispit/mini-chain のほかの issue

techcsispit/mini-chain の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。