The blockchain is a chain of blocks where each block contains data of value without any central supervision. It is cryptographically secure and immutable.

A blockchain uses two important data structures: Pointers and Linked lists

Pointers

Pointers are variables in programming which stores the address of another variable. Usually normal variables in any programming language stores data.

Eg. int a = 10, means that there is a variable “a” which stores integer values. In this case, it is storing an integer value which is 10. This is a normal variable.

Pointers, however, instead of storing values will store addresses of other variables. Which is why they are called pointers, because they are literally pointing towards the location of other variables.

Linked Lists

A linked list is one of the most important items in data structures. This is what a linked list looks like:

It is a sequence of blocks, each containing data which is linked to the next block via a pointer. The pointer variable, in this case, contains the address of the next node in it and hence the connection is made. The last node, as you can see, has a null pointer which means that the pointer has no value.

One important thing to note here, the pointer inside each block contains the address of the next block. That is how the pointing is achieved. Now you might be asking what does that mean for the first block in the list? Where does the pointer of the first block stay?

The first block is called the “genesis block” and its pointer lies out in the system itself. It sort of looks like this:


Image courtesy: Coursera

If you are wondering what the “hash pointer” means, it is a pointer which contains the hash of the previous block.

This is what the structure of the blockchain is based on. A blockchain is basically a linked list and looks something like this:

The blockchain is a linked list which contains data and a hash pointer which points to its previous block, hence creating the chain. What is a hash pointer? A hashpointer is similar to a pointer, but instead of just containing the address of the previous block it also contains the hash of the data inside the previous block. This one small tweak is what makes blockchains so amazingly reliable and trailblazing.

Remember this point because we will be back in it in a bit.

So, the two most interesting aspects of the blockchain technology are:

  • Decentralization.
  • Immutability.

Let’s see how it acquires both of these properties.

#1 Decentralization

A normal network structure is the “client-server” structure.

How does that work?

There is a centralized server. And everyone who wants to connect with the server can send a query to get the required information. This is pretty much how the internet works. When you want to Google something, you send a query to the Google server, which comes back with the required results. So, this is a client-server system. Now, what is the problem with this model?

Since everything is dependent on the server, it is critical for the server to be functioning at all times for the system to work. It is a bottleneck. Now suppose, for whatever reason the main server stops working, everyone in the network will be affected. Plus, there are also security concerns. Since the network is centralized, the server itself handles a lot of sensitive information regarding the clients. This means that anyone can hack the server and get those pieces of information. Plus, there is also the issue of censorship. What if the server decides that a particular item (movie, song, book etc.) is not agreeable and decides not to propagate it in their network?

So, to counter all these issues, a different kind of network architecture came about. It is a network which partitions its entire workload among participants, who are all equally privileged, called “peers”. There is no longer one central server, now there are several distributed and decentralized peers. This is a peer-to-peer network.


Image Courtesy: InfoZones

Why do people use peer-to-peer network?

One of the main uses of peer-to-peer network is file sharing, also called torrenting. If you are to use a client-server model for downloading, then it is usually extremely slow and entirely dependent on the health of the server. Plus, like we said, it is prone to censorship.

However, in a peer-to-peer system, there is no central authority, and hence if even one of the peers in the network goes out of the race, you still have more peers to download from. Plus, it is not subject to the idealistic standards of a central system, hence it is not prone to censorship.

If we were to compare the two:


Image courtesy: Quora

This, in a nutshell, is how the blockchain technology gains its decentralized nature.

#2 Immutability

What is immutability?

Immutability, in the context of the blockchain, means that once something has been entered into the blockchain, it cannot be tampered with. The reason why the blockchain gets this property is that of cryptographic hash function.

In simple terms, hashing means taking an input string of any length and giving out an output of a fixed length. In the context of cryptocurrencies like bitcoin, the transactions are taken as an input and run through a hashing algorithm (bitcoin uses SHA-256) which gives an output of a fixed length.

Let’s see how the hashing process works. We are going to put in certain inputs. For this exercise, we are going to use the SHA-256 (Secure Hashing Algorithm 256).

As you can see, in the case of SHA-256, no matter how big or small your input is, the output will always have a fixed 256-bits length. This becomes critical when you are dealing with a huge amount of data and transactions. So basically, instead of remembering the input data which could be huge, you can just remember the hash and keep track.

A cryptographic hash function is a special class of hash functions which has various properties making it ideal for cryptography. There are certain properties that a cryptographic hash function needs to have in order to be considered secure. You can read about those in detail in our guide on hashing.

There is just one property that we want you to focus on today. It is called the “Avalanche Effect.”

What does that mean?

Even if you make a small change in your input, the changes that will be reflected in the hash will be huge.

You see that? Even though you just changed the case of the first alphabet of the input, look at how much that has affected the output hash. Now, let’s go back to our previous point when we were looking at blockchain architecture. What we said was:

The blockchain is a linked list which contains data and a hash pointer which points to its previous block, hence creating the chain. What is a hash pointer? A hash pointer is similar to a pointer, but instead of just containing the address of the previous block it also contains the hash of the data inside the previous block.

This one small tweak is what makes blockchains so amazingly reliable and trailblazing.

Imagine this for a second, a hacker attacks block 3 and tries to change the data. Because of the properties of hash functions, a slight change in data will change the hash drastically. This means that any slight changes made in block 3, will change the hash which is stored in block 2, now that in turn will change the data and the hash of block 2 which will result in changes in block 1 and so on and so forth. This will completely change the chain, which is impossible. This is exactly how blockchains attain immutability.

Now that we know what the blockchain technology is, let’s look at its blockchain applications in a couple of different industries.

Food contamination through supply chain – better traceability

Cybersecurity

Hacking is an ongoing problem all businesses are facing. Verizon did a survey which showed that apparently, 65% of the data breaches were because of weak, default, or stolen password. The survey also found that 23% of people time and again fall for phishing attacks and they keep on giving away sensitive data such as usernames, passwords, and credit card details. Cybersecurity is cost the global economy 400 billion annually. Developers us a number of approaches in the design of blockchain platforms to ensure security such as biometrics, KYC AML to name a few.

Voting

The paper ballot system has been used globally for a long time. It is known to be prone to bogus ballot papers and hijacking by intimidation by more powerful parties and no historical recording and tracking of votes to name a few issues. An electronic system using blockchain technology has been created using encryption technology to prevent some of the issues that have occurred in the past reoccurring.

Land registry

Property fraud is a big issue in many countries and the use of blockchain will help alleviate it by the use of smart contracts secured on the platform.

Source: Blockgeeks: https://blockgeeks.com/guides/blockchain-applications-real-world/2018