Category: Blockchain

  • Smart Contracts

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    Since the blockchain was introduced, the common question was “How Blockchain will become a revolution?”. With the introduction of Ethereum in form of Solidity platform, the concept of Smart Contracts was developed. As it sounds they are the contracts handled in a smart way. It was introduced to automate the hectic contract signing process between two parties. In this article we will explore more about it.

    What are Smart Contracts

    A smart contract is a self-executing contract, which is automatically triggered once a condition is successfully met. This contract can be partially or fully executed with or without human interaction.

    Smart Contracts

    Advantages

    Following are the some of the advantages:

    • They are accurate, transparent and efficient as compared to paper contracts
    • They are are more secure
    • Better Storage and Backup
    • With blockchain it brings trust between two parties

     

    Use Case

    This concept can be easily understood by the example of Non-Disclosure Agreement signed by an employee whenever he/she joins an organization. The first step will be to automatically send each new joiner an agreement that can be digitally signed, once signed a digital password will be generated automatically and the credentials for official access can be sent to the new employee. These three steps don’t need any human interaction, and these can be easily achieved using smart contracts.

    This was a very simple explanation to replace human based operation with smart contracts. Once these are implemented in government offices for legal documentation, may help to curb corruption. They can even serve wider range of business problems and some of these use cases you can find in the given white paper: “Smart Contracts: 12 Use Cases for Business & Beyond”.

     

  • Types of Blockchains

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    A Blockchain was solely created for public in form of public network but an organization data cannot be exposed to public. Thus, with evolution of blockchain, more Types of Blockchains were introduced. In this article we will explore all the types of Blockchains in detail.

    Types of Blockchains

    Blockchains classifications are primarily based upon restrictions on block (or simply data) accessibility. Following are the three types of Blockchain networks:

    Public Blockchains

    A public blockchain is the one which has absolutely no access restrictions and anyone on internet can become a user or validator. These blockchains are mainly used by crypto currencies. These blockchains use a consensus mechanism to keep their transactions valid. Most famous examples include Bitcoin and Ethereum.

    Private Blockchains

    A Private Blockchain is just like a relational database i.e. fully centralized and owned by a single organization. All the participants are vetted before entering into this blockchain network. These types of blockchains are mainly used by banking organization, where data cannot be shared with and validated by anyone. Multichain is a tool to create private blockchains.

    Consortium Blockchains

    The literal meaning of consortium is “an association of several companies”. As the name suggests, it is a blockchain that is jointly controlled by a group of organizations. It is best suited for business and ERP solutions. Hyperledger and R3Cev are leading blockchain networks in this area.

    Types of Blockchains

     

  • Disadvantages of Blockchain

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    With all the advantages of Blockchain, there are various Disadvantages of Blockchain too that needs to be understood and diminished. We already know that a block gets appended to a blockchain needs to verified by a miner. Now, a miner needs to solve the difficulty of a block. A nonce also adds difficulty to a block verification. Due to these reasons a lot of time is spent in adding a block to a blockchain.

    Disadvantages of Blockchain

    Following are some of the noted and important disadvantages or demerits that blockchain brings with itself:

    Latency (Network Speeds)

    As we have discussed above, it takes almost 10 mins. to validate and add a block into the chain. For other leading blockchains this latency is almost 1 min. which is way more than what a relational database would take to append data i.e. within a few second. This high latency can affect the proper data flow in case of high volume and thus it will not be suitable for ERP solutions.

    Disadvantages of Blockchain

    Regularity & Legal acceptance: GDPR

    A blockchain appends all data and keep them always in the chain. No matter how long the chain gets, you can access the source of the data. This questions the compatibility of blockchain with GDPR.

  • Advantages of Blockchain

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    We have heard a lot about Blockchain and all the advantages of blockchain. If we jot down some points we will find that the biggest issue that blockchain solves is regarding trust and issues. Well, even real life relationship stands on these pillars. So, in this article we will explore all the pillars that makes a transaction easy, transparent, secure and immutable.

    Advantages of Blockchain

    Following are the major advantages of blockchain:

    Transparency

    Once a block is verified, it is added into the blockchain and later available to all the users to view the record (depending upon type of blockchain and authorizations). Suppose, for production of a car, its parts are processed by multiple teams. If each team update their results on the chain, then it can be viewed by other teams too and the current progress can be tracked (and cannot be altered).

    Immutability & Data Integrity

    Data/Records in the blocks of blockchain are secured by strong cryptographic algorithms. No unauthorized person can access it (without key access). No unauthorized data can be appended to the chain (without being verified by miners/validator). No data can be modified/altered by unauthorized person/malicious party (Merkle tree keeps a track of this). In this way data integrity and immutability is achieved.

    Security

    With all data encryption, chain to chain validation dependency and complex level of validations make blockchain very secure. The example is bitcoin which is in operation from almost a decade and has never been hacked. Strong cryptographic algorithms prevent the Blockchain architecture from critical exploitable attack vectors.

     

  • Blockchain Long Term Vision

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    Before you read Blockchain Long Term Vision, I would request you to go through the Blockchain Basics tutorial which is mainly created to give a glimpse of Blockchain Theories. We live in a world which is highly connected to each other in terms of social life or transactions. Every day, user’s data is increasing both on social media as well as online shopping platforms. Apart from this Enterprise Resource planning tools has also seen an exponential growth of data. With increase of data, the complexity increases. To keep these data secure and authentic several enterprises have moved to blockchain. But there are multiple blockchain players in the market. And the sole purpose of the blockchain to decentralize data can fail if two enterprises with their own blockchain will join hands.

    Blockchain Long Term Vision

    To keep these things in mind we can forecast Blockchain Long Term Vision as:

    Simple to Use

    If something our mother can use, then we can say it is simple to use. But that is not the case of blockchain. Even highly educated person feels the other way. Simplification of blockchain platform will ensure more consumer interaction.

    Interconnected Blockchain Platforms (Blockchain Interoperability)

    When we transact money from an ATM, we don’t bother about the bank to which the ATM belongs. That kind of interconnection of blockchain platforms will connect multiple enterprises and sectors together.

    Blockchain API (Easier Integration)

    The way payment gateways are integrated with any apps of android or IOS, the same way API integration of blockchain will make blockchain transaction quick, easy and efficient.

  • Blockchain Use Cases

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    Business players have already started to work on different scenarios where blockchain can be utilized. Here we will discuss some of the Blockchain Use Cases. To make this part of Use Cases more effective and simple, we will initially discuss the problem statement, current scenario and then the effective blockchain based solution.

    Use Case 1: Electricity Meter

    Problem Statement

    Effective management of energy sector such that grids are balanced, and consumers are paying for what they get and at the same time power supplier/operator are transmitting the amount they have been paid for.

    Current Scenario

    The power distribution in India is a very typical process. The power generators transmit power to grids and these grids supply the powers at home. These grids have local operators who collect data regarding power use, which is later used by operators to generate electricity bills. Once paid, they pay to the power generator. As we can already see the data regarding power consumption is being maintained at different location and individually at homes. If the local operator partners with users, then they can manipulate the consumption data. Also, there is no track of how much power is currently being used and where it is being used. Does anyone using, who is not authorized to use? Should the power to grid be increased or decreased to keep it stable?

    Blockchain Solution

    To keep the power supply stable, to avoid unauthenticated use of power supply and to curb the corruption from consumption data, a blockchain can be implemented in such a way that it keeps track of power from power generator to supplier, from local operator to end user. In this way supplier will get to know if the energy supply is under theft or not. Power generator will get to know the amount of electricity required to keep the grid stable. The users will be paying exactly the amount they have used. The role of local operator can be eliminated, hence making the energy enterprise corruption free.

    Use Case 2: Background check system

    Problem Statement

    After induction of an employee in public or private sector, a background check needs to be conducted to check if the employee is authentic or not.

    Current Scenario

    Several private organizations are there to help other enterprises to conduct background check. Government sector have their entirely different unit and employees to conduct background check. If the same employee switches job, the background check is repeated. Also, in case of passport registration, a background check with police level verification is conducted. These multiple background checks of same employee mean, double spending and waste of time, money and resources.

    Blockchain Solution

    At every level of education, a background check is done at basic level to check if certificates are valid or not. These can be put into a blockchain. Later, during passport verification, the validation can be maintained into blockchain. If in a condition, a separate background is done, that too will be maintained in the blockchain. Hence, a single data to check if the person is authentic can be maintained via blockchain. Also, power to share data can be given to the user/employee itself.

    Use Case 3: Supply Chain (Online shipment)

    Problem Statement

    Online shopping is easier to access but the authenticity of the product needs to be verified.

    Current Scenario

    Multiple online shopping websites are there. All websites have multiple vendors. These vendors too depend upon other vendors for supply. Once an item is ordered online, these vendors send that items to the user. These items can be a copy of original and this counterfeit practice can be conducted from any of the vendors or even by the delivery unit.

    Blockchain Solution

    The goal of this use case is to take the authentic item from the manufacturer unit and deliver the same to the customer. In doing so, a blockchain needs to be constructed in such a way that each product is saved on blockchain with a unique ID at the manufacturer unit itself, the product data need to be updated based on its location (at which vendor the product has reached) and also if it is being delivered to the customer. If a fake product is delivered to a customer, the customer can track if the unique ID maintained upon the item is there in the blockchain or not, and if it is there, does its location is correct or not. In this way a blockchain will ensure original product delivery irrespective of vendors.

    We have discussed some of the use cases of blockchain; likewise, multiple scenarios are there where we can implement a blockchain. To explore more, read blockchain use cases by IBM here.

  • ERP Modules with Blockchain

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    Many ERP solutions have started implementing blockchain solutions to make their system more secure and business friendly. In this article we will try to explore more about the connections of  ERP Modules with Blockchain.

    Supply Chain Management (SCM) and Blockchain

    If we want to learn about ERP Modules with Blockchain then we should start with Supply/Value Chain. Here we have two scenarios where we face problems:

    1. Today, before blockchain, in the old way of supply chain, all different partners have their own database and their own information. It means a customer has their own database; manufacturer has their own database and the retail seller too has their own database. If we have two databases, it will be two versions of truth. This scenario leads to conflict sometimes e.g. I ordered a thousand mobile phones, but I received 950. Which database will be true one? Of course, mine is true. But other one will also say that his data is true. So, there we have a problem.
    2. If we have a supply chain like this, as mentioned in below diagram. The supply goes from sub supplier to supplier, supplier to the producer and so on. They all must take keep margin for variations. The sub supplier must produce little more to be on secure side, the supplier orders little more to be on secure side and have backup. And this scenario continues till end. It means, if the customer changes something, it will cause enormous cost all the way down till the sub supplier in the supply chain because there are so many different owners of the information for all the steps. They don’t really know each other. What they only know is their immediate  neighbor.

    Flow diagram of SCM

    The solution that blockchain provides in this scenario is by becoming a single source of truth. All the nodes will have only one connection to the block chain as per below image, which means all the participants will have access to relevant information in real time.

    SCM ERP modules with Blockchain

    Customer Relationship Management (CRM) and Blockchain

    If we take a scenario of general business customer relationship management which starts with a contract, followed by order, payment and delivery. The data flow between customer and seller happens multiple times and it too faces the same problem as faced in supply chain management above. In this case too, we can lock down the records in a blockchain and expose only relative data to relative users. The same thing is represented in the image below:

    CRM ERP modules with Blockchain

    Other modules of ERP share same problems and hence, we can solve this issue by utilizing blockchain.

  • Nonce

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    Suppose you have to abuse your friend in public and you don’t want others to know that you are abusing. What will you do? Probably, you will come with a new word such that your friend will understand that you are abusing but the others will not. This word you just have coined is for the moment and might not be used again, ever. These types of words are termed as Nonce words in English language. The same concept is utilized in cryptographic communication to improve its security. In this article we will explore more about it.

    What is a Nonce in Cryptography

    In cryptography, a nonce is a random number that can be used only once in a cryptographic communication.

    Nonce

    In the diagram shown above, we have tried to explain the use of nonce in a cryptic way of login.

    Nonce in Blockchain

    The literal meaning of nonce, as we have discussed earlier, is “unique for particular occasion”. A nonce is a number which has to be guessed in such a way that when added before the hashed value of current block should produce a value whose hashed value is less than the difficulty (it is also a part of block and is regenerated for every block), its length should be equal to the hashed block length i.e. 64 character which is equal to SHA-256 length in case of Bitcoin.

    How to Implement Nonce in Blockchain

    As a programmer, you might be wondering how to implement a nonce in your blockchain. Here, we will just write a small script to show the use of nonce. We will be publishing a tutorial to develop a new blockchain end to end, and there we will try to explore the development part.

    class Block {
          constructor(timestamp, data) {
              this.index = 0;
              this.timestamp = timestamp;
              this.data = data;
              this.previousHash = "0";
              this.hash = this.calculateHash();
              this.nonce = 0;
          }
      
    
          calculateHash() {
      return SHA256(this.index + this.previousHash + this.timestamp + this.data + this.nonce).toString();
    
          }
      
    
          mineBlock(difficulty) {
    var target = difficulty.toString(); //Create a string with difficulty
      while(!hash.substring( 0, difficulty).equals(target)) {
          nonce ++;
          hash = calculateHash();
        }
    
          }
      }
    

     

    In the JavaScript code mentioned above, we have created an initial block (constructor) where the value of nonce is set as 0. In the mineBlock section, we have increased the value of nonce until hash target is reached. This is done to find the nonce and add the transaction block in the blockchain.

    How a Miner Finds a Nonce

    A miner follows the steps below to solve/find a nonce:

    • The person(miner) must guess a value of nonce (it can start with 000…0001)
    • Get the hash value of block header of previous block (000dceb75a135c…)
    • Append that nonce before the hash of block header (000…0001000dceb75a135c…)
    • Rehash the above appended value (xyz)
    • Get the difficulty value from the block header (abc)
    • Check if the above rehashed value is less than the difficulty value or not (xyz < abc)
    • If yes, then a new block is added in the current Blockchain of the Bitcoin and this person is rewarded some bitcoins for his work

    Advantages

    • It makes Blockchain Transaction tamper proof and secure
    • It enables secure and valid addition of a transaction block

    Disadvantages

    • It slows down the process of blockchain transaction
    • It requires heavy computer mechanism to solve a nonce after certain level of transaction which results in heavy electricity utilization
  • Merkle Tree

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    In Blockchain, it is very important to keep our transaction and other data encrypted and secure. The security of data is not a new requirement and there is a whole different department working 365 x 24 for the same. This department is the department of cryptography. Under cryptography, a tree is an organization of data in form nodes and leaves as shown below. Since, it resembles a real life tree, that’s why it is named so. In this article we will explore more about tree and one of its important type i.e. Merkle tree.

    a tree

    What is a Cryptography Tree

    A Tree in Cryptographic world is a graphical structure which looks like upside down of a real tree with following features:

    • Root is at the top
    • Elements are known as nodes
    • Lines connecting elements are known as branches
    • Nodes without any further children are known as leaves

    The above points can be also seen in the image shown below:

    A cryptographic tree

    Here, Subject is the root. Science and English are the nodes. Physics, Chemistry, Biology, Grammar and Literature are the leaves. The line connecting all of them are the branches.

    What is a Merkle Tree

    A Merkle Tree, also known as Hash Tree, is a cryptographic tree in which every leaf node contains hash value of a data block, while the non-leaf nodes contains hash of child nodes. Thus the root of the tree is actually the hash of all of its child nodes. This concept was given by Ralph Merkle, hence named so.

    Merkle Tree in Blockchain

    As discussed above, A Merkle tree in a blockchain is also a representation of blockchain data (in our case hash key of the transaction data) in a form of leaf and child node. All the nodes are ultimately connected to a single root. The root is the representation of all the transaction data stored in the nodes as hash keys into a single hash key. Let us make it simple, a Merkle tree is there with multiple branches and each branch has its own branch. Now the last level of branches will have the transactional data in form of hash keys. These hashed keys will be put into pairs and will be hashed again, as shown in the image below. This process gets repeated until we get only one hash. This hash is then stored in the Blockchain as Data and using it only other data can be retrieved or searched. This high level of hashing makes it tamper proof.

    Merkle Tree

    Advantages

    • It makes Blockchain Tamper proof
    • It makes the blockchain light in terms of space requirement, hence it makes the blockchain fast and light
    • It helps to verify the information of a blockchain
  • Timestamp

    Preface – This post is part of the Blockchain Basics series.

    Introduction

    Whenever a transaction happens anywhere, it is very important to keep the time and date of that transaction in record. This record not only helps in tracing down the transaction for validity but also helps in reducing the number of frauds and maintaining the transaction details in current sequence. To maintain data and time separately is a tedious job. To get rid of this problem, timestamp was introduced which is a mixture of both. In this article we will explore all about it.

    What is a Timestamp

    A timestamp is a sequence of encoded date and time information almost accurate to a small fraction of seconds. There are many ways to represent timestamps, some are shown below:

    Examples:

    • Wed 01-01-1999 6:00
    • 1995-10-30 T 10:45 UTC
    • 1997-11-09 T 11:20 UTC
    • Sat Jul 23 02:16:57 1995
    • 1256953731 (Unix time)
    • (1979-07-21 T 02:56 UTC) –
    • 07:38, 11 December 2019 (UTC)
    • 1995-102 T 10:15 UTC (year 1985, day 102 = 12 April 1995)
    • 1995-W15-5 T 10:15 UTC (year 1985, week 15, day 5 = 12 April 1995)
    • 20190203073000 (02/03/2019 7:30:00)

    Timestamp in Blockchain

    A timestamp in a blockchain is a Date-time value that is stored in a block.  As mentioned earlier, any transaction is incomplete without date and time information. In blockchain, it also tells at which time that block was created. In Blockchain this value is in the form of a Unix Timestamp.

    UNIX Timestamp

    Unix Timestamp is the number of seconds that have elapsed since 01.01.1970 which means 0000000000 in UNIX time is equal to January 1, 1970 12:00:00 AM.

    A timestamp is converted value of GMT. If a block is created, it will take current time of GMT and convert it into Unix Time. Once converted, it will validate it if it is greater than the saved time of previous block. Once validated, then only it is saved. We can convert any time to UNIX time here.

    Timestamp

    In above figure, you can convert any time to Unix Time-stamp.

    How to get Timestamp

    Different languages provide different modules and functions to get time-stamp. In JavaScript, we can achieve using the code below:

    Date.now()

    Advantages

    • It keeps the transaction in timely order
    • It helps to create a log
    • It helps to reduce the cases of frauds