10

The Stellar keypair is generated easily from various SDKs, but which algorithm do the SDKs use?

1 Answer 1

16

Stellar is using Ed25519 public-key signature system.

After generating a new key pair (public and private key), both keys are strkey-encoded. strkey works like this:

  1. Prepend keys with a version byte:
    • public key with 6 << 3 byte (decimal: 48, this later encodes to letter G),
    • private key with 18 << 3 byte (decimal: 144, this later encodes to letter S).
  2. Calculate checksum of public or private key prepended with version byte using CRC16-XModem.
  3. Use base32 encoding to encode version byte, public/private key and checksum. The final string should consists of 56 characters.

Code:

2
  • 1
    The seed is derived from the private key and it is used to generate its encoded string. See download.libsodium.org/doc/public-key_cryptography/…. Commented Jan 23, 2018 at 1:32
  • 2
    I think the naming they use in Stellar SDKs is confusing. Inside the keypair classes they correctly use the terms seed and secret key, but then in the api they call the seed secret key!
    – Francesco
    Commented Jan 23, 2018 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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