I’m trying to get my head around converting an account info in the global state into the public key.
I read many answers here but couldn’t get it.
I assume that the “bytes” is the base64 of the public address of the funding account based on the value I read from the global state:
"key": "RlVOREFDQ09VTlQ=", //FUNDACCOUNT
"bytes": "/sj/9sN19Vz0gYPW8r14ok7IyVFlHrqj7dPpf1wqtwA=", // <-- is this a Encoded64 public key?
I tried a few things using the Algo JS SDK. I’m trying to get something similar to what Algo Explorer does by displaying the right human-readable public key.
Could someone help me?
Welcome to Algorand!
See the discussion on the following topic: Interpreting encoded variables in application info - #5 by fabrice
Concretely, with a Python one-liner:
$ python3 -c "import base64, sys, algosdk; [print(algosdk.encoding.encode_address(base64.b64decode(line.strip()))) for line in sys.stdin if line.strip()]" <<< /sj/9sN19Vz0gYPW8r14ok7IyVFlHrqj7dPpf1wqtwA=
Thanks for your reply.
We managed to get this line translated into JS SDK and produced the same result.
For anyone who is looking for a JS solution, here is the code: