Blockchain Tutorial – Learn Blockchain Technology from Scratch

Blockchain Tutorial for Beginners – An Ultimate Guide

We are starting a “trending” chain of tutorial series that I am sure you will be fascinated about. Yes, you are right, we will be learning about the most hyped technology (in recent years) of cryptocurrency that is blockchain. Everyone is very curious to know – what is cryptocurrency, what is blockchain and how can we earn money from it (the most asked )?

Don’t worry! DataFlair is here to resolve all your queries and confusion related to blockchain and of course how can we miss “bitcoin” (the most favored one). In this tutorial, you will be learning about all the major aspects of blockchain technology including:

  • Introduction
  • History
  • Prerequisites
  • Features
  • Types
  • Working
  • Benefits
  • Applications
  • Bitcoin
  • Case Study
Blockchain Quiz

Blockchain Tutorial

Let’s start the blockchain tutorial by understanding the definition of blockchain.

What is Blockchain?

Blockchain is a secure series or chain of timestamped records stored in a database that a group of users manages who are a part of a decentralized network. Blockchain is a decentralized or distributed ledger where each node in the network has access to the data or records stored in a blockchain. The encryption of all the important data records in the blockchain is done using cryptographic techniques. This ensures the security of the data in the blockchain. 

So, the primary concept behind blockchain technology is having a network of multiple users or computers known as “Nodes” which can have secure and legitimate transactions directly without a third-party mediator. Any authorized node that is a part of the network can access the set of records added as a legitimate block in the blockchain. This makes the blockchain system an immutable, distributed digital public ledger that can record financial as well as other types of transactions. In the sections to follow, we will learn in detail how does blockchain work but before that let’s check the history of technology in the blockchain tutorial.

Blockchain History

Stuart Haber and W. Scott Stornetta introduced the concept of a secured chain of blocks (set of records) in 1991. Later in 2008, a person or a group known by the pseudonym “Satoshi Nakamoto” conceptualized and implemented the blockchain technology. They introduced the concept of using hashing in the blockchain system to make it so secure that no one can make changes or remove the records once saved in the blockchain. The Bitcoin cryptocurrency system uses this blockchain design as its fundamental or base technology. 

Prerequisites to Learn Blockchain

The main prerequisite to learn blockchain technology and make it a full-time thing is to have a solid technical background and thorough knowledge of the blockchain. The technical skills you need to be good at before starting professional work with blockchain are:

  • Software development practices
  • Data analytics
  • Vulnerability analysis
  • Traditional as well as advanced analytics
  • Cryptography
  • Embedded programming
  • Comprehensive testing

Get convinced with 13 Essential Reasons to Learn Blockchain Technology

Working of Blockchain

Now, let’s come to the most interesting part of the blockchain tutorial that is how does blockchain work? By far, we have learned that blockchain is a concept of a decentralized network and distributed digital ledger. In this ledger system, legitimate and secure transactions can take place as a point-to-point exchange. So, let us understand the working of this technology and how is it used to record information and carry out secure transactions.

Blockchain is a system of network of multiple nodes or computers which acts as a distributed network over the internet, worldwide. Each node has the authority to make a transaction, verify a transaction, receive a transaction and create a block. The blockchain is a cryptographically linked chain of blocks (set of records) such that no one can falsify or modify the data stored in it. Once we enter a set of transactions in a blockchain then it becomes a part of it forever. So, we can call blockchain to be a distributed database whose data is unchangeable. Each node on a blockchain network has a separate copy of this ledger or database. They can access the transaction history on the blockchain whenever they want and get it updated every time a node adds a set of new transactions (block) into the chain. 

We will now understand the entire process by dividing it into individual steps.

Blockchain working - Blockchain tutorial

Step 1: Suppose, two nodes in a blockchain network say node A and node B wants to make a new transaction. 

Step 2: This transaction can only take place if all the other participant nodes in the network verify it as a legitimate transaction. Thus, each node will receive the request to verify the transaction to happen between A and B. 

Step 3: Each node will check certain points about the transaction such as the authenticity of the two nodes, is the transaction amount within limits, does A have sufficient funds to make this transaction, etc. 

Step 4: Once all the nodes check and verify all the aforementioned points, the transaction is ready to take place. Then that transaction gets added into a memory pool or mem pool. 

Step 5: Several such verified transactions get aggregated into mem pools and multiple mem pools combine together to make a block. Every block has a defined memory limit to store transactions. 

Step 6: Every new block will have a block header, that consists of transaction data summary, timestamp, hash code of the previous block and its own hash. Every block has its unique hash code which acts like its fingerprint. 

Step 7: In order to add a new block into the existing blockchain, nodes in the network need to do proof-of-work. As we know, each block has its unique hash function which is an identification code created using SHA256. Doing proof-of-work is decrypting this code and finding the correct answer to this hash puzzle. To do proof-of-work, we need specialized computers that take on an average of 10 minutes to crack the code automatically. 

Step 8: A block gets verified every time a node completes its proof-of-work and finds the correct answer to the hash puzzle for that block. More and more nodes must verify or complete the proof-of-work for the same block so that it finally gets added into the blockchain. Every block has a unique set of transaction records. To create a new block and add it to the blockchain, one must have a completely unique set of transactions in that.

Step 9: With this, a new block gets added and a transaction is completed between points A and B. 

This process repeats itself and new blocks continue to get added in the blockchain permanently. There is a unique concept of rewards upon doing proof-of-work which we will learn in the lessons to come. 

Blockchain Features 

Now that we know what a revolutionary concept blockchain is, we are sure you must be eager about learning more. Moving ahead in this blockchain tutorial, we will go through some of the key features of blockchain. We can also refer to them as the three pillars of the blockchain concept. 

Join DataFlair on Telegram

blockchain features - blockchain tutorial

  • Peer-to-peer Network: In a blockchain network, transactions can take place directly between two nodes in a network. There is no need of a third-party mediator. For instance, if there is a financial transaction between two nodes in a blockchain, they can directly facilitate the transaction without having to do it through a bank. This is also known as a point (P2P) network where a transaction takes place between two nodes which get verified by all the other nodes in a blockchain network. Thus, participants of a blockchain network can make direct and secure transactions within seconds.
  • Decentralized: The entire blockchain system is a decentralized and distributed one. Meaning, there is no central entity that controls and manages the blockchain but every node in the network has equal authority and access over the records. Each node has a copy of the ledger and has the right to verify a transaction or conduct a transaction. This makes the blockchain network tightly secure and transparent. 
  • Incorruptible and Immutable: Due to its point to point and decentralized nature, there is no middle-man in the transactions and everyone in the network has a copy of records with them. This makes the data entered into the blockchain tamper-proof and immutable. Also, because blockchain uses cryptography or hashing techniques to secure a block (set of records), it is nearly impossible for someone to hack and change the records. Every block has its own unique hash and the hash of the previous block it is linked to. If one attempts to tamper with the records in a blockchain, the hash function of that block will change, and the entire chain’s hash will disrupt. This makes interfering with records very difficult and detection of an interference easy.

Types of Blockchain

There are primarily two types of blockchains; Private and Public blockchain. However, there is a third type of blockchain too, known as Consortium blockchain. Before we get into details of the different types of blockchains, let us first learn what similarities do they share. Every blockchain consists of a cluster of nodes functioning as a peer-to-peer (P2P) network system. Every node in a network has a copy of the ledger which gets updated timely. Each node on all types of blockchain can verify transactions, initiate or receive transactions and create blocks. 

Now in the blockchain tutorial, let’s have a look in detail about the three types of blockchains that are possible. 

  • Public Blockchain: A public blockchain is a non-restrictive, permission-less distributed ledger system. Anyone who has access to the internet can sign in on a blockchain platform to become an authorized node and be a part of the blockchain network. A node or user which is a part of the public blockchain is authorized to access current and past records, verify transactions or do proof-of-work for an incoming block (thus, do mining). We use public blockchains for mining and exchanging cryptocurrencies thus, the most common public blockchains are Bitcoin and Litecoin blockchains. Public blockchains are mostly secure if we follow security rules and methods strictly. Although, it is only risky when the participants don’t follow the security protocols sincerely. 
  • Private Blockchain: A private blockchain is a restrictive or permissioned blockchain operative only in a closed network. Private blockchains are usually used within an organization or enterprise where only selected members are participants of the blockchain network. The level of security, authorizations, permissions, accessibility is in the hands of the organization. So, we use private blockchains for similar purposes as a public blockchain but have a small and restrictive network. Examples of private blockchains are; Multichain and Hyperledger projects (Fabric, Sawtooth).
  • Consortium Blockchain: A consortium blockchain is a semi-decentralized type where more than one organization manages the blockchain. Contrary to what we saw in a private blockchain which a single organization controls. Thus, in a consortium blockchain, more than one organization or authority manages the blockchain. More than one organization can act as a node in this type of blockchain and exchange information or do mining. Examples of consortium blockchain are Energy Web Foundation, R3, etc. 

Learn about the Types of Blockchains in detail and choose the best one

Benefits of Blockchain Technology

Blockchain technology is a revolutionary technology if accepted and implemented properly. It is a direct and secure way of conducting financial transactions or exchange files within a network. 

blockchain benefits - blockchain tutorial

Here are some major advantages of the blockchain technology that makes it so unique and popular. 

  • Immutable data: One cannot change a data record or information that is once stored or added as a block in the blockchain. The data in the blockchain is immutable that is no one can make changes in it and it gets a permanent place in the blockchain.
  • Digital freedom and decentralization: The entire blockchain network is a decentralized one as it gives every user its digital freedom. There is no central authority that controls all the other users in the network. Every node is independent in functioning. 
  • Anonymity and privacy: The blockchain network has tight security techniques for the transactions to take place securely. For users that use blockchain for cryptocurrencies like Bitcoin, can do so anonymously (without revealing their real identity) keeping their privacy and security ensured. 
  • Security: The security method in the blockchain is cryptography that ensures that hackers cannot change or tamper with the data records stored in the blocks of the blockchain. Encrypted hash functions link all the blocks in the blockchain and so it is impossible to do fraud or illegitimate transactions in the blockchain network. 
  • No intermediaries: Due to the point-to-point nature of the blockchain network, transactions take place directly between two nodes without a mediator. There is no need for an intermediary like Paypal, any bank, Visa, WesternUnion, etc. to facilitate transactions between two parties. 
  • Transparency: The digital distributed ledger system provides a great deal of transparency to all those who are a part of the network. Each node in a network has its own copy of the ledger and has the right to verify transactions. Due to this, no one can hide their details and transactions from the other users ensuring fair trade. 
  • Low transaction cost: As there are no intermediaries in a transaction within the blockchain network, the transaction costs are also lowered. Transactions of millions of dollars can happen for around $1.00 or even less. If there are intermediaries involved, then they charge a heavy amount and your overall transaction cost increases. 
  • Consensus-based: The blockchain concept is entirely consensus-based, that is, for every transaction that takes place between two nodes in a blockchain, a request for its verification is sent to all the other nodes. After all the nodes verify a transaction, it goes into the memory pool to make a new block. The memory pool stores numerous such verified transactions. 

Applications of Blockchain

Now that we know what an ingenious technology blockchain is, it obviously finds its application in many fields and areas. In this section of the blockchain tutorial, we will discuss some of the most common fields which use blockchain technology. 

blockchain applications - blockchain tutorial

  • Cloud Storage: Blockchain provides a decentralized system for storing files on the cloud. It is like an Inter Planetary File System (IPFS) in concept where sharing and storing files happen in a distributed web system rather than a client-server web which we currently have. Each website can act as a node which has a P2P transfer of files with other nodes directly, instead of requesting a central server. 
  • Cryptocurrency: Blockchain technology acts as the backbone of cryptocurrency systems like Bitcoin. Cryptocurrency is an encrypted digital currency that everyone can use as a medium of exchange in transactions. Such transactions take place through the blockchain network. The blocks in a blockchain store the records related to generation and transaction of cryptocurrency between two nodes permanently. These days, there even exist cryptocurrency wallets where you can send and receive cryptocurrencies or exchange them for other currencies. 
  • Healthcare: With the help of block-chaining, we can store information about patients and drugs in a database securely. Doctors can access patient records and history to analyze a case better at a given point to ensure proper treatment. Also, organizations can monitor and handle drug counterfeiting in the medical supply chain. This is because they can store the supply chain data as permanent blocks in the blockchain. 
  • Smart Contracts: Ideally, when two parties sign an agreement or make a deal, it is a paper-based contract (which states all the terms and conditions of the deal) which the parties involved sign. However, this method of having deals and making contracts is subject to the risk of fraud and tampering. With blockchain as the base technology, a smart contract concept came into existence. Smart contracts are digital, self-executable contracts recorded and stored in a blockchain once created. A smart contract is a programmed file containing all the terms and conditions of a contract between two parties and it automatically executes itself once all the conditions are met. This gives a 100% guarantee and prevents the deal from any fraud. 

Smart contracts were first introduced through an open-source blockchain network known as Ethereum. The smart contracts also find their application in areas like real estate property deals, financial agreements, insurances, crowdfunding, etc. 

  • Elections: Another interesting fact about blockchain is that we can participate in elections online with a blockchain system as its backbone guaranteeing the security of records and anonymity. People can cast vote online without physically showing up at a polling booth and the votes will be safely registered on a blockchain. It is nearly impossible for someone to hack into the system and tamper with the votes cast. This makes blockchain technology best for online voting as it would really increase the total number of people participating in elections. 
  • Digital Identity Management: With the digital revolution, the risks of fraud have also gone up significantly. More and more incidents of cybercrime and digital fraud are surfacing. This is due to easily hackable digital identities of people that hackers can use to do fraud and theft. To ensure the security of digital identities of people, blockchain is the best solution. Having the ids, passwords and authorized documents stored on blocks in a blockchain as a universal online directory. No fraud can occur as identity verification of every user is a necessary step in the blockchain system. One cannot access the online ledger if the credentials don’t match with the records of the blockchain network. Also, there is no chance of hacking in a blockchain system.
  • Intellectual Property Protection: The information available on the internet is intellectual property. Nowadays, with enormous information getting shared on the internet, copyright issues are surfacing more than ever. Content is easily copied and distributed without the permission of the original author. However, there are copyright laws, but they are not quite in place. Moreover, there are no global laws or standards regarding copyrighting content which increases the problem. 

Blockchain is again a savior here as one can copyright their content as a smart contract and store it in the blockchain. The authors or owners of the registered content will have full authority over the accessibility and distribution of their content and share it according to their will. 

  • Automated Governance or DAOs: Automated governance or Decentralized Autonomous Organizations (DAOs) which are self-governed organizations. DAOs are self-governed organizations that abide by a strict set of rules. DAOs are built on blockchain and smart contracts as their foundations. Every stakeholder in a DAO will have equal authority and opportunity to contribute to the organization. This is unlike the traditional system where much of the corporate governance is under the control of the bureaucracy and hierarchical management. 
  • Supply Chain Audits: Block-chaining also helps in guaranteeing the authenticity of a product in supply chain audits. Manufacturers can store the details of their products on a blockchain and consumers can verify the genuineness of the product by checking the records on the blockchain. 
  • Sharing Economy: With blockchain, the need for intermediaries is gone and the trend of the direct transactions between interested parties has arrived. Apps like OpenBazaar use blockchain technology as they follow a peer-to-peer approach. Here, the seller uploads their product and quotes a suitable price. Then the interested buyer contacts the seller directly without an intermediary like Uber or Airbnb. 
  • Internet of Things: As you all must be familiar with this term, IoT is our future! All the big players like IBM, AT&T, Samsung, etc. are focusing on enhancing their reach in the IoT market to become a global leader. Blockchain and smart contracts can prove to be useful for the implementation and workings if IoT systems. A smart contract can store software, sensors and other important details that will take care of the proper functioning of the electronic device and the network. Smart contract executes themselves only when certain conditions are met properly and so it helps in monitoring and executing protocols for the IoT mechanisms using blockchain. 

Master the IoT technology from IoT Tutorial Series by DataFlair

  • AML and KYC: The concepts of Anti-Money Laundering (AML) and Know Your Customer (KYC) are also adopting blockchain technology. New start-ups like Trust in Motion (TiM) store verified documents as records in a blockchain. One can use these records anytime to verify a user. Similarly, Polycoin is a start-up focussing on AML/KYC practices. Their focus is on analyzing transactions and detecting fraud.
  • Property Management and Registry: Land is one of the most valuable assets for a man. Due to its demand and value for money, properties or lands have always been subject to the risk of illegal acquisitions or frauds. To counter this problem, blockchain technology has been readily accepted into systems of many countries. Countries like Honduras, Georgia, Sweden are shifting to a blockchain-based publicly accessible ledger that keeps the record of land title registries. The details of a registry get recorded permanently on a blockchain every time a buyer buys a piece of land or transfers it to another owner. This makes a permanent record of all the rightful owners of land. One can check in the blockchain database to know the entire history of possession of that land. It eliminates every chance of fraud or forgery and makes it completely secure. 

Bitcoin and Blockchain

Whenever you might have heard or read about blockchain, the word “Bitcoin” must have caught your attention. Bitcoin has become quite a popular phenomenon by now. So, what is bitcoin? Is it a physical coin?

Bitcoin is a digital cryptocurrency that is not a physical currency like a 10-rupee coin. Rather, it is a digital currency on a blockchain peer-to-peer network used in an encrypted form. Bitcoins transactions follow a distributed ledger system where transactions between two interested parties take place as a point-to-point exchange. Every node on the bitcoin blockchain verifies the bitcoin transaction and do proof-of-work (mining) to authorize the transaction and users. The transaction, upon getting verified gets permanently added into an open blockchain as a new block. Bitcoins are also given as a reward to miners for doing correct proof-of-work in a blockchain network in order to add a new block in the chain. There will be a total of 21 million bitcoins created out of which 17 million are already in use. Blockchain was first used as the underlying technology of the Bitcoin system in 2009 when the Bitcoin ledger started on 3rd January 2009. We can exchange Bitcoins for other currencies, products or services by means of Bitcoin wallets available on the web. 

Blockchain Case Study on Maersk

Before we conclude our introductory talk in the blockchain tutorial, let us go through a use case or case study of blockchain technology. This case study is about a famous Danish business conglomerate, Maersk

Maersk is a business giant having operations in the areas of transport, logistics, and energy. Founded in 1904, it has continued to be one of the largest shipping and cargo service provider in the world. 

The challenge:

The challenge facing Maersk was to keep a track of its shipments and manage the supply chain. Traditionally, such companies maintain all the records of consignments and shipments through the paperwork. But, any minor change in the shipment process would cause trouble as updating the paperwork will take time, delaying the shipment. Also, keeping the paperwork up to date in real-time with the shipments and supply chain activities was a tedious and meticulous task. All the stakeholders need proper, timely information on the shipments which was proving to be both time consuming and costly. 

The solution:

Maersk came together with IBM and introduced a distributed platform where they can store records on a cloud-based database. It is like a private blockchain system where all the stakeholders involved can access real-time data in the supply chain ecosystem. This makes a global tamper-proof blockchain network that holds digitalized information on trade and shipments. Anyone involved in the process can keep a track of the products shipped, cargo location, any detours or rerouting, etc. Thus, with the help of blockchain technology, Maersk was able to have a point-to-point secure network for data exchange and a tamper-proof repository to keep all the data/documents involved in the shipment process. This made the system more intact and safer, significantly avoiding any delays and frauds in the process. Also, the trade volume increased by 12% after implementing the new system. 

Summary

This completes our introductory tutorial on blockchain technology. We hope we were able to give you a good basic understanding of this topic. Stay with us as we explore a lot of other domains where blockchain finds its application in the coming tutorials. 

Time to strengthen your basics of technology with Blockchain Basics Tutorial

Was the blockchain tutorial satisfactory? Share your views in the comment section. Your feedback is valuable. 

6 Responses

  1. Javeed says:

    Hi block chain depends on which language(supporting language) like.. Java, .Net, SQL,C…

    • Alisha Elizabath says:

      Blockchain depends on both C and Java

    • DataFlair Team says:

      Hi Javeed,
      We are glad our reader trying to interact with us.
      To develop for blockchain, you can opt for any of the following languages:
      c++
      Python
      Solidity
      Java
      Simplicity
      Ruby
      JavaScript
      Thanks for writing on Blockchain Tutorial.
      Regards,
      DataFlair

  2. Gaurav Jain says:

    Golang and NodeJs are the most favorite languages for Hyperledger Fabric development .

  3. Hab says:

    It’s so helpful

  4. Ni Raj says:

    Vous avez des cours pour les development blockchain ou des cours pour devenir professionnel blockchain ? Avec instructor, vidéo record

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.