Blockchain – Introduction Blockchain Technology is the name given to a modern database management technique, which enables a large business to share information and communicate with the help of links and chains between different nodes in the network. It is a new way of handling digital transactions that have started to gain traction in recent years. Data is kept in blocks that are connected in a chain within a blockchain database. Because the chain cannot be removed or altered without network approval, the data is consistent across time. What is Blockchain? A blockchain is an ever-growing ledger in a network, which keeps a track record of all transactions, changes and implementations that have taken place inside the network in a secure, ordered and immutable way. In simple terms, it is a chain of blocks like a linked list, with each node being before and after another node. All nodes or blocks have links to the next node, just like pointers in programming. Each block records all of the recent transactions, and once completed goes into the blockchain as a permanent database. This technique is based on Cryptographic Concepts of Information Security, which will be studied later on. Each time a block gets completed, a new block is generated. Once a block of information is created in the chain, it can’t be changed or deleted. This makes the blockchain very secure and trustworthy. A blockchain network is independent of centralized institutions, and it can work without any need for third-party middle-man such as central authorities, banks, government, etc. Transactions are verified by a network of computers. A blockchain network is based on the internet, and hence, it cannot run offline. Key Takeaways We can take the following important points from the above explanation, and memorize these before moving on to the next few sections − Blockchain represents a form of distributed database that contrasts with conventional databases in its method of information storage. It organizes data into blocks that are interconnected through cryptographic techniques, which will be studied later. A variety of information can be recorded on a blockchain, yet its primary application has been as a ledger for transactions. Blockchain operates in a decentralized manner, meaning that no individual or group possesses authority over it; control is shared among all users. Elements of Blockchain The key elements of any blockchain network include the following components given below − Distributed Ledger Every member of the network has the ability to reach the decentralized ledger and its unchangeable log of transactions. Through this common ledger, transactions are documented just one time, removing the need for redundant work that is common in conventional business networks. Immutable Records It is impossible for any participant to alter or manipulate a transaction once it has been documented on the shared ledger. In the event of an error in a transaction record, a new transaction must be created to correct the mistake, and both transactions will be transparently displayed. Smart Contracts To speed transactions, a set of rules that are called a smart contract is stored on the blockchain and run automatically. A smart contract defines conditions for corporate bond transfers, include terms for travel insurance to be paid and much more. How Blockchain Work? A blockchain consists of small sequenced programs, known as scripts, which conduct the tasks available in a database, like entering information, accessing data stored in the database, saving data and copying it elsewhere. By default, data once saved in a ledger cannot be altered. A blockchain is distributed, which means multiple copies are saved on many machines, and they must all match for it to be valid. Transactions in a network follow a sequence of steps, which may differ depending on the type of network where they are implemented. Generally, when a transaction is initiated, the application that provides an interface for the blockchain starts a sequence of events. Every node in the network proposes its own blocks in this way because they all choose different transactions. Each works on their own blocks, trying to find a solution to the difficulty target, using the query number used once, also called by its acronym nonce. Once a block is closed, a transaction is complete. Although this process is a generalized sequence of steps, not all networks follow these in order, or at all. Some cryptocurrencies like Ethereum, Dogecoin, and Bitcoin are discussed in the later sections of this article. Features of Blockchain Blockchain technology is a major booming force for decentralized cryptocurrencies across the globe. Due to its many features, it finds use in various sectors of modern life. The following points briefly explain the features and concepts of Blockchain technology − Decentralization A blockchain facilitates the distribution of data across multiple network nodes—computers or devices operating blockchain software, located in different geographical areas. This architecture not only ensures redundancy, but also preserves the integrity of the data. For instance, if an attempt is made to modify a record at one instance of the database, the other nodes will thwart this action by comparing block hashes. Consequently, no individual node within the network possesses the capability to alter information contained within the chain. Transparency Due to the decentralized structure of all blockchain networks, all transactions are openly accessible for viewing by downloading and examining them, or by utilizing blockchain explorers that enable real-time monitoring of transactions. Every node maintains its own version of the chain, which is continuously updated with the addition of new blocks. Consequently, it is possible to trace the movement of a bitcoin to its destination, if desired. Security Blockchain technology ensures decentralized security and trust through various methods. Initially, new blocks are consistently stored in a linear and chronological manner, always being appended to the last of the blockchain. Once a block is added to the end of the blockchain, it becomes immutable, preventing any changes to previous blocks. A modification in any data within a block alters its hash value. Since each block includes the hash of
Category: blockchain
Blockchain – Double Spending Consider a situation shown in image − As clearly seen here, Bob is tendering a $10 bill to Lisa in exchange of a book. Once the Lisa receives this physical $10 bill, there is no way for Bob to re-use this money for some other transaction, as the physical currency is now in Lisa’s possession. Now, consider a situation where the money is paid in Digital form. This is illustrated in image − As the format for money exchange is in the digital format, it is essentially a binary physical file stored somewhere on Bob’s device. After Bob gives this file (digital money) to Lisa, he can also a give a copy of the file to Alice. Both now think that they have received the money without having any means of authenticating the digital coin and would thus deliver their respective goods to Bob. This is called double-spending where the sender spends the same money at more than one place for obtaining services or goods from multiple vendors. To solve this problem of double-spending, one would employ a centralized authority to monitor all the transactions. This is illustrated in image − The centralized authority, which in common terms is your bank, maintains a ledger book recording all the transactions. Now, Bob has to send his digital money to the bank who would make an entry into its ledger debiting Bob’s account. After ensuring that Bob has sufficient balance to pay for the digital money which he wants to send, would send the money to Lisa crediting her account in its ledger. Now, it is guaranteed that Bob cannot double spend the money. If every digital transaction is routed through a centralized authority like this, the problem of double-spending would be solved. This also provides another benefit in validating the authenticity of each coin (digital money) that it receives in the transaction. So the fake money (duplicate money as in the case of Bob paying to Alice using a copy) would be easily detected and prevented from the circulation. The introduction of centralized authority though it solves the double-spending problem, introduces another major issue – the cost of creating and maintaining the centralized authority itself. As the banks need money for their operations, they start cutting commissions on each currency transaction they do for their clients. This sometimes can become very expensive, especially in overseas transfer of money where multiple agents (banks) may be involved in the entire deal. All the above issues are solved by the introduction of digital currency, called Bitcoin. I will now give you a brief background on what Bitcoin is before delving into its design and architecture.
Blockchain Tutorial Job Search A blockchain is a growing list of records, called blocks, which are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. Blockchain has been in a lot of buzz these days. And that is mainly because it is backbone of the very famous cryptocurrency in the world – the Bitcoin. Many Governments and leading Banks have decided to bring many of their conventional transactions based on Blockchain concept. The applications and potential of this framework is huge and is considered to be changing the way transactions are made in various domains. Audience This tutorial has been prepared for professionals aspiring to learn the basics of Blockchain. We tried to explain Blockchain concepts through Bitcoin Crypto Currency. This course is going to give you great understanding for the students and professionals aspiring to make a career in the Blockchain technology. This tutorial will teach you blockchain technology, the driving force behind the cryptocurrency, Bitcoin. You will learn various aspects of cryptography, process of creating and chaining Blocks, Network & Mining and many other concepts associated with blockchain technology including designing of a blockchain network.
Blockchain – Resolving Conflicts As we have seen the Bitcoin network contains several miners. It is possible, that the two different miners solve the Proof-of-Work at the same time and thus add their blocks to the last known block in the chain. This is illustrated in below image − Now, we have two branches after Block 3. Both the branches are valid. So the next mined block may be added in either of the branches. Suppose, the miner adds the newly mined block to Block 104-A, the branch containing Block 104-A will be longer than the branch containing Block 104-B. This is illustrated in below image − In Bitcoin architecture, the longest branch always wins and the shorter ones are purged. So the Block 104-B has to be purged. Before purging this block, all transactions in this block will be returned to the transaction pool so that they are mined and added to some future block. This is how the conflicts are resolved and only one single chain of blocks is maintained by the system.
Bitcoin – Mining When Bob creates a purchase request for Lisa, he does not send it to Lisa alone. Rather the request message is broadcasted on the entire network to which he is connected. Bob’s network is depicted in image. The message goes to all the connected nodes (machines). Some of the nodes in the diagram are marked as miners. These are the machines which run a piece of software for mining the bitcoin message. I will now explain you what this mining means. Mining Process As the entire network is widely distributed, every miner in the network is expected to receive multiple messages from multiple vendors at any given period of time. What the miner does is he combines these messages in a single block. This is illustrated in image − After a block of messages is formed, the miner creates a hash on the block using the hashing function described earlier. Now, as you know if any third party modifies the contents of this block, its hash would become invalid. Incidentally, each message is time-stamped so that nobody can modify its chronological order without affecting the block’s hash value. Thus, the messages in the block are perfectly secured from tampering. How this fact is used in securing all the transactions in the network is explained further.
Bitcoin – Brief History The Bitcoin was introduced in this world by Satoshi Nakamoto through a research-style white paper entitled in the year 2008. The Bitcoin not only solved the double-spending problem, but also offered many more advantages, One such advantage worth mentioning here is the anonymity in the transactions. Satoshi who created the system and did transact few coins on this system is totally anonymous to the entire world. Just imagine, in this world of social media, when the privacy of each individual is at stake, the world is not able to trace out so far who is Satoshi? In fact, we do not know whether Satoshi is an individual or a group of people. Googling it out also revealed the fact that the bitcoins Satoshi Nakamoto holds is worth about $19.4 billion – that money now remains unclaimed in the Bitcoin system. So what is Bitcoin – let us have a look! What is Bitcoin? As you saw earlier, the bank maintains a ledger recording each transaction. This ledger is privately held and maintained by the bank. Satoshi proposed that let this ledger be public and maintained by the community. The moment you make such a ledger public, several considerations would come to your mind. This ledger has to be tamper-proof so that nobody can modify its entries. As each entry in the ledger is publicly visible, we will have to figure out how to maintain the anonymity – obviously you would not like everybody in the world to know that I paid you one million dollars. Also, as there is only one single ledger keeping track of each and every transaction in the world, the size of ledger would be another great concern. Providing a solution to these intricacies was not trivial and that’s what I am attempting it here to make you understand underlying architecture of Bitcoin in simple words. This underlying architecture is the Blockchain and that’s what this tutorial is about. To understand the Blockchain architecture, you need to understand a few key features on which it is based on. So, let us get started with PKI – Public Key Cryptography.
Blockchain – Network & Mining I will now summarize the steps described above; this is what happens in the network − Anybody who wants to obtain services from the third party who has advertised on the network first creates a transaction (message to the desired recipient). Over a given period of time, there could be many senders (buyers) and receivers (sellers) creating such transactions. All transactions are broadcast on the network to all nodes. Note that it is not necessary that a given transaction must reach each and every other node in the network. Each node assembles the new transactions into a block. Note that the set of transactions in each block is independent of the set in blocks created by others and will naturally be different than others. This does not matter; the system ensures that every transaction broadcast on the network gets included in some block over a reasonable amount of time. Generally, the sender will incentivize the node by offering a certain amount of bitcoins to the miner for its efforts. The miner may opt for giving priority for inclusion in the block to those with higher incentives. The node now works on finding the proof-of-work for its assembled block. When the node finds a proof-of-work, it broadcasts the assembled block on the network. The nodes that receive the new block will accept it only after verifying that all transactions in the block are valid and not already spent. If the block is accepted as valid, the node which is working on its own new block will have to re-assemble the transactions in its block ensuring that the transactions are not duplicated. The node now works on finding the proof-of-work on its newly created block; while doing so it will take the hash of the accepted block as the previous hash. Likewise, the blockchain continues growing for ever. Now, as we have seen how the entire system works, let me describe some of the side effects and how to resolve them.
Blockchain – Chaining Blocks The blocks created by various miners are chained together to form what is known as a truly distributed public ledger. Each block in the chain contains multiple messages (transactions) as seen earlier in Figure 8. A block in the chain may come from any miner. While creating the chain of blocks, we observe the rule that hash of the previous block is added to the current block. Thus, a miner while creating the block, picks up the hash of the last block in the chain, combines it with its own set of messages and creates a hash for its newly created block. This newly created block now becomes the new end for the chain and thus the chain keeps on growing as more and more blocks are added to it by the miners.
Blockchain – Payment Verification Consider a case whereby as a vendor you may like to verify a certain payment made in the past. As the blockchain you are holding on your machine contains only the block headers as shown in the earlier figure, the transaction that you are searching for is missing in the copy of your blockchain. You can now search backwards in your copy of the blockchain until you find a block in which the desired transaction is timestamped in. Now, request the merkle tree of the selected block and you will have the transaction that you are looking for. This is illustrated in below Figure − Here, we assume that you are looking for Tx103. Though you may not be able to see the contents of Tx103, you know that this has been accepted by the block to which it belongs and all subsequent blocks in the chain. Thus, you can safely trust this transaction and proceed with your business.
Blockchain – Proof of Work As all transactions are time stamped, we need to implement a distributed timestamp server on a peer-to-peer network. This requires some additional implementation and that is the Proof-of-Work that I will describe now. To each block, we now add one more item called Nonce as shown in the figure below − Nonce is a number such that the block’s hash meets a certain criterion. This criterion could be that the generated hash must have its leading four digits to be zero. Thus, the generated hash would look like 000010101010xxx. Generally, the miner starts with a Nonce value of 0 and keeps on incrementing it until the generated hash meets the specified criterion. Note that the hash generation works at random and is beyond your control – that is you cannot force the hash function to generate a certain hash. Thus, it may take several iterations until the desired hash with four leading zeros is generated. The expected time for generating a block in bitcoin system is 10 minutes. Once the miner successfully mines the block, he releases that in the system making it now the last block in the chain. Note that there are multiple miners competing to generate the legitimate block. The Bitcoin system awards the first successful miner by giving him certain bitcoins. In general, the miner with more computing power may be an early winner. This can cause attacks on the entire system by those who possess a huge processing power. I will describe the attacks and how these are mitigated towards the end of this tutorial.