I need a bech32 wallet address and all that I have is my wallet PKH and a wallet Id. Is there a way to derive that bech32 address in python?

Needed to perform queries on blockfrost and find how much amount of ADA I have in my wallet.

1 Answer 1


You can use pycardano to derive the address from a public key file.


from pycardano import Key, Address, Network

pk = Key.load("/path/to/payment.vkey")
pkh = pk.hash()
addr = Address(payment_part=pkh, Network.MAINNET)

If you already have the public key hash, use the following code to get pkh:

from pycardano import VerificationKeyHash
pkh = VerificationKeyHash(bytes.fromhex("1234abcd..."))

You can learn more about key and address manipulations in this page: https://pycardano.readthedocs.io/en/latest/guides/address.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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