The anatomy of æternity private keys and public addresses


#1

I was curious about this topic because I want to feel more comfortable with handling public addresses and private keys. For example, if I share a public address for whatever reason, I want to be able to quickly determine (visually or possibly with a handy algorithm) that it is correct and valid. The same is true with recognizing traits of valid private keys.

PRIVATE KEYS:

  • How precisely are AE private keys generated? (…and is manual generation possible?)
  • What does a valid private key look like? (i.e. the composition and format)
  • What ways can test if a private key is a valid AE key? Perhaps, not every combination of characters is a valid key.

PUBLIC ADDRESSES:

  • How are AE public wallet addresses generated?
  • What does a valid public address look like? (i.e. the composition and format)
  • What ways can test if a public address is a valid AE address? Perhaps, not every combination of characters is a valid address.

PUBLIC KEYS:

  • Are public keys something different than public addresses in AE?

#2

_dog: Right now, what I have seen (take it with a grain of salt) is:

Private Keys

  • AE Private keys are generated as a keypair from either a 32 or 64 byte array (usually written in hexadecimal form)
  • ANY string with the right amount of bytes can be used as a source to generate the key pair.
  • Usually the way to test if a private key is valid is by signing a message and validating with the public key, or viceversa (This is Crypto 101).
  • As far as I am aware there is no Wallet Import Format yet nor compressed addresses

Public Addresses

  • An AE Public address is a representation of the public bytes of a keypair
  • A valid public address starts with “ak_” and is followed by a base58 encoding used to reduce the risk of messing up an address while also avoiding using only hex numbers (so the address is shorter to write)
  • As an encoded byte string you could decode it and check that the number of bits it represents is the right number of bits. Besides this there should be no restriction as to what is and what is not a proper ak address. I am not sure if there is a validation char or parity check but I doubt it.
  • As far as I know there are no compressed addresses yet.

Public keys
The only difference really is the visual representation of a public key and a public address, a public key can be base64, hex, etc. While a public address for aeternity will start with “ak_” but both should represent the same thing.

I am not a developer of Aeternity, I am just an enthusiast and my response may be wrong.