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

Cerrado
#13 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@sohanjadyal ya está trabajando en esto.

Desde el 9/10/2026.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
0
Forks
3
Merge medio
2 d 5 h
PR fusionados (30 d)
15

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de techcsispit/mini-chain

Todos los issues de techcsispit/mini-chain

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.