alexdovzhanyn / elixium_core

A privacy-preserving decentralized application network
https://www.elixiumnetwork.org/
281 stars 37 forks source link

Compressed addresses #67

Closed alexdovzhanyn closed 6 years ago

alexdovzhanyn commented 6 years ago

Moves us to compressed addresses rather than using bare public key addresses. This saves bandwidth and storage of about 25 bytes per UTXO. We're also moving our address encoding from base64 to base58 in order to remove ambiguity between certain characters ("O" and "0" can be confusing in certain fonts).

The new address format is as follows:

  1. 3 bytes containing the address version number ("EX0" as of right now)
  2. 32 bytes containing the x-coordinate of the public key
  3. 4 bytes containing a checksum of the public key + version number. This allows us to check for mistyped addresses.

Here's a visual example of the address difference (note: these don't represent the same public key): Original: BOTKThJoBJEZJn1t9k8RUJUnOpN0E2ynLsHRHB5h9v4acDgrdC5106N4KnFGsxni3CWvdyaZuahcr3cr7DNkl3A=

New: EX08TQa45c7TKzvvvYUXTavi8TR1z7aHJjB5DCVfX2LRUNakcnwqD

Functionality has been added to keypair.ex that allows generation of an address based on a public key, and retrieval of a public key based on an address.

alexdovzhanyn commented 6 years ago

I need to add documentation to the Base58 module and its functions before this can be merged