Thanks for the answer. Which address are you referring to after the OP_RETURN, is it
bc1qqpfgj5zwguxs5xs2qqqqqr2ffpz9yqqqqqqsqqqqqyqsxqqqqqjsma5wzf
Yes.
When I convert it to hex, I do not find the sequence 0x504e47.
In the link above, if you click on the Details button below the Diagram it will break the tx down to its components which is also decoding the address. It's a quick way of finding 0x504e47.
# decode to obtain a list of integers between 0 and 31
b = bech32.bech32_decode(addr)[1]
# convert from 5 bits to 8 bits encoding
decoded_data = bech32.convertbits(b, 5, 8, False)
Try using the
decode method instead of
bech32_decode when you want to decode an address that should solve the problem. It handles things better like removing the first 5-bits which is the witness version (
convertbits(b[1:], 5, 8, False))
https://github.com/sipa/bech32/blob/master/ref/python/segwit_addr.py#L114