pywallet
pywallet copied to clipboard
How to get private key from ethereum wallet?
This package is good to me. Using this package, I generated ethereum wallet.
Here, private key is as follow.
0488ade4039c7ed931800000009f85cde1810467f199d7e0b6b2edaa6bc2f960b66ea61af9e35477c50e2243da00494c713bd615f7bef54adca9292cbd86e9f077e6a0ee33553258a2d961793a4e
But when I send transaction using web3.py, required private key has 32 bytes long. Above key is too long. I can't use this. How can I get private key to be required to send transaction? Help me.
I spent a while looking through the code and I also couldn't figure out...
Any update on this?
Had the same issue, install this library and use the code below to get the actual private key:
from crypto import HDPrivateKey, HDKey, PrivateKey
def decode(pkey_hex):
assert len(pkey_hex) == 156
pkey = HDPrivateKey.from_hex(pkey_hex)
keys = HDKey.from_path(pkey, '{change}/{index}'.format(change=0, index=0))
private_key = keys[-1]
public_key = private_key.public_key
print(' Private key (hex, compressed): 0x' + private_key._key.to_hex())
print(' Address: ' + private_key.public_key.address())
def main():
keys = [
'0488ade4039c7ed931800000009f85cde1810467f199d7e0b6b2edaa6bc2f960b66ea61af9e35477c50e2243da00494c713bd615f7bef54adca9292cbd86e9f077e6a0ee33553258a2d961793a4e'
]
for k in keys:
decode(k)
if __name__ == '__main__':
main()
Hello @hurlenko Not working for me.
from Crypto.Util.py3compat import byte_string
ImportError: cannot import name 'byte_string'
Hi @henrytom1703, I used python 3.6, worked for me. Create new virtual environment, git clone this repo, run pip install -r requirements.txt
then try again