Categories
Blockchain Tutorial

Basic Components of Bitcoin

In this section, we are going to learn about the four basic components of bitcoin. These four elements will help us to understand the bitcoin blockchain in a more clear way.

Here, we are going to put up every object that we have learned previously in a single SCENE. As we know that a block is made up of hash and complex cryptography environment, but this is only the one side of the coin. The bitcoin blockchain is more interesting than we thought.

We can see the basic components of bitcoin in the following image:

  1. Software
  2. Cryptography
  3. Hardware
  4. Miners(Gaming Theory)
Components of Bitcoin

First Component: Software

Bitcoin is basically a software at the core that defines what a bitcoin is, as well as how a bitcoin gets transferred. It identifies what the rules of a valid bitcoin, who can be inside bitcoin, who cannot be inside bitcoin, what is valid, what is not, etc. Everything is based on software, which is the bitcoin software. The bitcoin software is always operated in 24*7.

Second component: Cryptography

The software, at its core, uses cryptography and bitcoin as a cryptocurrency. Bitcoin uses cryptography to regulate the transfer of bitcoin between parties, as well as the creation of new units of bitcoin. Without cryptography, Bitcoin would simply not be possible. So, we’ve got that this software uses cryptography to control the transfer of bitcoin over the internet.

Cryptography is a mathematical approach which is solvable by computers and not by humans. So all the stuff that protects your data is served by the cryptography.

Third Component: Hardware

To run and solve cryptography, it needs HARDWARE. This hardware is composed of those thousands of miners around the world running their computers. So there are thousands of computers around the world that are basically running the Bitcoin software or the Bitcoin client. This hardware is specially designed for finding Nonce to validate block and hash. It requires a lot of CPU power to complete a simple task on the bitcoin blockchain.

If you try to mine bitcoin right now with your smartphone or home computer, then you will End up losing your computer along with a hefty electric bill.

Fourth Component: Mining(Gaming Theory)

Miners are users who involved in a gaming theory because bitcoin is truly a game which is run by these miners around the world. In the above, we have seen that the first component is software for bitcoin that issues a cryptography challenge in every 10 minutes. The cryptography challenge involves in trying to find a Nonce which will make the hash for a specific block valid. All the hashes and validations are done by these miners. After successful creation of the block, the new block is added to the blockchain.

Let’s see how gaming theory works!

  • Bitcoin software creates a challenge. Now, there is a game begins, and there is a race that goes off. The race involves all these miners competing against each other to solve the challenges.
  • This task or challenge will take approximately 10 minutes to be completed.
  • Every single miner starts trying to find the solution to that one Nonce that will satisfy the hash for the block.
  • At some specific point, one of those miners in the global community with higher speed and great hardware specs will solve the cryptography challenge and be the winner of that race.
  • Now, the rest of the community will start verifying that block which is mined by the winner. This makes Bitcoin so strong, because in one stage of this cycle, the miners are competing against each other, and in the next stage of the cycle, the rest of the community rallies together to ensure that that solution is correct.
  • If the Nonce is correct, it will end up with the new block which will be added to the blockchain.
  • For this task or challenge, the winner will earn a reward. That reward is currently 12.5 bitcoins.
Categories
Blockchain Tutorial

Blockchain Distributed ledger

A distributed ledger is a type of database that is consensually sharedreplicated, and synchronized among the members of a decentralized network. All the information on this ledger is securely and accurately stored using cryptography. This information can be accessed by using keys and cryptographic signatures. The distributed ledger allows transactions to have public witnesses, which makes cyberattack more difficult. It records the transactions such as the exchange of assets or data, among the participants in the network.

All the participants in the network govern and agreed-upon consensus on the updates to the records in the ledger. There is no central authority, or third-party mediators such as a financial institution or government agencies are involved. Every record in the distributed ledger has a timestamp and unique cryptographic signature. It makes the ledger an auditable, and immutable history of all transactions in the network.

Further, if any alterations made to the ledger, they are reflected and copied to all participants in seconds or minutes. In other words, when any modifications or updates happen in the ledger, each node constructs the new transaction, and then the nodes vote by consensus algorithm on which copy is correct. Once a consensus algorithm has been determined, all the other nodes update themselves with the new and correct copy of the ledger.

The primary advantage of the distributed ledger is the lack of central authority. As we know that centralized ledgers are prone to cyber-attack, distributed ledgers are inherently very hard to attack. It is because all the distributed copies need to be attacked simultaneously for an attack to be successful.https://imasdk.googleapis.com/js/core/bridge3.505.0_en.html#goog_1462905411

Categories
Blockchain Tutorial

How Block Hashes Work in Blockchain

A blockchain is a concept of storing data digitally. This data comes in blocks. These blocks are chained together and make the data immutable. When a block of data is chained with the other blocks, its data can never be changed again. It will be publicly available to anyone who wants to see it ever again and will be available in the same sequence in which it was added to the blockchain. Nobody can change the information once it is added in the blockchain.

In the previous section, we have learned how to build the block and the cryptographic hashing ties into the whole process. Here you can see how blockchain uses all these concepts together to preserve the integrity of a full blockchain.

Imagine a bunch of blocks of transaction data as of the following image.

How Block Hashes Work in Blockchain
How Block Hashes Work in Blockchain

In the above images, you can see that block assembles in chronological order. Block number one is followed by block number two, then block number three, then block number four, and you can continue it as long as you want. Here, you will find that there is a block number fielddata fieldnonce fieldhash value field, and previous field. The previous field is corresponding to the hash value field of the previous block.

We know that every block in a blockchain is cryptographically tied to the next block. In the above example, the previous field in block one is zero because the block one doesn’t have a previous hash value, so its value is zero. In block number two, you will find that there is a hash value in the previous field, which references to the previous block hash value. This process is continuing until the last block.

Now imagine if the data in any block is altered. Let us say that we have altered in block number 2, the data in block 2 is now different, and mining the block also gets a new signature. The signature that corresponds with this new set of data is no longer chained to other blocks. It just breaks block number 2 because the hash is no longer valid and it also invalidates every single block that comes after it to the end of the chain. It indicates to other users of this blockchain that some data in block 2 has been altered, and because the blockchain should be immutable, they reject this change by shifting back to a previous record of the blockchain where all the blocks are still chained together. This is the main advantage of the blockchain.

Now, if you try to fix it, the only way you can do it by figuring out a nonce which is explained in the previous lesson. So we take simply one block and try that. If it doesn’t give a valid hash, try with two, three, four, and if none of them will work, then simply mine it. When you mine a block, the system figures out that there is a valid hash as it has got four leading zeroes. But as you notice that when you try to hash block number two, this hash doesn’t have four leading zeros. Therefore it’s still an invalid block. So you would have to mine this block as well. Also, you have to do that with every single block all the way to the front of the chain to fix the problem.

Understanding the importance of four leading zeroes in the hash

Now let’s talk about how important it is to have four leading zeroes. These four leading zeros are tied to something called difficulty level. The difficulty level is something that’s tied and built into the blockchain network which determines how difficult it is for you to get the equivalent cryptographic hash for a block. In this case, that difficulty level requires us to have a hash that is smaller than what we have in the target.

For this specific purpose, we will need a target that has at least four leading zeroes. For example, if the hash target is 0000a1b2c3d4e5f6, any hash less than or equal to this number is a valid block hash. Many hashes would satisfy this requirement, and anyone of those would be valid. However, it is a tough task to find such a hash. Lesser the hash target, the more difficult it is to find a valid hash.

These difficulty levels keep increasing over time as new computers are added in more cryptographic hashing to the bitcoin network. So, more hashing power means the difficulty level needs to go up. This difficulty level is adjusted in every two weeks to make sure that the computer which is actually competing to solve these cryptographic problems take approximately a total of 10 minutes to mine a new block.

Note: One block every 10 mins = 6 blocks per hour, 6 x 24 in a day, and 6 x 24 x 14 = 2016 blocks in two weeks.

For example: If we were to find a hash less than or equal to 0FFFF, we have 65,536 choices. However, if we were to find a hash less than or equal to 000FF, we have only 256 choices. A lower target number means fewer choices. Usually, more leading zeros we require in our hash, much harder it is to find a valid hash.

Categories
Blockchain Tutorial

Blockchain Block Hashing

In this section, we are going to learn how SHA-256 applies to build a block within a blockchain. We will discuss here in the context of the Bitcoin blockchain and understand how this ties into the role of miners. The minors are actually in the process of building blocks, and these blocks are added to a blockchain to build out what the Bitcoin blockchain will be.

In the below image, you can see that this block is composed of a block number, data field, cryptographic hash associated with it and a Nonce.

Blockchain Block Hashing

In the above image, the generated hash would look like 00001acbm010gfh1010xxx. I’d like to point out that this hash has four leading zeros. The four leading zero’s describes whether the block is valid or not. For practical purposes, you will see that this hash is corresponding to the nonce, and the block number is corresponding to the available data. Since the hash has four leading zeroes, therefore, it is a valid block.

If we make any change in the data section, it will give the completely different hash that can be shown in the below image.

Blockchain Block Hashing

If the newly generating hash does not have four leading zeroes, then it will not a valid block. To make the block valid, we will do it by using the field called nonce.

Nonce stands for a Number Used Once in a cryptographic communication such that the block’s hash meets a certain criterion. This criterion could be generated a hash that must have its leading four digits to be zero. Thus, the generated hash would look like 00001acbm010gfh1010xxx.

A nonce is basically a random number which figures out how you can actually make this specific block provide you with a valid hash. The way you can do this is by changing the nonce manually. Generally, the miner starts with a Nonce value of 1 and keeps on incrementing it until the generated hash meets the specified criterion. Thus, it may take several iterations until the desired hash with four leading zeros is generated. The expected time for generating a block in the bitcoin system is 10 minutes. Once the miner successfully mines the block, he releases that block in the system and making it the last block in the chain.

In Anders Brownworth Hash Program, when we click mine button as shown in the image, it will give the valid block. This block has a unique nonce with hash leading four zeroes in the beginning.

Blockchain Block Hashing
Categories
Blockchain Tutorial

Blockchain Hash Function

A hash function takes an input string (numbers, alphabets, media files) of any length and transforms it into a fixed length. The fixed bit length can vary (like 32-bit or 64-bit or 128-bit or 256-bit) depending on the hash function which is being used. The fixed-length output is called a hash. This hash is also the cryptographic byproduct of a hash algorithm. We can understand it from the following diagram.

Blockchain Hash Function

The hash algorithm has certain unique properties:

  1. It produces a unique output (or hash).
  2. It is a one-way function.

In the context of cryptocurrencies like Bitcoin, the blockchain uses this cryptographic hash function’s properties in its consensus mechanism. A cryptographic hash is a digest or digital fingerprints of a certain amount of data. In cryptographic hash functions, the transactions are taken as an input and run through a hashing algorithm which gives an output of a fixed size.

SHA-256

A Bitcoin’s blockchain uses SHA-256 (Secure Hash Algorithm) hashing algorithm. In 2001, SHA-256 Hashing algorithm was developed by the National Security Agency (NSA) in the USA.

How does the hashing process works?

For this hash function, we are going to use a program developed by Anders Brownworth. This program can be found in the below link.

Anders Brownworth Hash Program: https://anders.com/blockchain/hash.html

Blockchain Hash Function

If we type any character in the data section, we will observe its corresponding cryptographic hash in the hash section.

For example: We have type in data section: This is a great tutorial.

It will generate the corresponding Hash:

  1. 759831720aa978c890b11f62ae49d2417f600f26aaa51b3291a8d21a4216582a  
Blockchain Hash Function

Now if we change the text: “This is a great tutorial.” To “this is a great tutorial.”

You will find the corresponding Hash:

  1. 4bc35380792eb7884df411ade1fa5fc3e82ab2da76f76dc83e1baecf48d60018  

In the above, you can see that we have changed only the first character case sentence from capital “T” to small “t” and it will change the whole Hash value.

Note: If we write the same text again in a data section, it will always give the same output. It is because you are creating a message digest of that one’s specific amount of data.

Since the Hash function is a one-way function, there is no way to get back entire text from the generated hash. This is different from traditional cryptographic functions like encryption where you can encrypt something using the key and by using decryption, you can decrypt the message to its original form.

Categories
Blockchain Tutorial

Role of Bitcoin Miners

To understand the role of bitcoin miners, let us first understand Bitcoin Mining.

Bitcoin Mining

Bitcoin mining is the process of adding transaction records to Bitcoin’s public ledger of past transactions. This ledger of past transactions is called the blockchain as it is a chain of blocks. Bitcoin mining is used to secure and verify transactions to the rest of the network.

Role of Bitcoin Miners

Within the bitcoin networks, there are a group of people known as Miners. In miners, there was a process and confirm transactions. Anybody can apply for a minor, and you could run the client yourself. However, these minors use very powerful computers that are specifically designed to mine bitcoin transaction. They do this by actually solving math problems and resolving cryptographic issues because every transaction needs to be cryptographically encoded and secured. These mathematical problems ensure that nobody is tampering with that data.

Additionally, for this task, the minors are paid in bitcoins, which is the key component in bitcoin. In Bitcoin, you cannot create money as like you create regular fiat currencies such as Dollar, Euro, and Yuan. The bitcoin is created by rewarding these minors for their work in solving the mathematical and cryptographical problems.

https://imasdk.googleapis.com/js/core/bridge3.505.0_en.html#goog_290358304

How is the Bitcoin Blockchain built?

The role of a minor is to build the blockchain of records that forms the bitcoin ledger. These ledgers are called blocks, and each block contains all the different transactions that have taken place. A new block is added in every 10 minutes as a new Bitcoin Transaction takes place. So, as the minors process these different transactions, they build the block, and when a block is confirmed, it gets added to the blockchain. The bitcoin blockchain provides a permanent record of all bitcoin transactions to the beginning.

Role of Bitcoin Miners
Categories
Blockchain Tutorial

Blockchain Version

The brief description of the evolution of blockchain technology and its versioning from 1.0 to 3.0 are explained below.

Blockchain Version

Blockchain 1.0: Currency

The idea of creating money through solving computational puzzles was first introduced in 2005 by Hal Finney, who created the first concept for cryptocurrencies (The implementation of distributed ledger technology). This ledger allows financial transactions based on blockchain technology or DLT to be executed with Bitcoin. Bitcoin is the most prominent example in this segment. It is being used as cash for the Internet and seen as the enabler of an Internet of Money.

Blockchain 2.0: Smart Contracts

The main issues that came with Bitcoin are wasteful mining and lack of network scalability. To overcome these issues, this version extends the concept of Bitcoin beyond currency. The new key concepts are Smart Contracts. It is small computer programs that “live” in the blockchain. They are free computer programs which executed automatically and checked conditions which are defined earlier like facilitation, verification or enforcement. The big advantage of this technology that blockchain offers, making it impossible to tamper or hack Smart Contracts. A most prominent example is the Ethereum Blockchain, which provides a platform where the developer community can build distributed applications for the Blockchain network.

Quickly, the blockchain 2.0 version is successfully processing a high number of daily transactions on a public network, where millions were raised through ICO (Initial Coin Offerings), and the market cap increased rapidly.

Blockchain 3.0: DApps

DApps is also known as a decentralized application. It uses decentralized storage and communication. Its backend code is running on a decentralized peer-to-peer network. A DApp can have frontend code hosted on decentralized storages such as Ethereum Swarm and user interfaces written in any language that can make a call to its backend like a traditional Apps.

Categories
Blockchain Tutorial

What is Bitcoin?

Satoshi Nakamoto introduced the bitcoin in the year 2008. Bitcoin is a cryptocurrency(virtual currency), or a digital currency that uses rules of cryptography for regulation and generation of units of currency. A Bitcoin fell under the scope of cryptocurrency and became the first and most valuable among them. It is commonly called decentralized digital currency.

A bitcoin is a type of digital assets which can be bought, sold, and transfer between the two parties securely over the internet. Bitcoin can be used to store values much like fine gold, silver, and some other type of investments. We can also use bitcoin to buy products and services as well as make payments and exchange values electronically.

A bitcoin is different from other traditional currencies such as DollarPound, and Euro, which can also be used to buy things and exchange values electronically. There are no physical coins for bitcoins or paper bills. When you send bitcoin to someone or used bitcoin to buy anything, you don?t need to use a bank, a credit card, or any other third-party. Instead, you can simply send bitcoin directly to another party over the internet with securely and almost instantly.

How Bitcoin Works?

When you send an email to another person, you just type an email address and can communicate directly to that person. It is the same thing when you send an instant message. This type of communication between two parties is commonly known as Peer-to-Peer communication.

Whenever you want to transfer money to someone over the internet, you need to use a service of third-party such as banks, a credit card, a PayPal, or some other type of money transfer services. The reason for using third-party is to ensure that you are transferring that money. In other words, you need to be able to verify that both parties have done what they need to do in real exchange.

For example, Suppose you click on a photo that you want to send it to another person, so you can simply attach that photo to an email, type the receiver email address and send it. The other person will receive the photo, and you think it would end, but it is not. Now, we have two copies of photo, one is a simple email, and another is an original file which is still on my computer. Here, we send the copy of the file of the photo, not the original file. This issue is commonly known as the double-spend problem.

Bitcoin

The double-spend problem provides a challenge to determine whether a transaction is real or not. How you can send a bitcoin to someone over the internet without needing a bank or some other institution to certify the transfer took place. The answer arises in a global network of thousands of computers called a Bitcoin Network and a special type of decentralized laser technology called blockchain.

In Bitcoin, all the information related to the transaction is captured securely by using maths, protected cryptographically, and the data is stored and verified across the entire network of computers. In other words, instead of having a centralized database of the third-party such as banks to certify the transaction took place. Bitcoin uses blockchain technology across a decentralized network of computers to securely verify, confirm and record each transaction. Since data is stored in a decentralized manner across a wide network, there is no single point of failure. This makes blockchain more secure and less prone to fraud, tampering or general system failure than keeping them in a single centralized location.

Categories
Blockchain Tutorial

History of Blockchain

The blockchain technology was described in 1991 by the research scientist Stuart Haber and W. Scott Stornetta. They wanted to introduce a computationally practical solution for time-stamping digital documents so that they could not be backdated or tampered. They develop a system using the concept of cryptographically secured chain of blocks to store the time-stamped documents.

In 1992, Merkle Trees were incorporated into the design, which makes blockchain more efficient by allowing several documents to be collected into one block. Merkle Trees are used to create a ‘secured chain of blocks.’ It stored a series of data records, and each data records connected to the one before it. The newest record in this chain contains the history of the entire chain. However, this technology went unused, and the patent lapsed in 2004.

History of Blockchain
History of Blockchain

In 2004, computer scientist and cryptographic activist Hal Finney introduced a system called Reusable Proof Of Work(RPoW) as a prototype for digital cash. It was a significant early step in the history of cryptocurrencies. The RPoW system worked by receiving a non-exchangeable or a non-fungible Hashcash based proof of work token in return, created an RSA-signed token that further could be transferred from person to person.

RPoW solved the double-spending problem by keeping the ownership of tokens registered on a trusted server. This server was designed to allow users throughout the world to verify its correctness and integrity in real-time.

History of Blockchain

Further, in 2008Satoshi Nakamoto conceptualized the theory of distributed blockchains. He improves the design in a unique way to add blocks to the initial chain without requiring them to be signed by trusted parties. The modified trees would contain a secure history of data exchanges. It utilizes a peer-to-peer network for timestamping and verifying each exchange. It could be managed autonomously without requiring a central authority. These improvements were so beneficial that makes blockchains as the backbone of cryptocurrencies. Today, the design serves as the public ledger for all transactions in the cryptocurrency space.

The evolution of blockchains has been steady and promising. The words block and chain were used separately in Satoshi Nakamoto’s original paper but were eventually popularized as a single word, the Blockchain, by 2016. In recent time, the file size of cryptocurrency blockchain containing records of all transactions occurred on the network has grown from 20 GB to 100 GB.

Categories
Blockchain Tutorial

Blockchain Tutorial

Blockchain Tutorial provides basic and advanced concepts of blockchain. Blockchain is a constantly growing ledger that keeps a permanent record of all the transactions that have taken place in a securechronological, and immutable way. It can be used for the secure transfer of money, property, contracts, etc. without requiring a third-party intermediary such as bank or government. Blockchain is a software protocol, but it could not be run without the Internet (like SMTP is for email).

What is Blockchain?

A blockchain is a constantly growing ledger which keeps a permanent record of all the transactions that have taken place in a secure, chronological, and immutable way.

Let’s breakdown the definition,

  • Ledger: It is a file that is constantly growing.
  • Permanent: It means once the transaction goes inside a blockchain, you can put up it permanently in the ledger.
  • Secure: Blockchain placed information in a secure way. It uses very advanced cryptography to make sure that the information is locked inside the blockchain.
  • Chronological: Chronological means every transaction happens after the previous one.
  • Immutable: It means as you build all the transaction onto the blockchain, this ledger can never be changed.

A blockchain is a chain of blocks which contain information. Each block records all of the recent transactions, and once completed goes into the blockchain as a permanent database. Each time a block gets completed, a new block is generated.

Blockchain Introduction

Note: A blockchain can be used for the secure transfer of money, property, contracts, etc. without requiring a third-party intermediary like bank or government. Blockchain is a software protocol, but it could not be run without the Internet (like SMTP used in email).

Who uses the blockchain?

Blockchain technology can be integrated into multiple areas. The primary use of blockchains is as a distributed ledger for cryptocurrencies. It shows great promise across a wide range of business applications like Banking, Finance, Government, Healthcare, Insurance, Media and Entertainment, Retail, etc.

Need of Blockchain

Blockchain Introduction

Blockchain technology has become popular because of the following.

  • Time reduction: In the financial industry, blockchain can allow the quicker settlement of trades. It does not take a lengthy process for verification, settlement, and clearance. It is because of a single version of agreed-upon data available between all stakeholders.
  • Unchangeable transactions: Blockchain register transactions in a chronological order which certifies the unalterability of all operations, means when a new block is added to the chain of ledgers, it cannot be removed or modified.
  • Reliability: Blockchain certifies and verifies the identities of each interested parties. This removes double records, reducing rates and accelerates transactions.
  • Security: Blockchain uses very advanced cryptography to make sure that the information is locked inside the blockchain. It uses Distributed Ledger Technology where each party holds a copy of the original chain, so the system remains operative, even the large number of other nodes fall.
  • Collaboration: It allows each party to transact directly with each other without requiring a third-party intermediary.
  • Decentralized: It is decentralized because there is no central authority supervising anything. There are standards rules on how every node exchanges the blockchain information. This method ensures that all transactions are validated, and all valid transactions are added one by one.

Blockchain Tutorial Index



Our Blockchain tutorial includes all the topics which help to learn Blockchain Technology. These are Introduction of Blockchain, History of Blockchain, What is Bitcoin, The Role of Bitcoin Miners, Hash Functions, Block Hashing, How Block Hashes Work in a Blockchain, How Distributed Blockchain Works, Cryptographic Hashing, Components of Bitcoin, Coinbase Transaction, Key Concepts in Bitcoin, Blockchain DAO, Blockchain Limitations, Blockchain Double Spending, What is Bitcoin Cash, Bitcoin Proof of Work, Merkle Tree, Who sets the bitcoin price, and many more.

Prerequisite

Before learning blockchain in depth, you must have the basic knowledge of scripting languages such as HTML, JavaScript, and CSS.

Audience

We have developed this blockchain tutorial for beginners and professionals both who want to build a career around blockchain or learn the precepts of blockchain in a seamless manner. There are given a lot of topics which will help you to learn blockchain technology easily.

Problems

We assure you that you will not find any problem with our Blockchain tutorial. But, if you find any mistake, you can post it in our comment section.