1

I stumbled across this interesting code on Reddit for generating Ethereum private keys with terminal:

cat /dev/urandom |LC_ALL=C tr -dc '0-9a-f' | fold -w 64 | head -n 1

Of course the randomness and everything would be sufficient but is it possible that this could generate an invalid key? Are all keys generating in this manner valid or does Ethereum have some weird exception rules?

1 Answer 1

1

You are generating a random 32 bytes number, not a private key. It could be a private key, but for that to happen it has to have a corresponding public key based on some rules. Here is an excellent article on how to accomplish that.

3
  • So from what I understand this will work so long as it generates a number at or beneath FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 Commented Jan 4, 2018 at 21:59
  • @AlbertRenshaw Also the 0 is not a valid private key.
    – Ismael
    Commented Jan 5, 2018 at 0:11
  • Related for both comments above: ethereum.stackexchange.com/questions/1771/…
    – eth
    Commented Jan 5, 2018 at 9:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.