hedera-sdk-js: PublicKey.fromStringECDSA is not a function

Description

I’m trying to construct a PublicKey instance from the ECDSA public key string as follows:

import {
  PublicKey,
} from "@hashgraph/sdk";

const eoaAddress = '0xe15A8699a85558E570a0d0d5DE533bd23cE64d4A';
const publicKey = PublicKey.fromStringECDSA(eoaAddress);

But I get the following TypeError:

TypeError: PublicKey.fromStringECDSA is not a function

Steps to reproduce

I can create an example, but I think the above is sufficient.

Additional context

No response

Hedera network

testnet

Version

@hashgraph/sdk@2.19.2

Operating system

None

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@ochikov thanks, just confirmed that it works on testnet!

Hello @mshakeg There is a slight change and we are not releasing this functionality in https://github.com/hashgraph/hedera-sdk-js/releases/tag/v2.20.0 I will keep you updated about the release of HIP-583, but I think that this functionality will not be presented at all!

Yes, as well as when it is available there, we are going to release the 2.20.0 stable version.

You need to switch to version 2.20.0-beta.4. This functionality is presented there.

Hi @mshakeg , the EVM address is actually the last 20 bytes of the hashed (keccak-256) public key. It’s not a matter of the correct function to use, you simply cannot retrieve the public key starting from the EVM address.

What exactly are you trying to achieve? Maybe we can find another solution.