Blockchain and Ethereum Certification Tr... (38 Blogs) Become a Certified Professional
AWS Global Infrastructure

Blockchain Tutorial – A Beginner’s Guide to Blockchain Technology

Last updated on Sep 06,2024 132.1K Views

4 / 8 Blog from Blockchain Introduction

The growth of Bitcoin and Blockchain technology has been so rapid, that even those who haven’t heard of cryptocurrency or know about its working, are looking to invest and explore this field. This Blockchain tutorial blog will essentially provide you with all the fundamental knowledge you need regarding Bitcoin and Blockchain in the following sequence:

  1. Issues with the current Banking System
  2. How Blockchain solves these issues
  3. What is Blockchain and Bitcoin
  4. Features of Blockchain
  5. Use Case
  6. Demo: Implementing Digital Banking using Blockchain

You may go through this recording of Blockchain Tutorial where our Blockchain Training expert has explained the topics in a detailed manner with examples that will help you to understand this concept better.

Blockchain Tutorial | Blockchain Technology | Edureka

 

Blockchain technology and the crypto-currencies have today become a parallel platform where people have started performing their standard transactions. Now, if a new system is slowly replacing an existing system then there must be some issues with the current system. We will begin this Blockchain tutorial blog by understanding the problems of the current banking system.

Issues with Current Banking System:

Any existing system will have some issues. Let us look at some of the most commonly faced issues with the Banking system:

  • High Transaction Fees

Let’s look at an example to understand this issue better:

The issue of Transaction Fees - Blockchain Tutorial - EdurekaHere, Chandler is sending $100 to Joe but it must pass through a trusted third party like a Bank or Financial service company before Joe can receive it. A transaction fees of 2% is deducted from this amount and Joe only receives $98 at the end of the transaction. Now this may not seem a big amount but imagine if you were sending $100,000 instead of $100, then the transaction fees also increases to $2,000 which is a big amount. As per a report from SNL Financial and CNNMoney, JPMorgan Chase, Bank of America and Wells Fargo earned more than $6 billion from ATM and overdraft fees in 2015

  • Double Spending

Double-spending is an error in digital cash scheme in which the same single digital token is spent twice or more. To help you understand this problem better, let me give you an example:

Example of Double Spending - Blockhain Tutorial - EdurekaHere Peter has only $500 in his account. He initiates 2 transactions simultaneously to Adam for $400 and Mary for $500. Normally this transaction would not go through as he doesn’t have sufficient balance of $900 in his account. However, by duplicating or falsifying the digital token associated with every digital transaction, he can complete these transactions without the needed balance. This operation is known as Double Spending.

  • Net Frauds and Account Hacking

    Net Frauds - blockchain Tutorial - edureka

In India, the number of fraud cases related to credit/debit cards and Internet banking was 14,824 for the year 2016. The net amount involved in these frauds was Rs 77.79 crore, of which Rs 21 crore was from internet frauds and Rs 41.64 crore was from ATM/debit card-related frauds. 

  • Financial Crisis and Crashes

    Financial crisis - Blockchain Tutorial - edureka

Imagine giving all your saving to someone you trust only to know that they have gone and lost it somewhere else. That’s what happened in the 2007-08 when Banks and Investment Organisations had borrowed heavily and lent it as subprime mortgages to people who could not even pay back these loans. This in turn lead to one of the greatest financial crisis ever seen and was estimated to have caused losses close to $11 Trillion ($11,000,000,000,000) worldwide. This was just one of the most popular examples, how often have we heard of Banks and Financial service companies crash due to internal frauds? The whole third-party system is something that is built on blind trust on the middle man.

We have seen some of the most common problems faced by everyone. Wouldn’t it be great to have a system that overcame these problems and provided us with a That’s exactly what Blockchain Technology does.

Let us now try to understand how Blockchain and Bitcoins solve these issues as the next part of this Blockchain tutorial blog.

Find out our Blockchain Training in Top Cities/Countries

IndiaOther Cities/Countries
BangaloreNew York
HyderabadUK
KeralaUSA
ChennaiCanada
MumbaiAustralia
PuneSingapore

How does Blockchain solve these issues?

Below are some of the ways through which the Blockchain technology tackles the above mentioned issues:

  • Decentralized System

The Blockchain system follows a decentralized approach when compared to banks and financial organisations which are controlled and governed by Central or Federal Authorities. Here, everyone who is part of the system becomes equally responsible for  the growth and downfall of the system. Rather than one single entity holding the power, everyone who is involved with the system holds some power.

  • Public Ledgers

The ledger which holds the details of all transactions which happen on the Blockchain, is open and completely accessible to everyone who is associated with the system. Once you join the Blockchain network, then you can download the complete list of transaction since its initiation. Even though the complete ledger is publicly accessible, the details of the people involved in the transactions remains completely anonymous.

  • Verification of Every Individual Transaction

Every single transaction is verified by cross-checking the ledger and the validation signal of the transaction is sent after a few minutes. Through the usage of several complex encryption and hashing algorithm, the issue of double spending is eliminated.

  • Low or No Transaction Fees

The transaction fees are usually not applicable but certain variants of Blockchain do implement certain minimal transactions fees. These transaction fees are however relatively quite less when compared to the fees implied by banks and other financial organisations. If a transaction needs to be completed on priority then an additional transaction fees can be added by the user so as to have the transaction verified on priority.

Now that we have spoken about the issues with the current existing system and understood how the Blockchain technology overcomes these challenges,  I am quite sure you must have got some understanding of the Blockchain System. 

At this point you might still be wondering as to what exactly is the Blockchain and Bitcoin. So let’s try to understand these important concepts in the next part of this Blockchain tutorial.

Get Certified With Industry Level Projects & Fast Track Your Career

What is Blockchain and Bitcoin?

Before we go on to understand what is Blockchain, it important that you understand what is Bitcoin:

Bitcoin - Blockchain Tutorial - Edureka

Bitcoins are a crypto-currency and digital payment system invented by an unknown programmer, or a group of programmers, under the name Satoshi Nakamoto. That means they can be used like a usual currency, but don’t physically exist like dollar bills.  They are an online currency which can be used to buy things.  These are similar to “digital cash” that exist as bits on people’s computers. Bitcoins exist only in the cloud, like Paypal, Citrus or Paytm.  Even though they are virtual, rather than physical, they are used like cash when transferred between people through the web. 

The Bitcoin system is peer-to-peer network based and transactions take place between users directly, without an intermediary. These transactions are verified by network nodes and recorded in a public distributed ledger called a Blockchain. Since the system works without a central repository or single administrator, Bitcoin is called the first decentralized digital currency.

Bitcoin production makes them a unique currency. Unlike normal currencies, Bitcoins cannot be created as needed. Only 21 Million Bitcoins can be created, of with 17 million have already been created. Bitcoin get created whenever a block containing valid transactions is added to the Blockchain. This is the only means for creating Bitcoins and through various mathematical and encryption algorithms we ensure no fake Bitcoins are created or circulated. Let us now understand more Blockchain.

What is Blockchain?

Blockchain - Blockchain Tutorial -EdurekaBlockchain can be called the spine of the entire crypto-currency system. Blockchain technology not only helps with the users perform transactions using crypto-currencies but also ensures the security and anonymity of the users involved. It is a continuously growing list of records called blocks, which are linked and secured using cryptographic techniques. A Blockchain can serve as “an open and  distributed ledger, that can record transactions between two parties in a verifiable and permanent way.” This ledger that is shared among everyone in the network is public for all to view.This brings in transparency and trust into the system.

A block is the ‘current’ part of a Blockchain which records some or all of the recent transactions, and once completed goes into the Blockchain as permanent database. Each time a block gets completed, a new block is generated.

The Blockchain is typically managed by a peer-to-peer network, collectively adhering to a protocol for validating new blocks. Once recorded, the data in any given block cannot be altered retroactively without the alteration of all subsequent blocks and a collusion of the network majority. Transactions once stored in the Blockchain are permanent. They cannot be hacked or manipulated. We will learn more about this once we get into the concepts of Blockchain.

You may go through this short animated video of What is Blockchain to understand the topics with examples that will help you to understand this concept better.

What Is Blockchain | What Is Bitcoin | Blockchain Tutorial | Edureka

 

Now I hope you have a better understanding of both Bitcoin and Blockchain. Moving ahead in our Blockchain tutorial blog, let us look at the features of Blockchain technology to help us understand why it has become so popular.

Features of Blockchain

Below are the most important features of Blockchain technology that has made it a revolutionary technology: 

  • SHA256 Hash Function
  • Public Key Cryptography
  • Distributed Ledger & Peer to Peer Network
  • Proof of Work
  • Incentives for Validation

Lets try to understand each one of them one by one. 

SHA256 Hash Function

The core hash alogorithm used in blockchain technology is the SHA256. The purpose of using a hash is because the output is not ‘encryption’ i.e it cannot be decrypted back to the original text. It is a ‘one-way’ cryptographic function, and is a fixed size for any size of source text. To get a better understanding, let us look at an example below:

Hash algorithm - Blockchain Tutorial - Edureka

If you look at the first example, we are feeding the input as “Hello World” and getting an output as “a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e”. However, by just adding an “!” at the end, the output completely changes to “7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069”. If we change “H” to “h” and “W” to “w”, then the output value changes to “7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9”.

I hope with this example you have understood how complex the algorithm is as even the slightest change in the input can cause a massive change in the output. 

Public Key Cryptography

This cryptographic technique helps the user by creating a set of keys referred as Public key and Private key. Here the Public key is shared with others whereas the Private key is kept as a secret by the user. To understand the roles of these keys, Let us look at the example below to get a better understanding:

Digital Signature - Blockchain Tutorial - Edureka

If Chandler sends some bitcoins to Joey, that transaction will have three pieces of information:

  • Joey’s bitcoin address.(Joey’s Public key)
  • The amount of bitcoins that Chandler is sending to Joey.
  • Chandler’s bitcoin address.(Chandler’s Public key)

Now all this data along with an encrypted digital signature is sent through the network for verification. The Digital signature is again a hash value achieved by the combination of the Chandler’s bitcoin address and the amount he is sending to joey. This digital signature is encrypted by the private key. Once this data is received by a miner who has to verify this transaction, there are 2 process he does simultaneously:

  1. He takes all the un-encrypted data like transaction amount and public keys of both Joey and Chandler, and feeds it to a hash algorithm to get a hash value which we shall call Hash1
  2. He takes the digital signature and decrypts it using chandler’s public key to get a hash value which we will call as Hash2

If both Hash1 and Hash2 are the same then it means that this a valid transaction.

Distributed Ledger and P2P Network

Distributed Ledger - Blockchain Tutorial - Edureka

Every single person on the network has a copy of the ledger. There is no single centralized copy. Let me help in you understanding what a ledger is with the following example: Suppose you need to send 10 Bitcoins to your friend John where your Bitcoin balance is 974.65 and John here with a balance of 37. Your balance will be deducted by 10 BTC and credited into John’s account.

Blockchain has a unique way to implement this. There are no accounts and balances in the Bitcoin Blockchain ledger. Every transaction from the first one is stored on a continuous growing database called Blockchain. There are blocks averaging around 2050 transactions and as of today, there are 484,000 blocks in the Blockchain with around 250 million transactions.

This ledger is distributed across all users of Bitcoin Blockchain, i.e., the ledger has no central location where it is stored. Everyone on the network owns a copy of the ledger and the true copy is the collection of all the distributed ledgers.

Proof Of Work

Proof of work - Blockchain Tutorial - EdurekaYou might be wondering if everyone equally owns the ledger, who adds blocks to the Blockchain? How can people trust this person?

For this, we have the concept of proof of work. It is basically like solving a very big puzzle. It requires lots of computational effort. This work is done by people in the Bitcoin network we call miners. The work of these miners is to verify the transactions and solve a complex mathematical puzzle associated with the block being created. The difficulty of the problem is adjusted so that on average a block is solved in 10 minutes. Miners search for a specific nonce(mathematical value) which gives the desired hash which is predetermined. The current difficulty level is such that you need to try about 20.6 quadrillion nonce to get the correct hash.

Each block has a hash value which is the combination of the previous block’s final hash, transaction data’s hash value and the nonce. The final resulting hash for the block must start with a specified number of trailing zeroes. It is this computation to find the nonce which satisfies the condition that makes mining so computationally expensive.

So the person who finds this nonce is the successful miner and he/she can add their block to the blockchain. Through our P2P distributed network, he/she broadcasts their block and everyone verifies if hashes match, updates their blockchain and moves on to solving the next block immediately.

Incentives for Validation

The last step of a Bitcoin transaction is to giving a reward to the miner who has created the latest block. This rewards is provided by the Blockchain system for validating the transactions and maintaining the Blockchain. Currently the reward per block is 12.5 BTC (Rs 3,427,850/- or $ 53,390). This is the most interesting part of Bitcoin Mining.

Bitcoin incentives is the only way to generate new currency into the system and it is believed that by 2140, all 21 million bitcoins will be mined.

With this, I hope you now have more understanding and appreciation towards the Blockchain technology. Blockchain is much more than Bitcoin. Finance is just one of the many industries Blockchain aims to disrupt. Moving ahead with our Blockchain tutorial, let us now look at one such example of IBM and Maersk, to understand how the Supply Chain Industry is disrupted by blockchain.

Blockchain Tutorial: Use Case

Maersk is a Danish business conglomerate with activities in the transport and logistics, and energy sectors. Maersk has been the largest container ship and supply vessel operator in the world since 1996. The company is based in Copenhagen, Denmark with subsidiaries and offices across 130 countries and around 88,000 employees.

IBM is an American multinational technology company mainly working on business solutions, security solutions and storage solutions since 1921

Business need: 

Being a part of an extremely dynamic Supply Chain industry, tracking the slightest change is of highest priority for the client. They needed a solution that could enable them to complete the shipping process without having the delay in paper work. A solution that would be able to bring together all the stakeholders of the system and provide a real-time status on the shipment.

Challenges:

Today, 90% of the goods in global trade are carried by the shipping industry. This supply chain is flowed by the complexity and sheer volume of point-to-point communication. These communications are across a loosely coupled web of land transportation providers .freight forwarders, customs, brokers, government’s ports and ocean carriers processing. Documents and information for a container shipment is estimated to cost more than twice that of the actual physical transportation.

Solution: 

IBM and Maersk are addressing this problem with a distributed permission platform accessible by the supply chain ecosystem designed to exchange event data and handled document workflows.

IBM Maersk use Case - Blockchain Tutorial - Edureka

Merck and IBM are employing Blockchain technology to create a global tamper proof system by the digitizing trade workflow and tracking shipments end-to-end. This eliminates frictions including costly point-to-point communications. The collaboration will launch with potential ability to track millions of container journeys per year and integrate with customs authorities on selected trade lanes.

Results:

  • Provided a secure Data Exchange platform for all the stakeholders involved in the supply chain system.
  • Established a Tamper proof repository to store all the documents involved as part of the process.
  • Regular shipping events help reduce significant Delays and Frauds, saving Billions of dollars annually.
  • Reduced the barrier between trade organisations thereby increasing worldwide GDP by 3%.
  • Helped increase the overall trade volume by 12%.

This is how Blockchain technology helped Maersk and has been helping many other companies worldwide. Finally as part of this Blockchain tutorial, we will look at a demo as to how you set up a private autonomous Blockchain on your system.

Blockchain Tutorial: Demo

We will implement a digital bank using Ethereum Blockchain. Ethereum is an open-source, public, blockchain-based distributed computing platform. The systems will allow us to:

  1. Make a cryptocurrency with a fixed market supply and tokens to represent real world asset values.
  2. Create an autonomous private Blockchain with rules on spending money.
  3. Mine for a new Ether by validating transactions.

The demo can be divided into 4 steps:

  1. Cloning Geth Code
  2. Creating a Genesis Block
  3. Making Rules for our Blockchain
  4. Validating & Mining Ether

Step 1: Cloning Geth Code:

geth is the command line interface for running a full ethereum node implemented in Go.  By installing and running geth, you can take part in the ethereum frontier live network and

  • Mine real ether
  • Transfer funds between addresses
  • Create contracts and send transactions
  • Explore block history

Cloning the geth repository from github. To do this, open a new terminal and execute the following command:

$ git clone https://github.com/ethereum/go-ethereum 


git command - Blockchain Tutorial -Edureka

After you have successfully cloned the file from github, we need to branch the latest version of geth.

$ cd go-ethereum 
$ git tag

cd command - Blockchain Tutorial -Edureka

git tags- Blockchain Tutorial -Edureka

$ git checkout tags/v1.6.7 -b EdurekaEthereumV1.6.7
$ git branch

branch - Blockchain Tutorial -Edureka

 $ make all

Step 2: Creating Genesis Block

A genesis block is the first block of a block chain. Changing the genesis block is a way to definitively fork yourself away from the bitcoin blockchain, i.e, start a new network with it’s own separate history. To create the genesis file, execute the following commands:

$ cd go-ethereum
$ mkdir genesis
$ cd genesis
$ gedit genesis.json

making genesis file - Blockchain Tutorial -Edureka
Step 3 : Making Rules for our Blockchain

The rules for our Blockchain will be included in the genesis.json file we have created. Add the following code in your genesis.json file:


{
    { "config":{ 
        "chainId": 123, 
        "homesteadBlock": 0, 
        "eip155Block": 0, 
        "eip158Block": 0, 
        }, 
    "nonce": "0x3", 
    "timestamp": "0x0", 
    "parentHash": "0x0000000000000000000000000000000000000000000000000000", 
    "extraData": "0x0", 
    "gasLimit": "0x4c4b40", 
    "difficulty": :0x400", 
    "mixhash": "0x0000000000000000000000000000000000000000000000000000", 
    "coinbase": "0x000000000000000000000000000000000", 
    "alloc":{ 
        }
}

nonce:  A 64-bit hash, which proves, combined with the mix-hash, that a sufficient amount of computation has been carried out on this block.

timestamp: A scalar value equal to the reasonable output of Unix time() function at this block inception.

mixhash: A 256-bit hash which proves, combined with the nonce, that a sufficient amount of computation has been carried out on this block.

difficulty: A scalar value corresponding to the difficulty level applied during the nonce discovering of  block.

alloc: Allows defining a list of pre-filled wallets. It’s an Ethereum specific functionality to handle the “Ether pre-sale” period.

parentHash: The Keccak 256-bit hash of the entire parent block header (including its nonce and mixhash).

extraData: An optional free, but max. 32-byte long space to conserve smart things for ethernity.

gasLimit: A scalar value equal to the current chain-wide limit of Gas expenditure per block.

coinbase: The very first transaction included in the block by the miners.

Now we need to initialize the blockchain. You can do that by using the following command:

$ /home/edureka/go-ethereum/build/bin/geth --datadir ~/ethereum/net3 init genesis/genesis3.json

Blockchain Initialization command - Blockchain Tutorial -Edureka

Now that we have initialized the blockchain, it’s time that we give geth control access to it. Execute the following command to start the geth console:

$ /home/edureka/go-ethereum/build/bin/geth --datadir ~/ethereum/net3/ --networkid 3 console


Geth console - Blockchain Tutorial -Edureka

Step 4: Validating & Mining Ether.

In the Geth console, execute the following command:

personal.newAccount() : it creates a new account as part of your blockchain which has a specific wallet attached to it.

persona.newAccount() - Blockchain Tutorial - Edureka
eth.accounts: It helps you check the various accounts which are part of your blockchain.

eth.accounts - Blockchain Tutorial -Edureka
eth.blockNumber(): this helps you to identify the number of blocks that are part of your blockchain.

miner.start(): this function is used to start the mining process.

miner.start() - Blockchain Tutorial -Edureka

Below you can see the mining application running:

mining running - Blockchain Tutorial -Edureka
miner.stop(): it stops the mining process

miner.stop() - Blockchain Tutorial -Edureka
eth.blockNumber(): executing this command after the mining process tells you at which block number you are at after performing the mining operation
eth.getBalance: (“account number”): this command is used to check the ether balance in the specified account


eth.getBalance()- Blockchain Tutorial -Edureka

exit: Exit the geth console.

With this we have successfully mined ether and completed our Banking Demo. This brings us to the end of this blog. I hope you liked this Blockchain tutorial blog. This was the first blog of the Blockchain tutorial series. This Blockchain tutorial blog will be followed by my next blog, which will focus on Blockchain technologies and Bitcoin Transactions. Do read them as well to learn more about Blockchain.

If you wish to learn Blockchain and build a career in Blockchain Technologies, then check out our Blockchain Training in Hyderabad which comes with instructor-led live training and real-life project experience. This training will help you understand Blockchain in depth and help you achieve mastery over the subject.

Got a question for us? Please mention it in the comments section and we will get back to you.

Comments
24 Comments
  • The blockchain is the leading software platform which is used to record transactions of digital assets like Bitcoin. It’s the backbone of decentralized cryptocurrency and is used to create the public ledger of any digital assets.
    With the awareness of Blockchain Potential in different domains, many Organization and Government have started exploring the possibilities to use Blockchain. click the link to know key skills required for blockchain developers :
    https://www.techaroha.com/blockchain-developer-in-india/

  • i am getting the following error while initializing the bockchain

    /home/blockchain/go-ethereum/build/bin/geth –datadir ~/ethereum/net3/ init genesis/genesis3.json
    Fatal: Failed to read genesis file: open genesis/genesis3.json: no such file or directory

  • I have a confusion that where the data of block chain is parmanently store and which database is used to store data permanently….

    • Hey Kalyan, There are no prerequisites as such for this Blockchain Online Course. However, development experience on an object-oriented language, fundamentals of networking, and basic knowledge of command line & Linux would be advantageous. Further to brush up your skills, Edureka offers the following complimentary self-paced courses in your LMS:
      Linux Fundamentals
      NodeJs Fundamentals
      JavaScript Training

      Check out our Blockchain training program here: https://www.edureka.co/blockchain-training
      Hope this helps :)

  • i have cloned the file from repository but binary folder(bin) is missing from go-ethereum/build ? how can i get that file?

  • This version works

    {
    “nonce”: “0x0000000000000042”,
    “mixhash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
    “difficulty”: “0x400”,
    “alloc”: {},
    “coinbase”: “0x0000000000000000000000000000000000000000”,
    “timestamp”: “0x00”,
    “parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
    “extraData”: “0x”,
    “gasLimit”: “0xffffffff”,
    “config”: {
    “chainId”: 59,
    “homesteadBlock”: 0,
    “eip155Block”: 0,
    “eip158Block”: 0
    }
    }

  • corrected jason file as verified via https://jsonlint.com/

    {
    “config”: {
    “chainId”: 123,
    “homesteadBlock”: 0,
    “eip155Block”: 0,
    “eip158Block”: 0
    },
    “nonce”: “0x3”,
    “timestamp”: “0x0”,
    “parentHash”: “0x0000000000000000000000000000000000000000000000000000”,
    “extraData”: “0x0”,
    “gasLimit”: “0x4c4b40”,
    “difficulty”: “0x400”,
    “mixhash”: “0x0000000000000000000000000000000000000000000000000000”,
    “coinbase”: “0x000000000000000000000000000000000”,
    “alloc”: {}
    }

    Got the following error message:

    CharlesyBugiMac:go-ethereum charlesyehcat$
    /Users/charlesyehcat/go-ethereum/build/bin/geth –datadir ~/ethereum/net3 init genesis/genesis33.json
    Fatal: invalid genesis file: hex string has length 52, want 64 for common.Hash

  • hello, In Public Key Cryptography, public key is used for encryption and private key is used for decryption by the valid used. Why do we have inverse here?

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Blockchain Tutorial – A Beginner’s Guide to Blockchain Technology

edureka.co