Brought to you by the Liquid team to help you make sense of crypto.

What are public and private keys?

In Blockchain

You might be wondering what private keys and public keys are – and why you need them.

Private and public keys are crucial in blockchain and cryptocurrency.

It's important to have an understanding of their significance to cryptocurrency transactions.

Let's find out why.

The basics of cryptography

Public and private keys are elements of cryptography.

Cryptography is the process – or science – of encrypting and decrypting information.

Almost all data can be encrypted. The most famous examples are messages encrypted during wars.

The use of encryption for war-time communication goes all the way back to Julius Caesar, who encrypted Roman military messages. Caesar did this by replacing each letter of a word with the letter three spaces to the left in the alphabet.

For example:

The encrypted version of “west” would be “tbpw”.

diomari-madulara-110583-unsplash

His generals knew this encryption code, so they could read the messages, but those outside the army who did not the code could not. 

All cryptography uses a cipher, which both disguises and reveals the encrypted information.

Today, encryption is part of our daily lives, whether we realize it or not: our phone apps and credit and debit cards are all encrypted to enhance security.

For example, a debit card PIN is protected by an encrypted key, and the card – and the PIN – allow the user to unlock the data held within it.

Symmetric key cryptography vs asymmetric key cryptography

There are two forms of cryptography: symmetric key cryptography and asymmetric – or "public” – key cryptography.

Symmetric key cryptography is a form of cryptography in which the same key is used to both encrypt and decrypt the message.

Julius Caesar’s encrypted military messages are an example of symmetric cryptography. The same key – using letters three to the left in the alphabet of the specific message – is used to both encrypt and decrypt the message.

Another example would be a basic door lock. The same key can both lock and unlock the door lock.

The downside of symmetric key cryptography is that it’s open to people discovering it.

For example:

Somebody could easily steal a key to a door lock. Or in the case of Roman military messages, with time, opponents could figure out the cipher.

Asymmetric cryptography is a more complex form of cryptography. This is the form that blockchain uses.

In asymmetric cryptography, two keys are required to unlock information. One key – a public key – is used to encrypt information and a second key – a private key – is used to decrypt it.

This method of encryption provides a strong layer of security to a transaction, securing both the item transacted and the ability to access it.

markus-spiske-445253-unsplash

Public key cryptography and blockchain

As we’ve mentioned in other articles, the aim of blockchain is to create a digital network where individuals can securely transfer information and assets without the involvement of a third party, like a bank.

Security over the network and in transactions is crucial to this process. In a traditional model, the third party usually provides the security – the bank protects the money or an asset, or maybe a lawyer helps execute a contract – so they can help verify a transaction.

But in blockchain, without the existence of a third party, something needs to exist that ensures security.

Public key cryptography is a crucial element that provides security for transactions on the blockchain.

Private and public keys are digital assets that, when combined, form a digital signature for an individual, thus enabling the secure transfer of data, money or information.

This is how private and public keys work together: when combined, they unlock secured data.

But what’s the difference between the two types of keys?

Private keys vs public keys

Since the blockchain platform uses public cryptography to execute transactions, and public cryptography requires a public and private key, every user on a blockchain has a public and private key.

Of course, the keys on blockchains are not actual keys.

They are instead very long number sequences that are unique to an individual user.

Most blockchain platforms – like Bitcoin—will generate a private key after a user creates a wallet.

This key is 256-bit long key, making it highly secure, and people can store it in a wallet, a text file, or a secure app.

The private key is meant to be kept private. Nobody other than the person it belongs to should know it.

It is the key that confirms an individual’s identity in a transaction in the blockchain.

In contrast, a public key is exactly what its name states: a key a person shares with the public – or, more specifically, a blockchain network.

Like a private key, it is a long number, and the blockchain generates it based on the private key.

How private and public keys work

A person’s private and public keys combine to create a digital signature and unlock access to a piece of information or a transaction.

If a person wants to send information – or a transaction on the blockchain – they use their private and public keys together.

Say Person A wants to send information to Person B on the blockchain. He can do this by getting Person B’s public key, attaching the relevant information to that public key, and sending it to Person B.
Since the information is attached to Person B’s public key – and only Person B’s highly secure private key can work with his public key – Person A knows that the only person in the world who can see that information is Person B.
So the sender uses Person B’s public key to encrypt the information. This means that only Person B’s private key can decrypt the information.
Person B receives that information from Person A. Using his private key, he creates his digital signature and accesses the information.

The role of a digital signature is crucial. The combination of the person’s public and private keys creates a digital signature, which confirms that they – and they alone – have executed the desired transaction.

How blockchain uses cryptography

Blockchain has several primary uses for cryptography:

  • Protect the identity of users: It enables individuals on the blockchain to maintain the security of their personal identity and data so they can securely send messages across the blockchain. It gives each person a way to have a secure personal identification and authentication tool.
  • Secure blocks: People then use cryptography to make transactions on the blockchain, which—when confirmed—turn into blocks.
  • Ensure transactions are done safely: Cryptography enables users on the blockchain platform to confirm that transactions are, in fact, secure and viable and have valued protocol—and can thus be added to the blockchain.

The benefits of public cryptography

We mentioned before that public cryptography is essential to the blockchain because it is the technological method that enables two users to interact over the network and transact private, personal data without the involvement of a third party.

Of course, private and public keys alone are not enough to verify a transaction. Another layer of security is required – and this is where the network comes in.

The combination of a person’s private and public key enable him to commit a desired transaction, and his digital signature confirms that transaction.

But the network allows an additional layer of security. The network verifies the transaction, or approves it. 

Once they approve it, the block is added to the blockchain and distributed to the network for everyone to see.

This communal confirmation of a private transaction is the element of blockchain technology that fully enables individuals to execute these transactions on the blockchain.

As blockchain technology evolves and becomes more widely accepted by the people and industries outside of blockchain, the security of public cryptography will continue to be essential to the technology.

It is the secure method by which cryptocurrency traders, users on blockchain networks, and people new to the technology will conduct important transactions on the growing blockchain platform.

WRITTEN BY

Liquid

Providing liquidity for the crypto economy.