Public and private keys in crypto

icon FOR
Photo - Public and private keys in crypto
Public and private keys are constantly used by all traders or hodlers when buying, storing, or exchanging cryptocurrencies. For every new asset, a separate pair of public and private keys is generated every time, performing their essential functions.
Bitcoin and other cryptocurrencies are based on open-source cryptographic algorithms and always use key pairs: public (open, used for identification) and private (confidential, used for authentication and data encryption).
The primary purpose of public and private keys

The primary purpose of public and private keys

The procedure for transferring data through the blockchain has the following algorithm:

  • Generation of a "public/private key" pair using a specific algorithm (different for each cryptocurrency) and SEED phrases to restore access to the wallet.
  • Creation of an electronic signature and verification. A private key is used to sign a message, while the public key has a signature verification function.
  • Messages encryption and decryption. The message is encrypted using the public key and decrypted using the private key.

Cryptocurrency transfer

When it is necessary to transfer coins, such as Bitcoin, the sender asks the recipient for the public key from the BTC wallet. The public key serves also as a payment details, the wallet address, and is used to receive transfers. It is also convenient to send it as a QR code. After that, the sender enters (usually copies and pastes) the public key in the "Recipient's address" field, indicates the transfer amount and the commission, signs the transaction with his private key, and sends the assets.
In the "Address" field, you must enter the recipient

In the "Address" field, you must enter the recipient's public key.

Wallet address

Just as banks use account numbers to control account balances, so do wallet addresses in a public blockchain environment.
A bitcoin wallet address has a long string of letters and numbers ranging from 26 to 35 characters, usually beginning with 1, 3, or bc1. The address format for other cryptocurrencies is different – each one is generated according to a unique algorithm.

The public and private key format

The format of public and private keys consists of a randomly generated set of letters and numbers formed according to a specific algorithm for the secure exchange between two parties.
The private key is longer, and overlaying it legitimizes the transaction and verifies the sender's ownership of the assets. This signature is used to verify a processed transaction, eliminating the possibility of changes being made after it has been sent.

With custodial wallets, the procedure for transferring assets is easier. All custodians (for example, centralized exchanges) generate and store private keys by themselves. When a user transfers coins from such a wallet, the payment script signs the transaction with the default private key (without actually revealing it to the owner), thus "informing" the network that this user has the authority to transfer funds.

You should never forget that the private key is access to your funds, so for security reasons, never disclose it to unauthorized persons!

The private key is used to mathematically determine the public key, which (along with the network and checksum information) is then converted using a hash function into an address accessible to other users. The user receives coins from the sender resulting from hashing the public key.

This raises a question: if the public key is derived from the private one, can't someone create a reverse generator to calculate the private key in this way and steal the assets?

Cryptocurrencies solve this problem by applying a complex mathematical algorithm. Even though the system makes it easy to generate public keys from private ones, it is almost impossible to create an algorithm to achieve the opposite result.
The reverse process is so complex that it would take even the world's most powerful computer over 4 trillion years to complete the calculation.

Conclusion

As you can see, when using public and private keys, there are uniform security rules for all cryptocurrencies:

  • the SEED phrase is never sent to the blockchain;
  • the private key is never sent across the network;
  • it is practically impossible to calculate the private key from the public key;
  • a system of algorithmic stability has been introduced.


Many cryptocurrency owners need to pay more attention to protecting their private keys and SEED phrases, relying mainly on their wallet or account passwords. But remember that many computer viruses are explicitly created to steal private keys, so storing them on computers or smartphones is not recommended.

The preferred option for secure storage of cryptographic keys is specialized devices such as hardware wallets or safe flash drives where information is stored in encrypted form.
Remember that only the assets owner is responsible for them, so be careful and vigilant!