Elixium Core v0.6.3 Elixium.KeyPair View Source

All the functions responsible for creating keypairs and using them to sign data / verify signatures

Link to this section Summary

Functions

Generates a Base58 encoded compressed address based on a public key. First 3 bytes of the address are the version number of the address, and last 4 bytes of the address are the checksum of the public key. This checksum allows for address validation, i.e. checking mistyped addresses before creating a transaction

Returns the uncompressed public key stored within the given address

Returns a 4 byte checksum of the provided pubkey

Compresses an ECDSA public key from 65 bytes to 33 bytes by discarding the y coordinate

Creates a new keypair and stores the private key in a keyfile. Returns the public and private key

Creates a new mnemonic to give to users based off private key

Generates a keypair from the seed phrase or from the private key, leading “ “ will switch to mnemonic to import key from

Reads in a private key from the given file, and returns a tuple with the public and private key

Using a public address, fetch the correct keyfile and return the only the private key

Link to this section Functions

Link to this function address_from_pubkey(pubkey) View Source
address_from_pubkey(binary()) :: String.t()

Generates a Base58 encoded compressed address based on a public key. First 3 bytes of the address are the version number of the address, and last 4 bytes of the address are the checksum of the public key. This checksum allows for address validation, i.e. checking mistyped addresses before creating a transaction.

Link to this function address_to_pubkey(address) View Source
address_to_pubkey(String.t()) :: binary()

Returns the uncompressed public key stored within the given address.

Link to this function checksum(version, compressed_pubkey) View Source
checksum(String.t(), binary()) :: binary()

Returns a 4 byte checksum of the provided pubkey

Link to this function compress_pubkey(arg) View Source
compress_pubkey(binary()) :: binary()

Compresses an ECDSA public key from 65 bytes to 33 bytes by discarding the y coordinate.

Link to this function create_keypair() View Source
create_keypair() :: {binary(), binary()}

Creates a new keypair and stores the private key in a keyfile. Returns the public and private key

Link to this function create_mnemonic(private) View Source
create_mnemonic(binary()) :: String.t()

Creates a new mnemonic to give to users based off private key

Link to this function gen_keypair(phrase) View Source
gen_keypair(String.t() | binary()) :: {binary(), binary()}

Generates a keypair from the seed phrase or from the private key, leading “ “ will switch to mnemonic to import key from

Link to this function get_from_file(path) View Source
get_from_file(String.t()) :: {binary(), binary()}

Reads in a private key from the given file, and returns a tuple with the public and private key

Link to this function get_from_private(private) View Source
Link to this function get_priv_from_file(pub) View Source
get_priv_from_file(String.t()) :: {binary(), binary()}

Using a public address, fetch the correct keyfile and return the only the private key

Link to this function sign(private_key, data) View Source
sign(binary(), String.t()) :: String.t()
Link to this function verify_signature(public_key, signature, data) View Source
verify_signature(binary(), binary(), String.t()) :: boolean()