(SOLVED) AE address length min and max

Hey guys,

I want to ask a quick question because I cannot seem to find a definite answer anywhere.

I need to find the minimum and maximum length of an AE address for a regex validation in my app.
So far what I understand is that it’s between 49 and 53 characters.

Thanks in advance!

ak_11111111111111111111111111111111273Yts is the shortest valid address and ak_2wkBET2rRgE8pahuaczxKbmv7ciehqsne57F9gtzf1PVZS9BEY is the longest (all bytes 0 and all bytes 0xff respectively).


Validation through regexp sounds a bit strange though…


What would you suggest using then?

I would check the prefix, then I would base58 decode it then check the checksum and also the size (addresses are always 32 byte).


That sounds pretty nice, but how can I check the checksum? :s

I think the Base58Check format is reasonably well described in the API documentation?

In short the last four bytes (after base58 decoding) is a checksum that should be checked against the first four bytes of the sha256-hash of the sha256-hash of the address.

1 Like

Is there somewhere I can see a full example of how this is done?

Also there is an Crypto.isAddressValid method in the js sdk:

1 Like

Thank you so much!! That solved it.