[Ethereum] Convert Ethereum private key to public key (without network)

private-keypublic-key

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

Best Answer

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);