Printing an algorand address with Log Opcode - General - Algorand

Printing an algorand address with Log Opcode

post by javier0rosas on Nov 9, 2021

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?

post by Ben on Nov 9, 2021

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

algosdk.encoding.encode_address