Is there a calculation to convert Ethereum private keys to the public address, without being connected to the internet?
2 Answers
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);
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'