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.
from bitcoinlib import keys
k = keys.Key("L1pQn89VyJ7hTCTRLeuFMEpW4ZDqR9s2JnQMzhukBjAHme8NtD2d")
print(k.address(script_type="p2pkh", encoding="base58"))
Outputs:
1111GxfgFVyDW3zcFpUF1upSZoL7GCRiLk
This is incorrect, one leading 1 is extra. Public key hash is: 00003acd8f60b766e48e9db32093b419c21de7e9
Together with version prefix 00 this gives 3 leading zero bytes. Base58 encoding rules in the area of leading zeroes are: add one 1 for each leading zero byte. Thus, we must have 3, not 4 leading 1s. Base58 encoding in other libraries produce correct address: 111GxfgFVyDW3zcFpUF1upSZoL7GCRiLk
from bitcoinlib import keys k = keys.Key("L1pQn89VyJ7hTCTRLeuFMEpW4ZDqR9s2JnQMzhukBjAHme8NtD2d") print(k.address(script_type="p2pkh", encoding="base58"))
Outputs:
1111GxfgFVyDW3zcFpUF1upSZoL7GCRiLk
This is incorrect, one leading 1 is extra. Public key hash is: 00003acd8f60b766e48e9db32093b419c21de7e9
Together with version prefix 00 this gives 3 leading zero bytes. Base58 encoding rules in the area of leading zeroes are: add one 1 for each leading zero byte. Thus, we must have 3, not 4 leading 1s. Base58 encoding in other libraries produce correct address: 111GxfgFVyDW3zcFpUF1upSZoL7GCRiLk