Skip to content

Conversation

@omar-hgraph
Copy link

HIP-1190: ECDSA/Ed25519 Wallet Support

Overview

Critical fix enabling HIP-1190 multi-node transaction signing to work correctly with both ECDSA (EIP155) and Ed25519 (native Hedera) accounts.

Problem Statement

hedera_signTransactions was failing with invalid signature errors when invoked by EIP155/ECDSA accounts, while other Hedera methods (hedera_signMessage, hedera_signTransaction) worked correctly.

Root Cause:

  • When ECDSA accounts connected via EIP155 namespace, they could also use Hedera namespace methods
  • The wallet had only one HIP820Wallet instance initialized with Ed25519 key
  • When hedera_signTransactions was called on an ECDSA session, it used the wrong key (Ed25519 instead of ECDSA)
  • Result: Signature mismatch and transaction rejection

Solution

Implement dual HIP820 wallet instances with intelligent routing based on session account type.

Implementation Details

Dual Wallet Initialization (lines 203-226)

// Ed25519 wallet for native Hedera operations
const hip820Wallet = HIP820Wallet.init({
  chainId: [hedera:${network}](http://_vscodecontentref_/0),
  accountId: ed25519AccountId,
  privateKey: ed25519PrivateKey,
})

// ECDSA wallet for EIP155-originated Hedera operations
const hip820WalletEcdsa = HIP820Wallet.init({
  chainId: [hedera:${network}](http://_vscodecontentref_/1),
  accountId: ecdsaAccountId,
  privateKey: ecdsaPrivateKey,
})

Code Quality Improvements

  • Proper TypeScript null safety with non-null assertions
  • Fixed type assertions for account objects (as const)
  • Added comprehensive JSDoc documentation
  • Updated useEffect dependencies to include new wallet instances

Testing

  • ECDSA accounts (EIP155) can successfully call [hedera_signTransactions]
  • Ed25519 accounts (native Hedera) continue to work correctly
  • No TypeScript errors
  • Proper signature validation for both account types

Breaking Changes
None - this is a bug fix ensuring correct behavior

Switch to file link for active HIP-1190 development.

Changes:
- Update dependency path: file:../../ → file:../
…ECDSA accounts

- Initialize dual HIP820 wallet instances (ECDSA and Ed25519)
- Add intelligent wallet selection based on session account type
- Route hedera_signTransactions to correct wallet instance
- Implement proper null safety with non-null assertions
- Fix TypeScript type assertions for account objects
- Update useEffect dependencies for wallet instances

This ensures hedera_signTransactions uses the correct private key
matching the connected account type, preventing signature mismatches
when ECDSA accounts invoke Hedera namespace methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant