I am currently only checking if the address is 56 chars long an if it is alphanumeric.
Is there a checksum in an address to verify it.
Are there any other rules ?
Stellar Stack Exchange is a question and answer site for developers and users of Stellar and the Stellar Distributed Exchange. It only takes a minute to sign up.
Sign up to join this communityI am currently only checking if the address is 56 chars long an if it is alphanumeric.
Is there a checksum in an address to verify it.
Are there any other rules ?
Stellar uses Ed25519 public/private keys. So you can research that if you want some more details.
If you're using a library (like the JS SDK) it's as simple as calling:
StrKey.isValidEd25519PublicKey(address);
If you want to see the details of how that's implemented, you can see here: https://github.com/stellar/js-stellar-base/blob/master/src/strkey.js#L110
In short: There is a version byte, a payload/data, and a checksum.
The previous answer is correct, but just to be a little more precise about what is going on, Stellar private keys are computed as follows. First, a 35-byte value is computed as follow:
Then the whole thing is encoded using RFC4648 base-32 encoding.