These public and private keys are integral components of cryptocurrencies built on blockchain networks. These cryptocurrencies fall under the larger field of public key cryptography (PKC) or symmetric encryption (AE).
In PKC, the goal is to trivially switch states while making reversing the process nearly impossible, showing that you know a secret without divulging it. Due to its one-way mathematical nature, the product is ideal for verifying the authenticity of something (for example, a transaction) since it cannot be forged. According to PKC, two keys are used, a public key and a private key, often represented by a padlock (public key) and the actual key to open the padlock (private key).
CRYPTOGRAPHY BASED ON PUBLIC KEYS (PKC)
PKC is based on the mathematical primitive of “Trapdoor Functions”, which are easy to solve in one direction but nearly impossible to reverse.
Computers would need a lot of time (i.e., thousands of years) to calculate the correct answer to this problem. In the context of PKC, such mathematical tricks as Prime Factorization are the trapdoor functions that prevent reverse engineering (i.e., forging) cryptographic signatures since they require the computer to solve an impossible math problem.
Public and Private Keys
The primary purpose of PKC is to enable private, secure communication using digital signatures in a public channel where there can be malicious eavesdroppers. In the context of cryptocurrencies, the goal is to verify that the funds allocated from an account have actually been spent by the account owner, over a peer-to-peer network of public blockchains.
Whenever you own a cryptocurrency, what you actually own is a “private key.” Your “private key” gives the owner the ability to spend the cryptocurrency associated with it. Since it provides access to your cryptocurrencies, it should remain private, as its name suggests.
There is a private key as well as a public key, and the public key links to the private key through a cryptographic process. The public key can be recovered if you possess a private key. Despite this, it is impossible to get the private key using only the public key.
WORKINGS OF A TRANSACTION
A private key is A’s digital signature, which she uses to prove she is the person who spent money or sent a message.
As an example, if A wanted to send B a message through a channel that C was listening to, she could encrypt the message with her private key and send it. Her message also includes a special value, referred to as a hash output, that is sent to B using his public key. Using the hash output, the message, and his private key, B can decrypt and decode the message.
Because C only has A’s public key and his own private/public key pair, he is not able to read the message. It is the beauty of trapdoor functions. C cannot reverse engineer A’s message or private key because it was built using a trapdoor function.
A Bitcoin transaction is made up of a series of inputs and outputs of users transferring bitcoins between their public Bitcoin wallet addresses as inputs and outputs in the bitcoin UTXO transaction model. By publishing her public key on the web, A can allow others to send bitcoins to her address knowing she holds the private key.
A node in Bitcoin checks and validates transactions in the network to make sure none of them have been forged using basic consensus rules and cryptographic proofs that the public/private key pairs are valid (Proof of work). Therefore, it is virtually impossible to fake transactions in cryptocurrencies such as Bitcoin which use PKC since their integrity is protected by mathematical proofs.