Decode an Algorand ARC-4 uint64 result from application logs

An application can log several diagnostics before returning an ABI value. A consumer must select the final log of the method execution and decode the bytes using its declared return type.

Check the return marker after decoding transport bytes

If the response serializes logs as base64, decode the selected log first. An ARC-4 non-void return starts with four marker bytes, followed by the ABI payload. This fixture has eight payload bytes for a uint64.

prefix = bytes.fromhex("151f7c75")
log = bytes.fromhex("151f7c75000000000000002a")
assert log.startswith(prefix) and len(log) == 12
value = int.from_bytes(log[4:], "big")
assert value == 42

Handle void methods and nested calls explicitly

A void method does not need this return log. For a non-void call, a missing marker or malformed payload leaves the result undecoded. Keep ordinary diagnostic logs intact and avoid taking the last log from an unrelated inner application call. Strings, tuples and dynamic arrays need their own ABI decoders.

Sources