Site icon Blockchain News and Updates

Blockchain basics (Part 1): What is a Block?

Blockchain

Blockchain is a shared and immutable ledger . (Photo by @CHUTTERSNAP on @Unsplash)

Understanding what a blockchain is, is not that difficult. Since this concept is becoming common in everyday use, we want to introduce how it works and its innovations gently.

Imagine the following situation. Alice wants to send $1000 to Bob. Traditionally Alice will make use of its bank. Using banks has advantages: Alice and Bob need to meet somewhere to transfer the money without the bank. It can also be dangerous to carry $1000 in the streets to make the payment. But, at the same time, using the bank has some disadvantages:

 

The Blockchain solution

With these problems, the blockchain eliminates intermediaries and decentralizes all management. The control of the process belongs to the users, not the banks. Alice and Bob become part of a massive network with millions of users, each a participant and manager of global accounting. 

A blockchain is a gigantic ledger in which the records (the blocks) are linked and encrypted to protect the transaction’s security and privacy. It is a distributed and secure database (thanks to encryption) that can be applied to all kinds of transactions that do not necessarily have to be financial. Think about intellectual property or real estate. You don’t trust anyone individually, but you trust all of them as a group. 

The blockchain is a unique ledger, agreed upon and distributed in several network nodes. When dealing with cryptocurrencies, we can consider it the ledger where each transaction is recorded.

 

 

Building a Block

The ledger (the blockchain) consists of a collection of linked blocks. But what is a block? A block consists of a bunch of data (records). These records can be financial transactions: issuer, receiver, and the amount transferred.

Schematically, a block from a basic (simplified blockchain) consists of the following:

A simplified block with its data elements.

Hash computation

The computation of the hash using the nonce is not an easy task. It is a computationally expensive process. When our computer finally computes the block’s hash, we say that the block is signed. This operation is what people call mining. Mining is signing (hashing) blocks, and this process falls under a consensus scheme called Proof of Work (more on part two of this post.). Once we have our first block, we distribute it to all the participants in the blockchain. All the participants will have an exact copy of our block and check that the hash is correct. The block is added to the blockchain if everybody (+50% of the nodes) agrees on the result.

 

Adding a new Block

Suppose we have new data to add to the Blockchain because Carol wants to send $500 to Dan, so we have to build a second block. The process is as follows:

  1. Calculate the block ID: Since this is our second block, it will have ID number 2
  2. Hash the block’s data. Note that inside our hashed data is the hash of the previous block.

Two linked blocks in a simplified blockchain

What happens if someone alters the data in the first block? Imagine that someone wants to modify the transaction and puts $10 instead of $1000. In this case, the hash of the first block changes, and the second block loses the first block’s link. Remember that the second block stores the hash of the first block. If you alter the second block, the rest of the nodes will detect that you changed the block, which is rejected. All the blocks behind the altered block will break as well:

Once altered the first block, all the blockchain breaks down.

Consensus Algorithm

We have seen that blockchain is a consensual registry. All the participating nodes store the same information. If some attackers wanted to modify the block’s data, they should change the entire chain in at least 51% of the nodes. In our example, the miners achieve the consensus by hashing blocks. The blockchain that uses Bitcoin uses a similar approach to the one described here. But hashing data is costly. A computer has to make many computations (consuming energy); this is why this type of consensus algorithm is called “Proof of Work or PoW.” The most common alternative to the PoW algorithm is called Proof of Stake (PoS). We’ll talk about consensus algorithms in a later post.

 

 

 

Conclusion

This is the first part post to understand blockchain basics. As we have seen, each block has a specific and immovable place within the blockchain since each block contains information about the previous block’s hash. Once we have a valid block, it is broadcast to all the available nodes, which compute the hashing. The complete chain is stored in each node of the network. All the participants keep a full copy of the blockchain.

 

 

 

Resources

Exit mobile version