What You Need To Know To Understand Blockchain Technology Part 4

How public key cryptography works. The reason consensus algorithms exist.

The goal of using public keys in digital cryptography is to solve the issues of checking who sent the data (signing), confidentiality so that nobody knows what the data contains while the data is in transit and keeping the data free from tampering. Public key cryptography solves all these issues. Here’s how it does it.

Public key cryptography has five elements. They are the data, the private and the public keys of the sender, and the private and the public keys of the receiver of the data. Obviously, on financial blockchains such as Bitcoin the data is information about financial transactions. Public keys of all parties are known on the network, which is why the keys are called public. This means that at any point any party can have three keys: its own private and public keys and a public key of the party that will be receiving the data. A set that consists of private and public keys is known as key-pair. It is possible to create an encryption with a public key, but in this case the decryption can only happen when the corresponding private key is present. The opposite is also true: it is possible to encrypt the data with a private key, but a the corresponding public key will need to be a part of the decryption process.

Typically, a sender in a cryptocurrency transaction would use a receiver’s public key to encrypt the transaction. However, when the receiving party gets the funds in this case, it still doesn’t know whom the funds are coming from. For this reason, senders attach a small portion of data known as signature. To create a signature, a blockchain network uses the key-pair of a sender and the sender encrypts the data with his or her private key first. After that, the sender adds the signature to the data. During the next step, the sender encrypts the data from the previous step, but this time the sender uses the public key of the recipient. This is the data that the sender sends to the network. In essence, the data has been encrypted twice and nobody can decode the data other than the recipient because decoding involves the private key of the recipient.

Once the recipient gets the data, he or she decrypts it with the private key and the public key of the sender.

Introduction to consensus algorithms

The goal of using consensus algorithms on the blockchain networks is very simple. It is to agree which transactions get to become a part of a blockchain.

This issue exists because public blockchains such as Bitcoin, Ethereum and others are not the only way for people to send money. This is very different from how currencies and money typically work in a country.

For example, if you live in the United States, then you will not be able to pay for most services and products in the country with anything but the United States dollars. No matter where you go, from a coffee shop to an electronics store to an online retailer, you only option would be to pay in the United States dollars. If you do not have US dollars and have some other currency, be it a regular currency or a cryptocurrency, you will have to exchange it into US dollars before you can make a purchase.

Exchanges and the management of money are being done through government-regulated banks that work with government-issued currencies. For a bank to operate in the United States, the bank needs to comply with federal, state, and local regulations.

On a blockchain network, there are no regulations. Also, even today users have choice as to what cryptocurrency to use to send funds, be it Bitcoin, Ethereum, Nano, Ripple, or something else. For this reason, every network needs to have a system that allows users to send and receive funds in such a way that scams can’t happen. This is exactly what consensus algorithms allow the networks to accomplish.

It is important to note here that public blockchains such as Ethereum and Bitcoin are open-source. This means that anyone can download and inspect the software, including inspecting the way that the consensus algorithms work.

This is also very different from how typical software works. For example, Google is doing its best to protect its proprietary algorithms, including the algorithms that determine the rankings of websites in search results. Facebook protects the algorithms that determine which ads to show to users and which posts and updates to show in the newsfeed. For private companies, these algorithms are their trade secrets and if someone were to figure out how these algorithms work, the person or the entity would be able to show more stories on Facebook and be higher in the Google rankings.

The way blockchains work is the opposite. All the algorithms are out there in the open for anyone to inspect and use.