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?


Your Answer

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

Browse other questions tagged or ask your own question.