In order to understand the importance of the private key and the public key for Bitcoin, it is essential to deal with the topic of asymmetric cryptography. This forms the basis for ensuring both the ownership rights and the identification of users on the blockchain.
Since this is a complicated, technical topic, we will give you a simple and practical introduction to the topic of cryptography in the following article. We will also explain the meaning of the Bitcoin Private key and Public key. The following versions are also valid for all public blockchains. For the sake of simplification, however, the topic will be explained using Bitcoin (BTC).
Bitcoin and every other public blockchain face a central challenge. While the blockchain is a publicly accessible peer-to-peer network whose code is open source, property rights must be stored digitally unalterable and tamper-proof. The property must only be able to be assigned exclusively to one person, without others having access to it. This must be realized without affecting the decentralized architecture of the network. This is where cryptography comes in.
Introduction to Cryptography
The basic idea behind cryptography is to protect data from unauthorized access through encryption. The term comes from cryptology and encompasses a science that develops methods and algorithms to encrypt data. Only the authorized person should be able to access the data by decryption and encrypt the data again by encryption.
Symmetric vs. Asymmetric Cryptography
Basically, a distinction can be made between symmetrical and asymmetrical cryptographic procedures. The same digital key is used for encryption and decryption in the symmetrical procedures. Both the sender and the receiver use the same key (in the example: black) to encrypt the encrypted message (red).
However, this procedure is completely unsuitable for cryptocurrencies, since only one person is supposed to own Bitcoin or another cryptocurrency. A key that must be shared between several people is contrary to the principle of property. Because of that reason Bitcoin uses asymmetric cryptography.
It uses a key pair consisting of a public key and a private key, which is why it is also called public-private-key cryptography. In contrast to symmetric cryptography, there are two keys where the public key can be freely disclosed and the private key is a secret. The encrypted data can only be decrypted with the private key.
As the following graphic shows, the message is encrypted with the black key and decrypted with the yellow key (Private key). Both the sender and the recipient each have a public and a private key to encrypt and decrypt the (different) encrypted message.
How does asymmetric cryptography work?
The basis of asymmetric cryptography is a mathematical algorithm by means of which the public and private keys are generated and thus linked. Due to this mathematical connection, information encrypted with a public key can only be decrypted with the corresponding private key.
It is important to know at this point that the mathematical functions used here are practically irreversible. This means that they can be calculated in one direction, but not in the other. In terms of cryptocurrencies, this means that a public key can be derived from the private key, but never the other way around. Otherwise anyone could derive the private key from a public key.
The process can be explained as follows using an example. If a sender wants to send encrypted data to the recipient, it must request the recipient’s public key. After receipt, the sender can encrypt his data with the public key (of the receiver) and send the data. Then only the owner of the private key can decrypt the data.
The meaning of the Bitcoin Private key
Routinely, very few Bitcoin users come into contact with the private or public key. In most cases, Bitcoin Private keys are stored in the Wallet file and managed by the Bitcoin Wallet software. The Bitcoin address is the only representation of the public key (in the form of a hash function) that the user routinely sees.
The fact that the user usually does not come into contact with the asymmetric key pair is to be welcomed from the point of view of user-friendliness. However, the lack of visibility does not mean that the key pair is not needed at all or only rarely. This is not the case. The private key and Public key are required whenever a transaction is to be sent. While the Bitcoin public key is used to receive Bitcoin, the Private key is used to sign Bitcoin transactions.
The private key is therefore of central importance for Bitcoin. It represents the ownership of Bitcoin (BTC) and is required for the generation of digital signatures and Bitcoin wallet addresses. Therefore, anyone with a copy of the Bitcoin Private key also has control over the Bitcoins assigned to the wallet address (the Public key). This is also the reason why the Bitcoin private key is a secret and should never be given to third parties!
Another important part of the Bitcoin shipping process, which we have only briefly mentioned so far, is the digital signatures. They testify that the information received is identical to the data sent. Bitcoin transactions require a valid digital signature to be included in the blockchain.
This can only be generated with a private key and proves ownership of the issued BTC. By presenting the public key and signature, anyone in the Bitcoin network can verify and validate the transaction without revealing the private key.
Remarkably, the Bitcoin Private keys are completely independent of the Bitcoin protocol. They are generated by the user’s wallet software, without reference to the blockchain or the Internet.
The meaning of the Bitcoin Public key
As already mentioned, the Bitcoin Private key has another function. The public key is generated from it using elliptic curve cryptography. A detailed description of the functioning of elliptic curve cryptography would far exceed the format of this article.
For the basic understanding it is enough to know that the procedure is also called a one-way function with “trapdoor”, because it can be executed simply in one direction (multiplication), but impossible in the other direction (division). In practice, this means that only the owner of the Bitcoin Private key can derive the public key. He can be sure that nobody can reverse the function and derive the private key from the public key.
The actual task of the Bitcoin public key is to generate the Bitcoin address, which the owner can send to other members of the BTC network in order to receive transactions at this address. An irreversible cryptographic hashing function is used to generate the Bitcoin address.
For everyday use, it is important to know that you can create an infinite number of Bitcoin addresses (using a wallet software or a generator for Bitcoin addresses). This is even recommended, since the use of different addresses at least makes the traceability of Bitcoin more difficult.