The Stellar keypair is generated easily from various SDKs, but which algorithm do the SDKs use?
1 Answer
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:
- Prepend keys with a version byte:
- public key with
6 << 3
byte (decimal:48
, this later encodes to letterG
), - private key with
18 << 3
byte (decimal:144
, this later encodes to letterS
).
- public key with
- Calculate checksum of public or private key prepended with version byte using CRC16-XModem.
- Use base32 encoding to encode version byte, public/private key and checksum. The final string should consists of 56 characters.
Code:
-
1The 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
-
2I 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! Commented Jan 23, 2018 at 9:15