1

Is there a calculation to convert Ethereum private keys to the public address, without being connected to the internet?

3

Transforming a private key to a public key does not require the network. It's only cryptography. The network does not do any computation for you to give you the answer.

An easier solution using Node.js:

> const Wallet = require('ethereumjs-wallet');
undefined
> Wallet.fromPrivateKey(Buffer.from('208065a247edbe5df4d86fbdc0171303f23a76961be9f6013850dd2bdc759bbb', 'hex')).getAddress().toString('hex');
'0bed7abd61247635c1973eb38474a2516ed1d884'
1

I found a solution using nodejs:

const createKeccakHash = require('keccak')
const secp256k1 = require('secp256k1')
const privateKey = new Buffer('<PRIVATE KEY>', 'hex');
let pubKey = secp256k1.publicKeyCreate(privateKey, false).slice(1);
//console.log(pubKey);
let address = createKeccakHash('keccak256').update(pubKey).digest().slice(-20).toString('hex');
console.log('0x'+address);
  • See my answer for an easier version. – smarx Jan 14 '18 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.