Ethereum Asked by Conviley on November 29, 2021
I’m using https://iancoleman.io/bip39/#english to generate a random 12 word mneumonic with the following settings.
It generated the following mneumonic movie diesel same toe bachelor acquire roast ghost siege thought possible scale
The first address – public key – private key is the following
Address: 0x67D8641084F8088D5996E39Bae07F9Dc4130307F
Public Key: 0x030c8931742732ca2e0956ecf385acc886a54428ad84eb884aa2c72f1008a2c858
Private Key: 0x78f7e532bf8d7c79d8ef42c75a361f53a8db8c38e4cb1828788ef119c48f6896
I wrote this to generate the same public key from the private key.
var Wallet = require('ethereumjs-wallet')
var EthUtil = require('ethereumjs-util')
// Get a wallet instance from a private key
const privateKeyBuffer = EthUtil.toBuffer(
'0x78f7e532bf8d7c79d8ef42c75a361f53a8db8c38e4cb1828788ef119c48f6896'
)
const wallet = Wallet.fromPrivateKey(privateKeyBuffer)
// Get a public key
const publicKey = wallet.getPublicKeyString()
console.log(publicKey)
the log statment prints 0x0c8931742732ca2e0956ecf385acc886a54428ad84eb884aa2c72f1008a2c8582bc50fd34eb9e111ae2969205d7af28e9b5050be4ae6ca43df74fc65b9af5803
This is not the same public key for the corresponding private key, why is this?
Public Key:
0x030c8931742732ca2e0956ecf385acc886a54428ad84eb884aa2c72f1008a2c858
A public key consists of 512 bits, represented with a string of 128 hexadecimal characters.
Hence the above is not a valid public key.
0x0c8931742732ca2e0956ecf385acc886a54428ad84eb884aa2c72f1008a2c8582bc50fd34eb9e111ae2969205d7af28e9b5050be4ae6ca43df74fc65b9af5803
is not the same public key for the corresponding private key
This is in fact the correct public key for the private key given in the question.
Answered by goodvibration on November 29, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP