0

I want to generate Public-Private Key pair using ECC and then import them to Ethereum for creating an account through Geth. I am working on a Windows machine.

What are the steps I should follow for that?

I believe OpenSSL can be used in such a case. How can I proceed with that?

1

Here is a high level Python example how to generate Ethereum private and public key (address pair).

You can import the private key using personal.importRawKey(hex_key, password) JSON-RPC API.

Most of Ethereum software uses secp256k1 library that is used also in Bitcoin. For other programming languages please refer to high level Ethereum libraries or low level secp256k1 bindings.

import bitcoin
from secp256k1 import PrivateKey

def get_ethereum_address_from_private_key(private_key_seed_ascii: str) -> str:
  """Generate Ethereum address from a private key.

  https://github.com/ethereum/pyethsaletool/blob/master/pyethsaletool.py#L111

  :param private_key: Any string as a seed, the actual private key will be sha3 hash of this seed. Note that this is not any mnemonic compatible way of generating private keys from seeds.

  :return: 0x prefixed hex string
  """
    priv = utils.sha3(private_key_seed_ascii)
    pub = bitcoin.encode_pubkey(bitcoin.privtopub(priv), 'bin_electrum')
    return "0x" + binascii.hexlify(sha3(pub)[12:]).decode("ascii")
  • Thanks for the help! But I'm restricted to use only OpenSSL in my case. – Akhil Kintali Apr 18 '18 at 8:44

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.