Printing an algorand address with Log Opcode

I want to print Gtxn[1].receiver() using the log opcode. The smart contract is running fine, but when I try to print the results using:

results = base64.b64decode(key)
results = print("\t{}".format(results))

It prints something like this:

b’}\x89V\xc4\x14w\xaf<\x07\xbc\xa8\x93\xb6\x1b\xafh\xfbKT@\xd2F \x16\x8c\xc8d\xb5f\x02 b

How do I decode this to show the actual algorand address?

Thats the 32 byte public key, you can use algosdk.encoding.encode_address to turn it into the 58byte version you’re used to seeing

https://py-algorand-sdk.readthedocs.io/en/latest/algosdk/encoding.html#algosdk.encoding.encode_address

1 Like