fix(web): generate native Ed25519 wallet keys (#8205) - #8206
Conversation
Signed-off-by: iQodeIT <1.62815903e+08+iQodeIT@users.noreply.github.com>
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
FlintLeng
left a comment
There was a problem hiding this comment.
PR Review: Native Ed25519 Wallet Key Generation
Reviewed on: 2026-08-13
Summary
Fixes #8205. Replaces P-256 ECDSA with native Ed25519 key generation in the hosted RustChain web wallet. RTC addresses are now derived from Ed25519 public keys, matching the native wallet format used by the RustChain protocol.
Security Analysis ✅
Why Ed25519? RustChain uses Ed25519 for native wallet signatures. A P-256 key cannot sign native RTC transfers. The web wallet was generating keys that would be incompatible with the protocol — a fundamental mismatch. This fix aligns the web wallet with the native wallet format.
Web Crypto API implementation is correct:
crypto.subtle.generateKey({ name: 'Ed25519' }, true, ['sign', 'verify'])— modern browsers support Ed25519 natively via Web Crypto (Chromium-based since 2024, Safari since 2023)- Exports JWK with
d(32-byte private seed) andx(32-byte raw public key) per RFC 8032 — correct Ed25519 encoding - RTC address derivation:
RTC + SHA256(pubkey)[:40]— matches the native wallet address format
Client-side only, no server round-trip: The warning banner explicitly states "Everything happens in your browser. No data is sent to any server. Your private key never leaves this page." This is the correct security model for a key-generation page.
Code Quality ✅
Error handling is present: Key generation errors fall back to "ERROR — TRY AGAIN" state. Length checks on pubKeyHex and privKeyHex (must be 64 hex chars / 32 bytes) catch malformed exports.
Test coverage: test_wallet_page_ed25519.py parses the HTML, extracts the inline JS, and asserts:
- Ed25519 key generation code is present
crypto.subtle.generateKeyis called with Ed25519 params- JWK
dandxfields are used - Address format matches
RTCprefix + 40 hex chars
Minor notes:
- The HTML includes a "Selya" chat widget (
.selya-btn,.selya-panelclasses) — this appears to be an embedded support chat. Worth confirming this is intentional and the third-party script is approved. - The warning banner is excellent ("NOT a Solana/ETH/BTC address") — prevents user confusion about wRTC vs RTC.
Wallet: RTC019e78d600fb3131c29d7ba80aba8fe644be426e
✅ LGTM — correct fix that aligns the web wallet with native Ed25519 wallet format, with appropriate security warnings and test coverage.
Summary
Fixes #8205 by making the public RustChain web wallet generate native Ed25519 key material instead of P-256 ECDSA keys.
The hosted page previously generated
{ name: 'ECDSA', namedCurve: 'P-256' }, hashed P-256 coordinates into an RTC-formatted address, and labeled the result as a native wallet. That address could not be used consistently with RustChain's Ed25519 signed-transfer implementation.Changes
site/wallet.htmlsource for the deployed wallet page.Ed25519.xpublic-key andd32-byte seed fields.tools/rustchain_wallet_cli.py.curve: 'Ed25519'in downloaded wallet metadata.Validation
python3 -m unittest -v tests/test_wallet_page_ed25519.pynode --checkon the extracted inline wallet script.file:///home/ubuntu/Rustchain/site/wallet.html: generation succeeded and displayed a 32-byte public key, a 32-byte private seed, and an RTC address derived from the public key.This is wallet/crypto-sensitive work and should be reviewed under the repository's
BCOS-L2guidance.Signed-off-by: iQodeIT 1.62815903e+08+iQodeIT@users.noreply.github.com