PRIVATE KEY AND PUBLIC KEY.
A brief overview of a Blockchain, it’s a technology used to record transactions in blocks that are linked together using a hash. This technology is decentralized, secured and tamper-proof and it runs on millions of nodes across the world.
Therefore, to process a transaction on a Blockchain the sender must have a private key to sign the transaction and verify with his public key and the sender must have the public key of the recipient. Now let us delve into what a private key and a public key is and how they work together.
PRIVATE KEY:
The private key is a long range of numbers randomly generated by a computer and assigned to a user. The private key needs to be safe and hidden from anyone. This is because, the private key acts like a password or pin to an account of a user. Once a random person comes in possession of it, they can log in into your account and execute malicious activities without your consent.
PUBLIC KEY:
The public key is also an address or a range of numbers, generated from the private key. This key is not hidden or protected; it is the address used to receive an amount of money by sharing the key with its sender. Therefore, the public key works like your account number, which you send to someone who wants to, pay you or transfer an amount of money into your account. If the address you sent is incorrect, you could lose the money to a wrong account.
HOW THE TWO KEYS WORK HAND IN HAND:
As you know, the public key is computed from the private key but you can never guess the private key by using the public key. Therefore, to transfer money to a user, you receive their public address and you input the amount you are willing to send. Before that money leaves your account, the transaction must be verified and for that to happen, you must sign with your private key, just as you approve a transaction in our local banking system using your account pin. Now when you successfully sign that message with your private key it generates a unique signature that proves the transaction came from you and this signature cannot be altered. The signature of the message is simply random numbers that are lengthy.
So after you sign the message with your private key, you move on to verify this message to approve that the public key sending the amount to another account is actually the true possessor of that account. Because if you sign the message and you receive the message signature under your transaction and you’re now about to verify, but the public address is not linked to the private address you used to sign the message you’ll receive an error which will hinder you from proceeding with the transaction.
It’s just like someone is trying to send an amount of money from your account to another account, before that transaction is successful they must verify it with your account pin. If they don’t know your pin they’ll end up stuck with processing the transaction because if they enter a pin that’s not in connection with your account they’ll receive a message telling them that the account pin is incorrect resulting in failed transaction.
SUMMARY:
In conclusion, the private key in Blockchain is like your bank account PIN secret and essential for authorizing any transaction. The public key is like your account number something you can share to receive funds. Both work together to ensure secure, verifiable transactions on the Blockchain. As a user, protecting your private key is crucial, because anyone with access to it can control your funds.