Private keys are numbers or code generated and used with an algorithm for encrypting and decrypting data and also create digital signatures. In the world of cryptocurrencies, private keys play a very crucial role in making transactions because they are used to sign transactions and well as verify addresses on the blockchain, they also allows a user access to their funds. An individual in possession of the private key of a cryptocurrency wallet has total control over the cryptocurrencies in that wallet and also viewed to be the owner of that wallet, this means private should always be kept secret and should not be exposed. Public keys on the other hand are cryptographic keys which enable a user to receive and make cryptocurrency transactions.
In the world of banking, account numbers are the equivalent of public keys, whereas pins are the equivalent of private keys. A user cannot receive money in this bank account without having an account number and he cannot make transactions without his pin which proves that he or she owns the account, it's quite similar in the cryptocurrency ecosystem without having a public and private key it is impossible to make a cryptocurrency transaction. Public address are generated from public keys because public keys are extremely long string of numbers, it is normally squeezed and reduced to create the public address. Your public address represent the recipient where cryptocurrency is to be sent.
Public keys are derived from private keys through some complex algorithm but its is impossible to derive a public key from a private key, in order word it is a one way operation and cannot be reversed-engineered. Private keys are 32bytes or 256 bit numbers , but it is often represented in hexadecimal format for the sake of simplicity in hexadecimal their length is reduced to 64 characters.
In Bitcoin, private keys produces a public key via an Elliptical Curve Digital Signature Algorithm, or ECDSA, where the curve is used as a generator point secp256k1 to get the public key, while the public address is generated from the public key by applying a hashing to the public key by implementing the algorithm SHA-256,creating a public address from a public key is also an irreversible process. Though going into details how public keys are derived from private keys is beyond the scope of this article. Here is an example of Bitcoin private key, public key and a public address looks like:
5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF (private key)
1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm (public key)
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa (public address)
Please remember that if someone gets to know your private key they can get access to your account and withdraw all your funds without your permission , so its necessary to always keep it secure because once it's lost there is no way of retrieving it as there is no remember password option in the world of cryptocurrencies, so once lost it's lost forever without any chance of ever getting it back.
One might ask whether private keys could be guessed ?
Private keys are nearly impossible to guess, since there 256-bit number between 0–2²⁵⁶ ,its create a huge range of numbers, which makes it impossible for 2 people getting the same keys (there are 10⁷⁷ keys available).
Presently, users are not scarcely exposed to their private keys like the bitcoin example shown above, contemporary cryptocurrency wallets support what is known as a seed phrase also known as mnemonic phrase , these are human readable collections of words which gives access to a cryptocurrency wallet. They are mostly between 12-24 words, below is a example of what a seed phrase looks like:
** forget wing follow flip swallow achieve correct view dinner witness hybrid proud **
Seed phrase where introduced in Bitcoin with BIP39, seed phrases provide users with an easier way of backing up their wallets. BIP39(BIP39 stands for “Bitcoin Improvement Proposal: 39) permits creating a backup set of private keys for a particular wallet using a mnemonic phrase or collection of words. The words get drawn from a particular 2048-word list known as the BIP39 word list. Seed phrase acts like a master password for your cryptocurrency wallet, whenever a user creates a cryptocurrency wallet, the user given a seed phrase which must be stored securely.
Since most widely used cryptocurrency wallets comply to BIP39, if you commonly switch among multiple kinds of wallets, you could use the seed phrase from one to recover your funds and utilize the other. You can switch back and forth quite easily as long as they both implement BIP39. The easiest way to think of a seed phrase is as a backup for a wallet's private key, if for any reason your loose access to your funds in your wallet you could import you seed phrase into any BIP39 wallet to recover your funds in your cryptocurrency wallet.
In conclusion, private keys and public keys serves as a means of securing funds against illegal access and bad actors with malicious intents while seed phrase serves as an additional layer of defense and also a means of recovery to your funds.