1

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 ?

4

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.

2

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:

  • The fist byte is 'S' << 3.
  • The next 32 bytes are the Ed25519 private key seed
  • The last two bytes are a CRC16 checksum of the first 33 bytes.

Then the whole thing is encoded using RFC4648 base-32 encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.