Enhancement: Migrate to native Ed25519 signatures and public-key address derivation
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- backend, cryptography
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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:
- 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).
- Name Squatting & Front-Running: In
Blockchain.java, the chain associates an arbitrary username with whichever public key is submitted first inknownKeys. 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
- RSA-1024 Key Generation & Signatures:
Main.java(L21–22):KeyPairGenerator.getInstance("RSA")with 1024-bit key length.Transaction.java(L30, L44):Signature.getInstance("SHA256withRSA").
- Vulnerable Plaintext Key Binding:
Blockchain.java(L38–43):
BecausePublicKey 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..."); }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 oftx.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.
- Map names to wallets locally in
4. Unit & Integration Tests
- Update all test cases in
BlockchainTest.java,SignatureTamperingTest.java, andReadmeRulesTest.javato useEd25519. - Add tests verifying:
- Valid
Ed25519signing and verification. - Rejection of transactions where
fromdoes not match the derived address ofsenderKey. - Front-running protection across accounts.
- Valid
- 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de techcsispit/mini-chain
-
Blockchain.isValid() does not verify sender balance, allowing blocks with negative balances to pass validationPosiblemente ocupada @aadiitya2007 la tomó hace 7 días. Abiertobug good first issue
Dificultad 4/5 1-2 días Aptitud para principiantes 20/100
techcsispit/mini-chain#37 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads itPosiblemente ocupada @tanujb03 la tomó hace 26 días. Abiertodocumentation good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 25/100
techcsispit/mini-chain#21 ·
Los mantenedores suelen responder en 2 días
Todos los issues de techcsispit/mini-chain
Issues similares
-
Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
MCP add-on: JSON responses with non-ASCII characters are truncated (wrong Content-Length)Posiblemente ocupada @dhanushbs10 la tomó hoy. Abiertoadd-on bug in:mcp
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
vaadin-map
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
vaadin/flow-components#10586 ·
Los mantenedores suelen responder en 1 día
-
WeReadInstaller writes the launcher database on the main thread at handover (Activity pause timeout)Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
wpilibsuite/SystemcoreTesting#446 ·
Los mantenedores suelen responder en 1 día