1200wd / bitcoinlib

Bitcoin and other Cryptocurrencies Library for Python. Includes a fully functional wallet, Mnemonic key generation and management and connection with various service providers to receive and send blockchain and transaction information.
http://bitcoinlib.readthedocs.io/
GNU General Public License v3.0
613 stars 204 forks source link

Using BIP38 encrypted Private Key throw error #362

Closed alex-frx closed 8 months ago

alex-frx commented 10 months ago

When using a BIP38 encrypted Private Key I get an: EncodingError: Unrecognised password protected key format. Flagbyte incorrect. Error

Minimal example:

from bitcoinlib.keys import Address,Key

public_address = "1CTHRG6Te7dvbb5RQ6JuDv6tNdMH6Fahic"
private_key = "6PnV1MS7UY4wjdAGucW2MdTuDNiTvQPthTjiMex6HNv2NfLXLk8CKQfCnL"
password = "hallohallo"

key = Key(private_key, password=password)
print(key.info())

The pair were generated using bitaddress.org

or am I using it wrong

mccwdev commented 10 months ago

EC multiplied BIP38 addresses are not supported at the moment. For now I made commit https://github.com/1200wd/bitcoinlib/commit/fe5f9b60d694cda59ab51544164cc329e2dbdd52 to raise a more informative error.

mccwdev commented 8 months ago

Added EC multiplied keys in release 0.7 and commit 7b1c01607f5231213ec0c26415ea91efeecdd6e4