A public and a private key are a pair of keys, generation of which is performed simultaneously. Cryptographic algorithms used in a messaging or digital signature system always assume the joint use of such a key pair. Both keys must match the encrypted part of the message or information. While both public and private keys seek to secure a transaction, they are quite different in their purpose.
Does that sound complicated? Let’s figure it out. This is Alex, the blockchain guru at Artex Global. Why is it so important to understand the working principle of this concept? To learn how not to become the person who blocked his million-dollar fortune.
What is Public Key
A public key is your unique bitcoin address, which is used in the blockchain. Everyone on the network can see it. It is a string of letters and numbers generated from the private key that identifies the sender or receiver of funds.
Normally, a public key that starts with one is generated when the wallet is opened. But there is an advanced version of the public key with a multi-signature, it starts with a three, and you have to provide more than one private key to get to the coins.
A public key consists of a set of letters and numbers between 26 and 34 characters. To avoid visual inaccuracies and fraud, the capital letter “O”, the number “0”, and the capital letter “I” and the small letter “I” have been eliminated.
What is a Private Key
A private key is a number that is encoded in different formats, depending on which wallet you use. In each format, the private key looks like a set of randomly generated numbers and symbols. All of these formats represent the same private key, even if they look different. Either format is easy to convert to the other.
A private key is an important tool for controlling a cryptocurrency wallet. Only with a private key that matches your public key (bitcoin address) can you unlock your funds or transfer funds to another user. Public and private keys are inseparable, their connection is based on mathematical functions. They are connected in a complex irreversible algorithm.
A bitcoin private key is a complex cryptogram, created by applying an encryption algorithm, and serves as a sort of signature when sending transactions. Typically, these private keys vary depending on the type of cryptocurrency, although almost all of them use 256-bit encryption, such as BTC, ETH, LTC and many others.
How Do Private & Public Keys Work?
Public keys are used to create blockchain user addresses. This is the data that points to the recipient of the transaction. In life, we use a phone number, a home address, or a bank account for this purpose. The peculiarity of blockchain addresses is that they can constantly change.
Before you buy cryptocurrency, you need to create a wallet in which it will be stored. When you open the wallet, key pairs will be mathematically generated. Public keys consist of 66 digits, so it is inconvenient to specify them when receiving funds.
For convenience, addresses are created from them using mathematical transformations. Each address is a shorter sequence of numbers and letters, or a QR code.
A private key is used to create an electronic digital signature on the blockchain. It is a way of confirming your right to make transactions in the blockchain. In life, we show our passport, sign or enter a PIN for this purpose. The peculiarity of a digital signature in blockchain is that it allows you to confirm your identity without revealing your data.
An address in the blockchain belongs to someone who knows the private key from it. To prove that you have it without revealing it to anyone, a digital signature is used. A digital signature is a set of characters that is obtained through encryption. Let’s look at how a transaction is created and signed in blockchain:
- The sending information is encrypted using SHA-256.
- The ECDSA algorithm receives a private key and a hash of the data to be signed.
- As a result of the ECDSA algorithm, a digital signature is created.
- Encrypted sending information and a digital signature are written into the transaction.
Now that the transaction has a signature, other users of the blockchain must validate it. Confirmation is necessary to make sure that the attacker is not trying to steal bitcoins from the account. To do this, the signature is decrypted using a public key. If the decrypted information matches the hash, the transaction is considered valid.
System Security and Reliability Against Hacking
A private key is randomly generated from numbers between 1 and 10 to the 77th power. To search for all possible private keys would take all the energy the sun produces in 32 years, or all the computers on the entire planet for billions of years. Even if you sit around all your life creating keys with addresses, you will never find an address that is already in use.
As we see the security of this system is much higher than it may seem at first glance. This protection is achieved by the fact that:
- The passphrase is never sent to the blockchain.
- The private key is never sent over the network.
- It is virtually impossible to derive the private key from the public key.
- Resistance to MiTM attacks.
Many cryptocurrency owners do not pay much attention to protecting their private keys, and mainly rely on the password with which they are encrypted. But it should not be forgotten that a large share of malware is created precisely for the purpose of stealing private keys, so it is not recommended to store them digitally.
Blockchain users communicate with each other using asymmetric encryption. It involves the use of two keys. The public key is used to find the user on the network and send him an encrypted message.
The private key is needed to decrypt the message received. In addition, private and public keys are used to confirm the identity of blockchain users. Cryptographic algorithms allow the creation and verification of digital signatures.
With the spread and development of cryptocurrencies, methods of fraud have also evolved. Therefore, it is necessary to be on the alert all the time and study new information, which can be useful. We publish weekly articles about blockchain and cryptocurrency, such as hidden mining and cryptocurrency exchanges in Canada.
I have been studying cryptocurrency for over 5 years. I have accounts in every exchange and I test everything on myself.
I want this market to be more understandable for everyone.