HomeBlockchainBlockchain EducationTutorial on Blockchain Technology

Tutorial on Blockchain Technology

This Comprehensive Blockchain Tutorial Explains What is Blockchain Technology, its History, Versions, Types, Building Blocks and how does a Block Chain Work:

Blockchain has emerged as a popular technology among the top organizations. There are high expectations from this technology and adoption rates are increasing with up to 77% of financial organizations being likely to adopt the technology into their in-production processes and systems from this year.

However, block chain is poorly understood, which is one of the impediments of its adoption. Close to 80% of people around the globe do not understand what it is.

This is the first series of blockchain tutorials which covers all the aspects of this technology. We will understand blockchain and its history, how does it work, and its basics such as the types of blockchain, block chain nodes, and distributed ledger. We will also look at how is it constituted.

This blockchain tutorial will also briefly look at how blockchain secures data and how that can help organizations in their various operations.

What Is Blockchain Technology?

Refer to the image below for understanding the differences between decentralized, distributed, and centralized networks.

A blockchain is a software that allows a network of computers to connect directly to each other without middlemen. It establishes a distributed or decentralized network of computers through which values can be sent instantly, exchanged instantly, or stored securely, and at a lower cost.

The data is copied to multiple nodes and each of these nodes runs the copy of the blockchain. Due to this, and the fact that the data is stored immutably in chains, blockchain eliminates the chances of the digital records being lost. It also reduces the chances of having the documents tampered, and a situation where they become unavailable in case one user’s node or computer is inaccessible.

Aside from the definition above, in simple terms, the name blockchain implies a chain of blocks. Data is stored in blocks and then the blocks are accumulated and secured as the transactions continue to be done on the network. The chain of blocks is linked to each other making the history of transactions hard to get lost.

Further, each block is time-stamped with details such as the time, date, and amount of transactions being public.

Key Aspects Of Blockchain

Blockchain fixes three things that the Internet cannot. Please refer to the table below for understanding the key aspects:

Key Aspects
ValueBlockchain creates value on digital assets, and which value is controlled only by the owner without middle-men. Value can’t be censored by government
TrustBlockchain tracks ownership, spending and records securing permanently and immutably such that they are publicly available and can all be traced.
ReliabilityBlockchain removes single points of failure – the middleman who could store data in one location and control data and this data would certainly be unavailable if the central point is unavailable.

History Of Blockchain

Blockchain technology was introduced back in 1991. It arose out of a need for a method that could time-stamp digital documents to prevent them from being tampered or backdated. Research scientists, Stuart Haber and W. Scott Stornetta described a system that used a chain of blocks secured by cryptography to store time-stamped documents.

It was later possible to incorporate many documents into a single block and then connect one block to another. This is after the Merkle Trees were added into the design in 1992 to make blockchain technology more efficient.

A block could then store a series of data records and then can be connected to the next, with the latest one containing a history of the entire block. The patent for the blockchain technology expired in 2004 with the technology being unused till then.

A Reusable Proof of Work (RPoW) introduced in 2004 by Hal Finney, a cryptographic activist as a prototype for digital cash, paved the way for the introduction of cryptocurrencies. The system could work and receive a token in exchange for work done.

The non-fungible token used on the network was based on Hashcash proof of work and was non-exchangeable, but could be transferred from person to person. In this system, the token could be stored on a trusted server, and users throughout the world could verify its correctness and integrity.

The theory of distributed blockchains was then introduced by Satoshi Nakamoto in 2008. Through his innovation, it became possible to add blocks to the chain without having to require them to be signed by trusted parties or middlemen. Modified trees could now carry a secure history of data records and each exchange could be time-stamped and verified by participants in a peer to peer network.

Thus blockchain could support cryptocurrencies and Satoshi Nakamotos design is now served as the public ledger for all cryptocurrency transactions in blockchains. Although Nakamoto used the words block and chain separately in his original paper that describes Bitcoin, the words were eventually popularized as a single word, the Blockchain, by 2016.

Blockchain Versions

a) Blockchain Version 1.0: The first implementation of distributed ledger technology to create money by solving computer puzzles was introduced by Hal Finney in the year 2005.

b) Blockchain 2.0: Smart Contracts: These are free computer programs existing in a blockchain. They are executed automatically to check facilitation, verification, or enforcement conditions. At the end of the day, blockchain allowed the securing of automated programs making them impossible to tamper.

Developers are now able to build and deploy their applications (dApps) on the blockchain. A good example of the application of smart contracts is on the Ethereum blockchain.

c) Blockchain 3.0: DApps: They are decentralized applications based on blockchain. They use decentralized storage and communication. The frontend code for a dApp is hosted on decentralized storage while the user interface is coded in any language that can make a call to its backend just like in the case of a traditional app.

Types Of Block Chains

Public vs Private Blockchain

Tutorial on Blockchain Technology 1

Public blockchain does not have any central authority controlling or directing its operations. All users participate in governance. Hence it is censorship-resistant since anyone can participate in the network regardless of location and nationality. Thus it is hard to shut it down.

Public blockchains have cryptocurrencies to define the value that is used to incentivize users as a reward to keep the network on, to secure its operations, and to approve transactions on it. Transactions on a public blockchain are public and visible to anyone through explorers. Examples include Bitcoin and Ethereum blockchains.

Private blockchain networks, also known as permissioned networks, on the other hand, are run by private organizations. The organization, a group or consortium acts as a means of centralization because it limits the participants based on given criteria and defines who connects to and transacts on the network.

Transactions on these networks are public and they are more centralized because the participants require playing by the rules of the entities running the blockchains. They have their idea application. An example of this is when a company wants to collaborate with a few others to share sensitive data that cannot be revealed through a public blockchain. These blockchains may or may not have a cryptocurrency or token as a native asset.

Examples of private block chain networks are consortium blockchains such as IBM blockchain. In this case, a group of private entities agrees on governance matters for shared benefits such as sharing client data. IBM Blockchain is based on the open-sourced Hyperledger Fabric and IBM applies the blockchain for different motives with different consortia.

Other examples include supply chain blockchain where the company permissions different participants in the logistics industry to share and secure business data, enhance efficiency, and speed up cross-border transactions. Businesses can look at the examples of permissioned blockchain networks they wish to join to achieve the shared benefits in these networks.

Central banks and governments can also collaborate through consortia blockchains for shared interests out of public concern.

Some private blockchains will not store data relating to the person or company involved in the transaction but others will. Instead of using a real name, however, the name is stored as a “digital signature” or some sort of username. A unique cryptographic code, known as the “hash” is stored in the blockchain which differentiates one block from another.

hybrid blockchain combines the privacy benefits achieved on a permissioned network with the transparency benefits achieved on a public block chain. With this, companies can make some data private while ensuring transparency by publicly availing other types of data and information.

An example of a hybrid blockchain network is the Dragonchain, which is a protocol that allows its users to connect with other users on other blockchain protocols. Companies can use this protocol to collaborate with others or serve users across multiple blockchains whether private or public.

How Does A Block Chain Work?

A node is used to access a full copy of the blockchain. Anyone who wants to run a blockchain can download it and sync it to the network. However, it is possible to transact on it without having a full copy.

One way is to use a custom decentralized application. This is what makes blockchain a platform since users and companies can build their own software and extend it as they like given that it is open-source.

Individuals and companies can also access and use blockchain through browser plugins or extensions, wallet extensions, or through custom third party software such as standalone wallets. Companies can also interlink through API integrations.

For instance, a company can develop its own custom blockchain network or decentralized application to achieve certain purposes such as securing company data, establishing a cryptocurrency or digital token; or perhaps to integrate its payments with suppliers.

A company can also host their entire buying and selling processes on the blockchain making it possible for clients to pay by cryptocurrencies instead of fiat. All that a company needs is the proper tools to build a blockchain or application from scratch. Others opt to customize the existing open-source public blockchains such as Bitcoin and Ethereum into a custom blockchain.

Most companies are building blockchain apps (called dApps) that can perform various operations instead of building blockchains from scratch. This is because building from scratch takes time and resources than building a dApp or customizing an existing blockchain. A company also needs to hire blockchain developers in the process.

We will see the reasons for building or adopting this technology later on in this tutorial.

Blockchain Nodes

Client-server vs Peer-to-Peer methods of computer communications:

Tutorial on Blockchain Technology 2

Ideally, blockchain’s main intention is to establish a decentralized network free of middlemen also known as a single point of failure because a centralized network would fail if there is a problem with the central storage or owner.

Anyone can then participate in this decentralized or distributed network to store and share data or value, transact and exchange data or value, to contribute resources for tasks such as mining, and to communicate with peers. There are many other applications available which we will see in this series.

Ideally, block chain allows the creation of distributed digital ledgers that can be stored in copies across multiple computers run by different users. All users share the same ledger in real-time. They also approve any updates and changes to the ledger.

A blockchain network can span miles of distance and connect users in different countries and continents around the world. For instance, around 10,000 nodes are distributed across the world and each is running a copy of Bitcoin blockchain. That does not mean Bitcoin has 10,000 users; Bitcoin has millions of users across the world and some are also connecting with methods such as wallets and other software.

Global distribution of Bitcoin nodes on a map:

Tutorial on Blockchain Technology 3

Blockchain nodes act to verify each of the transactions on the chain against a set of data to prove that it is legitimate as per network requirements. Just the way your data would be verified in a bank by the accountant before allowing you to transact, the same way transactions on a blockchain must be verified for validity.

For instance, nodes that are running a copy of the network blockchain will confirm the sender has enough amounts of value to allow the transaction to go through and to add it to a block and then to a chain. They will also reject the transaction if the amount is not enough or there are some frauds such as attempted double-spending.

Once given a green-light, the transaction is stored on the block alongside other accepted transactions. The block is later added to the previous blocks in the chain. All the nodes will then update to the updated chain and run it.

The block is given a hash code before being added onto the chain. The block then becomes publicly available for anyone to view the transaction histories and other public details such as who added the block and when (height) it was added to the chain.

Blockchain Explorers can be used by anyone to view all transactions and other details on the blockchain. The sender details remain fairly private though, such as the name of the sender. Blockchain.com is an example of a blockchain explorer that can be used to view transactions in various blockchains. Note, these transactions are unalterable.

How Does Blockchain Secure Data And Information?

Tutorial on Blockchain Technology 4

Blockchain employs cryptography, which uses public and private key encryption and decryption computer algorithms to secure user data. Encryption allows raw data being transmitted over the network such as the Internet or on blockchain network or in save mode to be converted to an unreadable format that makes no sense to third party readers.

This means that it is safe and private to transact and exchange information on a blockchain. Before one user sends data to the second user, the first can use a public key to encrypt the data, and then the second can use a private key that is related to the data during encryption, to decrypt and read the information. It’s the reason blockchain is one of the most secure technologies for securing data for organizations.

Security is a very important feature. For instance, because a blockchain will allow a digital asset to be transferred from one user to the other or to be stored or used to purchase a product, this value must not be possible to duplicate, steal, or forge.

Distributed Ledger Versus Normal Database

1Blockchain is a distributed ledger and is the one that is shared, replicated, and synchronized by all participants in a network. Supports peer-to-peer communication and transactions among users.Database is a central ledger that employs client-server network architecture. A central server is employed. Users communicate and transact through the server and middlemen.
2In the blockchain, all the users have equal control of the network and administration through consensus. They require keys and cryptographic signatures to access itThe administrator is the sole manager and will manage everything including who has the right to read, write, update or delete operations
3Since the ledger is distributed and members act as public witnesses to transactions, they are hard to forge and cyberattacks are harder than it is in a normal database.
Transactions are time-stamped and secured by cryptography and impossible to delete or cookbooks.
For a successful attack, all nodes require being attacked and compromised.
Easy to forge data when the attacker gains access to the single or a few servers in which data is stored centrally. Documents are easy to forge and can change ownership
4Redundant, with an extremely high number of copies requiring massive storage for the network. Scaling starts to become a problem.Databases reduce redundancies of data since it is kept as single or a few copies, allowed sharing of data among select users and parties and reduces the time for development and maintenance unlike in a distributed architecture where users will need to approve changes.
5Hard to maintain and develop as everyone has to come to a consensus about the changesVery easy to maintain and upgrade because few or one central authority is needed to approve upgrades.
6Much more democratic and participatory because every user has to participate in consensus buildingLess participatory and dictatorial if there is the misuse of powers.

Building Blocks Of Blockchain

Blockchain Consensus algorithm

A consensus algorithm inside a blockchain is the set of rules of the house about how the blockchain is governed, how users formulate and agree on the rules, and how transactions happen. Governance is an important aspect for a blockchain because it determines how decentralized or centralized the network is.

For instance, blockchain consensus algorithms allow any user to propose changes to the network and all others to vote on these proposals. In the delegated versions, users select delegates who make rules and govern the network on behalf of other users.

Tutorial on Blockchain Technology 5

Some versions allow users to contribute to governance based on the number of resources (compute or amount of cryptocurrencies) they contribute. In Bitcoin, for instance, miners vote on changes based on the number of computer resources or computing power they contribute to support the network and approve transactions.

In proof of Work algorithm, miners compete to create a block and the one who creates a block successfully is rewarded with the cryptocurrency after creation. Miners vote to allow or reject proposals of upgrades forwarded by other users.

Proof of Work (PoW): This algorithm is based on the idea of solving a complex mathematical puzzle to give a solution block. It requires a lot of computational power and the miner who solves the puzzle to mine a block and gets rewarded by Bitcoins.

Proof of Stake (PoS): This algorithm validates a block, with the block creator being selected based on the number of coins saved on the wallet. They then get rewarded for finding the block. In other words, the algorithm computer code awards the highest chance of mining most transactions and therefore the block, to the person with the highest amount of coins in the validator’s pool.

In the next rounds of validation, the chances for the previously selected validator keep reducing until other validators also get the chance to verify a block.

In Delegated Proof-of-Stake (DPoS), stakers select delegates and outsource validation of the block to them. Stakeholders will cast a vote to select delegates.

Other algorithms include Delegated Proof-of-Stake (DPoS), stakers select delegates, and outsource validation of the block to them. Stakeholders will cast a vote to select delegates; Byzantine Fault Tolerance (BFT) which select validators of blocks based on their reputation by leveraging their real identities.

The trustworthy validators are pre-approved and selected by participants to act as moderators. Others are Practical Byzantine Fault Tolerance (pBFT); Federated Byzantine Agreement (FBA); and Delegated Byzantine Fault Tolerance (dBFT).

Some blockchains use hybrid algorithms to leverage the benefits of more than one algorithm.

The below image explains the difference between the two main consensus methods: Proof of Work versus Proof of stake:

Tutorial on Blockchain Technology 6

Blockchain And Hashing Creation Of Blocks

Once transactions are sent to the network, each must be complete within a set of time. Transactions sent at the same time are combined into a block. Cryptographic hashing is employed to transform the transactions into a secure block, which are then connected to form a chain. A hash function or algorithm is used in this case.

A hash function transforms input string of any size into a fixed-length string output (called as the hash) such as 32-bit or 64-bit or 128-bit or 256-bit depending on what hash function is used.

The hash is the cryptographic by-product of the hash algorithm which is a one-way function, meaning it can’t be possible to reverse output into inputs again. The algorithm also produces one unique output. These properties are very essential for instance in cryptocurrency Bitcoin where it is used in its consensus mechanism.

The output acts as a digital fingerprint for a set amount of data. The transactions act as the input of the hash algorithm in cryptocurrencies. This hashing algorithm, which was developed by the National Security Agency (NSA) in 2001, is used in Bitcoin and many other cryptocurrencies.

How Hashing Works?

Starting with a string of any input length, you end up with a fixed string which is a series of numbers and letters.

Tutorial on Blockchain Technology 7

For instance, let’s say you install a hashing algorithm in your computer and type the words “This is a great tutorial” the output is: 759831720aa978c890b11f62ae49d2417f600f26aaa51b3291a8d21a4216582a

A small change in input will result in a huge difference in the output and each output is unique for a given input to avoid collisions. The output is always the same for the same input, which ensures consistency.

For instance, changing the input words to “this is a great tutorial” we get the output as 4bc35380792eb7884df411ade1fa5fc3e82ab2da76f76dc83e1baecf48d60018

This is a huge change for a small change from “T” to “t”.

Unlike encryption, cryptographic functions are irreversible because it is impossible to start with something like the output Hash value 4bc35380792eb7884df411ade1fa5fc3e82ab2da76f76dc83e1baecf48d60018 and end with the input to “this is a great tutorial.”

How A Block Is Built-in Blockchain?

Any new block in the chain is formed by hashing the transactions sent in the network by participants. Take for instance, when they are requesting to send cryptocurrencies or to save files. The block should have a block number (its count in the chain), data field, cryptographic hash associated with it, and a Nonce.

The Nonce (Number Used Once) is used to generate a cryptographic hash that meets a certain criterion to be valid. For instance let’s say a requirement that for the hash output to be valid it has to have four zeros in the lead (like the case in this output: 00001acbm010gfh1010xxx). Otherwise, it will be invalid. It is made valid by using the nonce.

A nonce is a random number that has to be changed manually and many times by the way of guesswork such that when it is fed into the algorithm or hash function together with the rest of the block data. It must give a valid block that obeys the rule or target, for instance starting with the four zeros.

This is actually what miners do in Proof of Work algorithms, the mining software keeps on guessing the number starting with one, incrementally. It keeps feeding the guesswork until it produces a hash output that meets the specified criterion or target.

The expiry duration it takes to make a correct guess for a particular block data set varies from blockchain to blockchain, with Bitcoin being 10, Ethereum 3 seconds, etc. The miner that does the correct guesswork is rewarded with cryptocurrency in the case of Proof of Work.

Once the block is mined, it is added to the previous chain, making it immutable or unchangeable but also publicly available via the blockchain explorers.

In cryptocurrencies, the double-spending problem is solved by ensuring that the first transaction to be confirmed is added to a block while the other is rejected. If both transactions are picked by different miners at the same time, the transaction that gets a maximum number of confirmations is added into the chain while the other is rejected.

In every blockchain such as the Bitcoin chain, blocks are built starting at 1 and increasing to n. Each block contains header data namely block number fielddata fieldnonce fieldhash value field, and previous field. The previous field details the hash value of the block before it. For instance, genesis block number one in any chain will contain the hash value of 0, etc.

One advantage of the chain and which results in the blocks being immutable, is, if data on any block is altered, it will relay to anyone on the network that there has been a change on that block number x.

Plus the new set of data following the altering will now have a new signature. It means that this new block will not be chained to the rest of the chain and will break the chain such that all the blocks after it will not chain to the original chain. Miners will reject the block number x as invalid and will shift to the previous record of the blockchain where all the other blocks are chained together.

However, the changing of the data may come via a software update and upgrading through a process called forking. Miners have the option to update to the new version and proceed with the new chain or keep loyal to the old chain.

Difficulty Of Creating A Block

The difficulty of finding a block is coded into the blockchain but is also connected to the four leading zeros in the hash output. What the difficulty means here is the difficulty of finding a hash output that is smaller or greater than the target; say at least four leading zeros.

The complexity also increases from time to time as more people join the network or rather with an increase in the hashing power. However, it is adjusted periodically to ensure that the block is mined within a specific set time.

For instance, in Bitcoin, it must be mined within 10 minutes. If more people join the Bitcoin network, it will increase to ensure the block is not mined faster, and if less is on the network, the difficulty lessens to ensure the block is easier to find to avoid delays in processing. The difficulty adjustment is automatic.

Ideally, what the difficulty means here is the number of choices a miner has in order to find a block. The fewer they are, the harder it is to find a block. For instance, a lower target number means fewer choices and this means it is even harder to find.


Blockchain introduces a distributed ledger that can be shared across networked devices. Individuals on the network can share files and values such as cryptocurrencies securely, on a peer-to-peer basis without the need for middlemen. This means reduced interruptions and there is no single point of failure, there is high reliability in the network. Due to cryptography, all assets are secured with high security.

The most important aspects of blockchain are its security, ensured by cryptography; scalability where the network should accommodate millions of users without compromising on security and reliability; and decentralization, which means control and governance must be achieved by all individuals on the network and not a select few.

The rules by which individuals agree on transactions and the creation of the chain is called consensus algorithm or mechanisms. The basis of these mechanisms is Proof of Work where individuals agree on what and when transactions go through or get processed, based on the amount of computer processing power they contribute. Blockchain technology has kept growing.

New consensus algorithms are more than 10 and keep on being innovated to ensure networks are scalable, more secure, and more decentralized.

This article has been published from the source link without modifications to the text. Only the headline has been changed.

Source link

Most Popular