twitterlinkedinmail

Unveiling Blockchain’s technology and its mechanisms

Blockchain technology is increasingly being proposed as an innovative solution, even in heterogeneous industrial sectors.

In order to learn how to evaluate its effective and concrete uses in different scenarios and use cases, it is therefore necessary to understand the basic concepts of Blockchain technology.

The Blockchain in recent times has gained the attention of the media, as well as of insiders, in relation to the possibilities that this technology seems to promise, to the point that many already speak of an upcoming digital “revolution”, along the same lines (if not even superior) to the revolution represented by the spread of the internet.

Born in support of bitcoin, and with it risen to the forefront of the news, the Blockchain would, according to many, be the solution to several long-standing problems that have to do with the concept of “trust”, understood as a necessary element to guarantee not only the reliability of financial transactions, but in general the guarantee of public faith in any relationship between opposing parties.

Therefore, the scenarios and possible uses of the Blockchain are innumerable, according to its enthusiastic supporters, from the tracing of the agro-food supply chain, to the contrast of the Fake News.

How many of these high-sounding promises constitute real scenarios and use cases for which the Blockchain can actually be a turning point, and how much does marketing influence the choice of adopting this technology?

To have an overall picture, which allows you to consciously evaluate the actual benefits that can be drawn from the Blockchain, it is necessary to understand the mechanisms and the functioning of this technology.

Although many of the implementation details of the Blockchain take on an esoteric aspect, understandable only by “initiates”, to the point of intimidating the “layman”, in reality the underlying logic on which it is based can be understood even by those who do not have technical knowledge of programming.

Intended Audience

The book “Blockchain Fundamentals” is therefore aimed at all those (be they companies, professionals) who are interested in knowing and understanding the characteristics of blockchain technology from the ground up.

The proposed contents can be successfully enjoyed even by an audience that does not have specific technical skills, and previous experience in the blockchain field is not required to follow the contents.

Introducing the Blockchain

Essentially, the Blockchain is a

  • distributed archive

  • based on peer-to-peer networks

  • implemented through encryption

As a distributed and decentralized archive, aimed at managing the transfers of digital assets, the Blockchain allows users to exchange digital values with each other in the form of transactions.

In this way, there is no need to resort to third parties/authorities which guarantee transactions.

Let's now see the Blockchain goals and how they are met by the underlying technology.

Blockchain's Goals

Blockchain technology was originally introduced to support Bitcoin.

The main purpose was to prevent the phenomenon of double spending of cryptocurrencies, i.e. the possibility of spending the same currency several times.

However, the role of the Blockchain is not limited to the financial transaction sector.

In general, each transaction involving digital values can be recorded within a distributed ledger.

Blockchain technology

Blockchain technology can take different forms and implementations.

Therefore, it represents more a concept of an architectural nature than a specific and well-defined technology.

Each different implementation can also provide specific features and functionalities, such as the execution of smart contracts.

Blockchain transactions

The exchange of values between the counterparties within the Blockchain takes place by recurring to transactions.

The transactions are validated by the network of blockchain nodes, before being inserted into the distributed ledger.

Once appended to the ones already registered within the ledger, transactions become unalterable and unchangeable.

Blockchain's blocks

By its very nature, as the name itself shows, the Blockchain is nothing more than a chain of blocks.

Each block within the Blockchain contains one or more transactions.

The addition of new blocks to the Blockchain takes place on the basis of predetermined time elapses.

In this way, it is possible to keep the overall history of transactions, by tracing the sequence of registrations made on the blocks.

The distributed ledger

In accounting terms, the blockchain can be considered a distributed and decentralized ledger, known precisely as the "distributed ledger".

The management of the ledger takes place through the use of consensus protocols, which are designed to achieve the network's consent on the transactions recorded within the ledger.

There are different types of consensus protocols, as much as there are different implementations of the blockchain.

Among the most common consensus protocols we can mention the Proof of Work (PoW), the Proof of Stake (PoS) and the Proof of Authority ( PoA).

Blockchain core concepts

We'll now introduce the concepts on which Blockchain technology is based, such as distributed archiving, decentralized peer-to-peer networks, transparency and irreversibility of transactions.

Distributed Archiving

The ability to store data within a distributed database allows each participant to access the complete transaction history.

In addition, distributed archiving prevents a single entity from taking full control over the archived information.

Distributed archiving allows individual nodes to directly and independently verify the integrity of the information stored.

It is therefore not necessary to use third parties or intermediaries to carry out the verification of transactions.

The verification of the integrity of the information is in fact implemented through the hashing functions.

Let's now see how peer-to-peer networks help implement distributed storaging of transactions in the Blockchain.

Peer-to-peer networks

To implement distributed storage, the blockchain uses Peer-to-peer (P2P) networks.

In this type of network, no node assumes the role of central server.

On the contrary, in a P2P network each node assumes the role respectively of client and server when appropriate.

P2P network

Transactions transparency

Each transaction and its associated value are publicly visible to all network participants.

The counterparties of a transaction are identified by their respective addresses, consisting of alphanumeric sequences.

Each transaction is subjected to a number of confirmations by the miners nodes, before being validated and inserted into the distributed ledger.

Transactions Irreversibility

After being entered into a block and added to the blockchain, transactions are no longer modifiable.

This result is achieved by concatenating togheter the different blocks that make up the blockchain.

Any modification to the transactions already archived in the ledger would in fact lead to the alteration of the calculated previously hashes.

This alteration would be immediately evident to all the nodes in the network that would therefore prevent transaction confirmation.

Centralized versus Decentralized networks

As we have seen, one of the basic principles of the Blockchain involves the use of a Peer-to-peer network communication protocol, in order to achieve the decentralized storage of the information.

To understand the advantages associated with decentralized networks, we will first introduce traditional centralized networks, analyzing their main characteristics, then comparing them with decentralized peer-to-peer networks.

Centralized networks (Client-Server)

In the following image, we show a typical example of a centralized network:

Centralized network

The main feature of these types of networks is the presence of a central node, acting as the server node.

Client nodes can connect only to the central server to get the information they need.

Let's now see some examples of centralized networks, assessing their pros & cons.

Centralized networks: examples

A typical example of a centralized network is represented by traditional client-server web connections.

The main advantage of a centralized network is represented by the simplicity of implementation, maintenance and updating of this architectural model.

The necessary information is stored and updated in a single central node (the server) which makes it available to clients.

Centralized networks: limitations

The fundamental limitation of centralized networks is represented by the fact that in the event of a malfunction or compromise of the central node (for example due to cyber attacks), the information contained therein is no longer available and accessible by the entire network.

In addition, in centralized networks the server node assumes and retains full control over information.

Due to these limitations, the Blockchain adopts a decentralized network communication protocol to achieve its own functionality.

Decentralized (Peer-to-peer) networks

By definition, in a decentralized network there is no central node that assumes the role of control authority of information sharing.

In contrast, in a peer to peer network protocol, each individual node is able to interchangeably play the roles of client and server.

The decentralized model therefore allows each node of the network to autonomously contribute to the sharing and verification of information.

P2P network

This model therefore makes the presence of a central information control authority superfluous.

Blockchain & Decentralized networks

The characteristics of decentralized networks are essential for realizing the features of the blockchain.

One of the key advantages of the blockchain is in fact the decision-making decentralization on the verification, validation and insertion of transactions within the blockchain.

These decisions are then condensed within the blocks, which constitute the building blocks of the blockchain.

Blocks, the building elements of Blockchain

The Blockchain, as the name states, is nothing more than a chain of blocks.

The simplest unit of a blockchain is in fact constituted by the block.

Each block contains within it a certain number of transactions that represent the transfers of values ​​between the counterparties, carried out within the blockchain.

Blocks and transactions

Each block contains batches of transactions with their hashes.

The number of transactions contained in a block depends on the block size.

The average size of a block is about 1 MB, but it can even reach larger sizes, as in the case of Ethereum.

In Bitcoin, a block contains more than 500 transactions on average

Let's now see how the block time affects the size and the number of transactions that can be embedded inside a block.

Blockchain block time

Each blockchain has its own block time, i.e. the approximate amount of time required to add a new block to the Blockchain.

The block time affects the number of transactions that are inserted within the single block.

For example, if the blockchain had a blocking time of five minutes, and there were only four transactions completed during those five minutes, the block will consequently contain only those four transactions.

Block time and number of transactions

In the event that there are too many transactions compared to the block size, the transactions should wait for a block still open, which has enough space left to accommodate and insert them within it.

In the case of Bitcoin, the blocking time is 10 minutes.

This value derives from the limits set in the Bitcoin source code.

These limits in turn derive from the objective of issuing no more than 21 million bitcoins in the period between 2009 and 2024.

Remunerations for miners are reduced accordingly by half every four years.

The structure of the blocks

Each block consists of a header and a list of transactions.

Each block includes the hash of the previous block, thus the blocks as a whole constitute a chain that connects all the blocks together.

The first block of the Blockchain is called "genesis block".

Block header

The block structure is represented by the block header.

Bitcoin block header

This data structure contains a series of information relating to blocks, also known as metadata.

  • Hash of the previous block: this value is required to compute the corresponding hash of the new block to be added to the blockchain;

  • Merkle root: it is the hash value associated with the root node of the transaction tree, which acts as a check on the validity of the block;

  • Timestamp: it's the time stamp assigned to the block;

  • Nonce: an arbitrary value that is used in block mining.

The blocks are stored in a tree structure known as the Merkle tree.

Blockchain transactions - Nature and characteristics

The Blockchain, as the name states, is nothing more than a chain of blocks.

The simplest unit of a blockchain is in fact constituted by the block.

Each block contains within it a certain number of transactions that represent the transfers of values ​​between the counterparties, carried out within the blockchain.

Transactions must undergo the confirmation phase by miners, which are rewarded for their work in bitcoins. Without confirmation, no transaction can be convalidated.

Blockchain overall process

Transactions and Distributed Ledger

One of the characteristics of Blockchain is that it makes the intervention of intermediaries in transactions superfluous.

People can carry out transactions without third parties being involved. The shared ledger itself manages and ensures the integrity and reliability of transactions between the parties.

The ledger is maintained and updated in a distributed manner by all participants in the blockchain, and all nodes taking part of the networks can verify the reliability of transactions without resorting to trusted third parties.

Let's now see the characteristics of the distributed ledger and the ways in which it is managed.

Distributed Ledger

From the accounting point of view, the ledger is simply a cronologically held register of economic transactions.

It is analogous to the ledger commonly used by banks and other financial institutions, to reconcile the accounting balances.

All the charges and credits during an accounting period are calculated to prepare the accounting balance.

The balance sheets of banks, financial institutions and businesses, are compiled using accounting records within a ledger.

When we conduct a traditional financial transaction using fiat currency, we have a third party ledger that keeps information about each transaction.

Some of these third-party trust systems are traditionally represented by banking and financial institutions (such as VISA, MasterCard, and so on).

Blockchain has radically changed the management methods of this accounting system, making all the network operators participate in the preparation of the ledger.

This is why the ledger is also called distributed ledger: all those who carry out a transaction in the blockchain, also have access to the registration of other transactions that have occurred, or that are taking place in the blockchain.

The data structure employed in the implementation of the distributed ledger is known as the merkle tree:

Merkle tree

Basically, it traces the structure of a tree, whose leaves correspond to the different transactions recorded within the ledger; for each path, starting from the root node, the corresponding hash values ​​are calculated, the references of which are stored inside the blocks.

Since each transaction is linked to the previous ones, any subsequent changes would be immediately recognizable by anyone, simply by recalculating the corresponding hash values.

Being distributed, this decentralized ledger provides several confirmations of authenticity for each transaction that has occurred.

One of the key properties of blockchain technology is that it encourages a global and shared concept of trust in transactions.

Assuring transactions integrity

How is the integrity of transactions guaranteed within the Blockchain?

This is what we will deal with now, analyzing the different cryptographic features, such as hashing and hash digests, highlighting the differences that exist with the actual encryption algorithms.

Finally, we will show a practical example of calculating a hash digest using the class of SHA algorithms used in the implementation of the Blockchain, using simple tools available online.

Hash digests: the fingerprints of the blocks

Let's start by showing the hash digests, considered the "fingerprints" of the blocks of the Blockchain.

As we have said, the integrity of transactions within the blockchain is achieved through the use of hash functions.

Hash functions constitute a class of algorithms that make it computationally unlikely that different alphanumeric strings will give rise to equal hash values.

Hashing algorithms are specifically designed to be sensitive to even the slightest variations in the input data.

Encryption and Hashing: Differences

An interesting property of hashing algorithms is that they are not reversible, unlike cryptographic algorithms.

Reversible here means that it is possible to convert an encrypted text into its original plaintext, using the decrypting function, which is the inverse of the encrypting function:

Encryption decryption

Unlike cryptography, there is no reverse function for hashing.

This means that we cannot convert the calculated hash value to its original input, as hashing is a one-way process by definition.

Now let's see how the Blockchain exploits the irreversibility characteristics of the hashing algorithms to guarantee the integrity of transactions.

Hashing and transaction integrity

Hashing algorithms are designed to prevent collisions, i.e. the possibility of obtaining the same hash value for two different input strings.

Thanks to these features, hashes can be considered a kind of data fingerprint: any variation, even minimal, in the original data will result in a very different calculated hashing value.

Making use of hash functions within the blockchain, anyone can verify the integrity of blocks and transactions by calculating their corresponding hash values ​​and comparing them with the values ​​stored within the blockchain.

There are several families of hashing algorithms: the bitcoin Blockchain adopts the SHA-256 hashing algorithm.

SHA hash value: calculation example

In the example below, we see how the hash value generated by the hashing algorithm radically changes even in the case of minimal changes in the input data.

The images below show the results obtained using the hashing tool available online at www.sha1-online.com

SHA256 digest ex.1

SHA256 digest ex.2

As it is easy to notice from the output produced, even minimal variations in the input strings determine completely different output values, that are not easily attributable to the original ones.

Subscribe the newsletter to stay updated on contents

 

Loading