09/06/2021

5 powerful Blockchain pillars

 

We have been able to appreciate this modern tool for several years. The success of the bitcoin cryptocurrency has allowed many people to understand the potential of this technology and in our company we strive to keep up with the progressive development of Blockchain. Fortunately at Simple Task we can rely on the knowledge of our experts when it comes to this technology. Therefore, we bring you an interesting topic that our colleague Robert presented at a recent online webinar.

 

Hash function is one of the blockchain pillars. Main purpose is to transform arbitrary data to fixed-size values. Some of the crucial properties that one hash function should fulfill are one-way function, deterministic speed and to have rare chance for collision. One-way property of the function means that data can’t be calculated from hashed value. Deterministic function means that there is no randomization and every time a hash is applied to the same data the result will be the same. Hash function has to be fast. This function has to provide rare chances for collisions because there are many data structures that rely on this function and one of them is the Merkle’s tree.

 

Single linked list – chain is an ordered data structure which consists of elements and pointers to the next element. In this particular case, blockchain, instead of pointing to the next element, this linked list contains elements that point to the previous element. Element in this chain is block. Some of the properties that one block contains and varies between blockchain implementations are transactions, block’s height which represents position in the chain, previous block hash which means the pointer to the previous element, difficulty which purpose is to support Proof of Work consensus algorithm along with property called nonce which is number of iteration. First block in the blockchain is called the genesis block. Block’s hash is calculated when the hash function is applied to all data it contains.

Blockchain pillar_image 1

Blockchain pillar_image 1

 

As already mentioned, the block contains transactions. Main function of the transactions is to change the state. So, transactions are used to send/receive coins, to create smart contracts or to execute smart contracts’ functions. There are various implementations of the blockchain, but some of the properties that transactions between implementation shares are from, to, amount, signature. From and to fields are hashed public keys and they are called addresses. Amount is the number of coins sent in a transaction. Signature is proof that the user owns the coins.

 

Previously mentioned, signature is another pillar of the blockchain. Cryptographic signature comes from public key cryptography. Public key cryptography consists of a private and respective public key. Private key is something which should never leave a user’s account and a public key is something that can be shared. Two users can securely communicate with each other by creating a message and signing with the other’s user public key. An example: User A has private (PrivKeyA) and public key (PubKeyA), user B has private(PrivKeyB) and public key (PubKeyB). When User A wants to send an encrypted message he will sign it with PubKeyB. With that approach, no one in the middle will be able to open and read a message except User B because User B has the private key which is going to be used to open the message. But there is a problem with changing the message even if the attacker can’t read the message – message still can be changed along the path. To prevent this, User A can sign a message with PrivKeyA and send the signature along with the message. With this approach, User B can check the signature against the message with PubKeyA and to check if the message really comes from User A and to check if there were changes during transportation. In the blockchain, encryption is not used but the signatures. Signing the transaction proves that only that user which contains the coins is able to spend his coins.

 

Blockchain pillar_image 2

Blockchain pillar_image 2

 

 

Blockchain pillar_image 3

Blockchain pillar_image 3

 

The power of blockchain comes from the nodes in the network. The network type is peer-to-peer (P2P) and each node is equal. This way centralization of the network is avoided and each node has to verify transactions, blocks and other nodes in the network. Nodes are communicating between themselves, sharing transactions and blocks and thus supporting a single linked list – chain – an immutable blocks and transactions which represents a history. Creating new blocks in the network is done via consensus protocols which depend on the blockchain implementation.

Blockchain pillar_image_4

Blockchain pillar_image_4

 

In centralized systems, there is a single point of authority which dictates the rules. On the other hand, in decentralized systems like blockchain, nodes cannot trust each other so they have to verify. The consensus is the agreement of the majority that change is correct. The consensus protocol is used to support changing state in the correct manner. Each node is able to change the global state by creating a new block which includes some transactions. To be able to do that, a node has to solve a problem and send the solution to other nodes. If the majority of nodes agree with the solution (reach the consensus), the solution and block are accepted and that node is rewarded with coins. Some of the most known consensus protocols are Proof of Work (PoW), Proof of Stake (PoS) and Proof of Authority (PoA).