In the world of cryptocurrency, your private and public keys are just like your bank account number (public key) and the pin/token (private key).
What is Cryptography?
Cryptography is at the heart of several cryptocurrency systems including Bitcoin. With cryptography, information is protected from a third party. It allows data to be shared and kept in a format that prevents a third party from getting hold of the information. This is done through a mathematical equation called a cryptographic hash function which transforms the input (message) from plain text to incomprehensible set of characters made up of letters and numbers called the hash value.
In summary, cryptography is a form of encryption used on the blockchain network.
What is Encryption?
Let’s take a look at encryption for a second.
Encryption is simply making your information or, in the case of Bitcoin, money, inaccessible to anyone but you. It ensures that your money or information can only be accessed by you and those who you want it to be accessible to.
There are two types of encryption. The symmetric and the asymmetric encryption.
Symmetric uses the same key to encrypt and decrypt data. This means that the key that is used to encrypt data is the same key that is used to decrypt it. A perfect example of this is the password system.
But, the problem with passwords is that there’s a high risk of it being discovered by a third party. Thus, it is not entirely secure. This is where asymmetric encryption comes in. Asymmetric encryption is an upgrade on symmetric encryption.
In asymmetric encryption, a private and a public key mathematically linked to each other, are generated by an RSA algorithm. Information that is encrypted with a public key can only be decrypted by a private key.
What are Public and Private Keys?
Public and private keys are digital keys that are used to access bitcoin wallets and perform a transaction on the blockchain network. As mentioned above, your public key is like your bank account while your private key is like your pin number which you use to access your account.
The public key can be visible to anyone on the network. But, a private key should be private.
Like the bank account and the pin number, it is not possible to know a person’s pin number simply because you know their account number.
Another relatable explanation for this is a traditional mailbox. If you have a mailbox that’s locked, anyone who knows where your mailbox is located can put in letters and written messages. But, they cannot access the mailbox to collect letters that have been put in the there. The only person that can do this is you because you are the only one with the key to the mailbox.
Bitcoin uses asymmetric encryption to ensure that only the owner of a bitcoin wallet can withdraw or send bitcoin from it
For one user to send BTC to another user, they need to be aware of the other user’s address. This address is generated from the public key. It is a shorter representation of the public key.
Public and private keys are generated and stored by the blockchain wallet. When you send BTC from your wallet, it is signed automatically with your private key in such a way that your private key is not revealed. This is known as your digital signature.
Let’s say Jane wants to send some Bitcoin (BTC) to Daniel, all she has to do is send it to his cryptocurrency address which she has collected from Daniel. But, for anyone to access the BTC that has been sent to Daniel, they would have to open his Bitcoin wallet with Daniels private key which would be impossible to access because only Daniel knows his private key.
In summary, a public key is an encryption key while a private key is a decryption key.