Skip to content

Update GenerateKeyExample to use ECDSA instead of ED25519 #2690

@ed-marquez

Description

@ed-marquez

Summary

`GenerateKeyExample.java` currently generates an ED25519 key pair using `PrivateKey.generateED25519()`. This is misleading because ECDSA (secp256k1) with an EVM address derived from the public key is now the recommended key type for new Hedera accounts.

File: `examples/src/main/java/com/hedera/hashgraph/sdk/examples/GenerateKeyExample.java`
https://github.com/hiero-ledger/hiero-sdk-java/blob/main/examples/src/main/java/com/hedera/hashgraph/sdk/examples/GenerateKeyExample.java

Current behavior

```java
PrivateKey privateKey = PrivateKey.generateED25519();
```

The example only shows ED25519 key generation and does not demonstrate ECDSA key creation or EVM address derivation.

Desired behavior

Update the example to:

  1. Use `PrivateKey.generateECDSA()` as the primary (recommended) path.
  2. Show how to derive the EVM address from the ECDSA public key.
  3. See this example: https://portal.hedera.com/playground/session/0.0.7785355/9

Why

Hedera is actively migrating the ecosystem toward ECDSA (secp256k1) keys with EVM addresses derived from the public key. This aligns Hedera accounts with Ethereum tooling (MetaMask, Hardhat, ethers.js, wagmi) and enables full EVM compatibility.

Leaving this example as ED25519-only reinforces the wrong default for developers learning the SDK.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions