How transactions are done with public keys and private keys
An integral part of various transactions done on blockchain and cryptocurrency is private keys and public keys. These keys which are used in tandem with each other and fit together like a pair are a part of the Public key cryptography (PKC) framework. A basic rule of thumb while carrying out these kinds of transactions is that while your public key can be accessible to all, your private keys should always be a secret.
What is a Public key
A Public key is the gateway through which you can receive transactions. The public key is a cryptographical code which is directly paired to the private key. The private key which will be in the possession of the real owner will determine whether the transaction will materialise or not.
The public key is an “address” which can be shared with people. Inorder to access your funds you need to be in possession of the private key because that will be the gateway behind unlocking the transaction
What is a private key
A private key is available in many forms such as
- A binary code containing 256 characters
- A hexadecimal code containing 64 digits
- QR Code
- Mnemonic phrase
Regardless of the form of a private key it is always astronomically large which serves the purpose because it becomes practically impossible to change the key or harm the identity of the owner
Although public keys can be generated from private keys however doing it the other way round is completely impossible. The “one way trapdoor” function stops any possibility of such a possibility. Therefore although you can have any number of public keys the number of private keys still remains the same.
What is the Public Key cryptography
Public keys and private keys function together in the Public Key Cryptography (PKC) system. The PKC system was originally used to encrypt and decrypt messages while chatting on traditional computers.
The basic technology behind the PKC system was that it uses data to validate the authenticity of any data or information with the help of asymmetric encryption. Over time cryptocurrency technology started using the PKC system. The inclusion of the PKC system in cryptocurrencies turned out to be a huge stepping stone in the development of such a revolutionary technology.
The underlying technology behind the PKC system is the “trapdoor” function. With the help of this function a mathematical function can be solved one way however solving the same equation the other way round is practically impossible.
How are these keys used in a transaction
While transacting on blockchain the transaction is supposed to be digitally signed through the following process.
- The transaction is encrypted with the help of a public key and can only be decrypted with the help of a public key.
- Subsequently the transaction is signed by a private key which authorises the transaction as authentic. The digital signature is produced through a process wherein the private key is directly combined with the data on the transaction
- The accompanying public key determines the authenticity of the transaction.
The user digitally signs the transaction which is confirmed by the nodes. The nodes check for authentic transactions while rendering unauthentic transactions as baseless. Any transaction which is once mined and authenticated on the blockchain can never be reversed.
This is the process through which a transaction materialises on a blockchain and how public and private keys are a key inherent part of this.
Originally Posted on — https://blog.changeangel.io/how-transactions-are-done-with-public-keys-and-private-keys/