Feature: Implement Digital Signatures (Public/Private Key Cryptography) for Transactions

Đã đóng
#13 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@sohanjadyal đang làm issue này rồi.

Từ ngày 9/10/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
blockchain, security

Hướng nghiên cứu

Start by reading Transaction.java, Blockchain.java, and BlockchainTest.java to understand transaction creation, validation, and existing test patterns. Then check how chain.dat is serialized and how its compatibility is handled. Done means wallets can generate key pairs, transactions can be signed and verified, invalid or unsigned transactions are rejected, and tests cover valid and forged transactions.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description:
Currently, our mini-chain relies entirely on a trust-based system where users manually type in the sender's name when creating a transaction. This means there is no concept of ownership or authentication, and anyone can easily spend someone else's coins by simply typing in their name.

To make this project behave like a real-world blockchain, I believe we should introduce cryptographic authentication to verify the sender of every transaction.

Proposed Solution:
Implement Public/Private key cryptography (e.g., using Java's built-in java.security.KeyPairGenerator with RSA or ECDSA).

  1. Wallets: Create a Wallet concept where every user generates a PrivateKey (used for signing) and a PublicKey (which acts as their network address).
  2. Transaction Signing: When sending coins, the Transaction class should include a new method to generate a digital signature using the sender's PrivateKey.
  3. Transaction Verification: The Transaction class should include a method to verify the signature using the sender's PublicKey.
  4. Validation Logic: Update Blockchain.java so that addTransaction() and isValid() refuse any transactions that do not contain a valid cryptographic signature.
  5. (Optional) Update Main.java to simulate creating a wallet on startup if one doesn't exist.

Acceptance Criteria:

  • A Wallet class (or similar logic) exists to generate KeyPairs.
  • Transaction class stores a digital signature and the sender's Public Key.
  • Transaction has signTransaction(PrivateKey) and verifySignature() methods.
  • Blockchain.java rejects unsigned or improperly signed transactions.
  • BlockchainTest.java includes tests verifying that forged transactions are rejected and valid signatures are accepted.

Additional Context:
This will require a minor change to the Transaction model, which will likely break backward compatibility with older chain.dat files. We should increment the serialVersionUID or warn users to delete their existing .dat files when this is merged.

Ngôn ngữ chính
Java
Star
0
Fork
3
Merge trung bình
2 ngày 5 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của techcsispit/mini-chain

Tất cả issue của techcsispit/mini-chain

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.