0

As far as I understand, a private key in the context of Ethereum is simply 256 random bits. The actual application of secp256k1 comes in when converting this to the public key, signing, etc. Based on this, is there anything wrong with generating a private key in python by simply doing the following (and doing any other operations using a library such as the web3 family) ?

import random
key = hex(random.getrandbits(256))

Or are there, for example, security issues when doing this?

2
  • 1
    In Ethereum private keys has to be in a range defined by secp256k1 curve, see ethereum.stackexchange.com/a/2320 for the precise numbers.
    – Ismael
    Commented May 20, 2020 at 15:28
  • 1
    Exactly the answer I was looking for, thank you!
    – user49342
    Commented May 20, 2020 at 16:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.