I am trying to create a private key and its corresponding public key using EthereumJS library. So far so good I've been able to create private keys using keythereum.create() method. Nevertheless I find myself stuck when dealing with public key.
I heard using Elliptic Curve Digital Signature Algorithm (ECDSA) it is possible to get an Ethereum Public Key (64 bytes long) from its Private Key. The question is how can I code this process using EthereumJS library. Maybe there is some simple method to derive public key, but I cannot find it. Any help will be appreciated.
I found some limited info on previous StackExchange questions but I would prefer an answer focused on EthereumJS:
How are ethereum addresses generated?
Creating keyfile and address from private key
Thanks!
npm i ethereumjs-wallet– max taldykin Jun 25 '18 at 04:23toBufferfrom ethereumjs-util - the link to the documentation is: https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/README.md#tobuffer – SCBuergel Aug 07 '19 at 06:05_hdkey._privateKey. Consider using the public API. – Slava Fomin II Aug 05 '21 at 22:05const wallet = Wallet.fromPrivateKey(privateKey)there's no such method – ekkis Sep 14 '22 at 00:49