DEV Community

Cover image for Bytes To Private Key
Mmdrza for blockthon

Posted on

Bytes To Private Key

Private Key (hex) from bytes

first needed install blockthon:

pip install blockthon
Enter fullscreen mode Exit fullscreen mode

linux :

sudo apt-get update&&sudo apt-get upgrade -y
sudo apt-get install -y autoconf automake build-essential libffi-dev libtool pkg-config python3-dev
pip3 install blockthon
Enter fullscreen mode Exit fullscreen mode

after install from Blockthon.Wallet import Bytes_To_PrivateKey , in this example first generated random bytes (seed) and convert to hex private key:

from Blockthon.Wallet import getBytes, Bytes_To_PrivateKey
# generated random bytes without repeat
bytes_str = getBytes()
# convert bytes to hex private key
privatekey = Bytes_To_PrivateKey(bytestring=bytes_str)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)