Block Chain Is
Block Chain Is
If you want to transfer money between two persons, you have to go through a payment gateway or a bank.
If you want to hire a taxi you will go through an online aggregator service like Uber or Ola
If you want to buy any goods online, you have to go through an online merchant like Amazon
Would you be willing to perform any transaction without a third party overlooking operations?
Who would you rather trust with your money -- a third party or yourself?
What is wrong in trusting a third party with your money or other valuables?
Why Blockchain?
What if you choose to not trust any third party with your transactions?
Without the Bank or a gateway, we can transfer money to another person directly.
We can directly engage a taxi without an aggregator like Uber, but ensuring same quality of service and trust.
We can directly buy goods from a merchant without the need for an online retailer like Amazon.
Blockchain is a way to do transaction between two untrusted parties directly without a central authority.
Let us ourselves experience a blockchain network for performing banking transactions in the next demonstration.
To install MetaMask extension in Google Chrome, go to More tools -> Extensions->Open Chrome Web Store in Google
Chrome and search for MetaMask and install it.
Step 2 : Once installed, you should be able to see the following icon in Google Chrome.
Step 3 : Open MetaMask by clicking on the icon. Click on the triangle highlighted in the below
screenshot.
http://nynboy-dns-reg1.southindia.cloudapp.azure.com:8545
Step 6 : Now, select the following network as shown below.
Step 7 : Click on the icon shown below.
Now that, you have experienced a blockchain network, let us understand blockchain.
Nobody knows who Satoshi really is. Many have claimed to be the real Satoshi, but all were proven to be wrong.
Further reading:
Who is Satoshi Nakomoto
The basic prerequisite to create a Blockchain network is that enough people need to believe they don't need a third party to
depend on for transactions and that this group can maintain the records on their own.
How many is enough?
In the following example, we assume that 10 individuals are giving up on banks and are forming the network. The following
facts are assumed to be true in the network:
Upon mutual agreement, every individual have details of each others accounts at all times.
The identity of each individual is hidden from each other.
Every participant in the the network will start off with an empty folder. As transactions happen, pages will be added to the
folder. This collection of pages will form the register that tracks the transactions.
Performing Transactions
Every individual in the network will be ready with a page, to note down any transaction that occurs within the network.
#5 will make an announcement in the network and tell all the participants - "I want to send $10 to #1, please make a note."
As account details are shared with all the participants of the network, everyone will check whether #5 has enough balance to
make this transfer. If yes, everyone makes a note of this transaction on the blank sheet of paper.
This exercise will go on until the page is full and cannot accommodate any more transactions. Let us assume that the
maximum number of transactions per page for our scenario is 5.
Once a page is full, it is sealed and put away in everyone's folders. Once sealed, no individual can make any changes to its
contents - EVER. This sealing technique is what provides the trust factor in the network in the absence of an intermediate
third party.
The pages on which each transaction has been recorded is called as a Ledger. The process of securing the ledger is known
as Mining on the ledger.
What is a Ledger?
Ledgers are the system of record for a business.
Businesses will have multiple ledgers for the multiple business networks in which they
participate
Transaction: an asset transfer onto or off the ledger
o John gives a car to Anthony (simple)
Contract: the conditions for a transaction to occur
o If Bob pays Alice money, then car passes from Bob to Alice (simple)
o If car won't start, funds do not pass to Bob, as decided by third party arbitrator (more
complex)
What is a Blockchain?
With the current understanding, let us now comprehend what a blockchain is.
A blockchain can be identified as a distributed ledger which is secure.
Constantly growing
It keeps track of all transactions. As more and more transactions occur, it will be entered in the
Blockchain, so it is constantly growing.
Chronological
Permanent
Immutable
No transaction data can be modified by anybody. All data entered is permanent.
E.g.: If you make a mistake of transferring $100 instead of $10 you cannot cancel it or delete it. To
correct the mistake, the receiver can initiate another transfer of $90/- back to you.
A hash is a type of function into which you give some input(a group of characters), and it’ll map the
characters into value of a certain length.
The output of a hash function is also called as a 'Hash Value' or 'Digital Signature'
A good hash function is one which, has the least probability of more than one input having the same
output.
Another unique feature of hash functions are that, for a change in single character (even 0 or 1), it
will give a different output.
Also, for the same input, the hash function always gives the same output.
This characteristics of hash function is very useful in detecting any changes in input and its use in
Blockchain gives it the property of immutability.
A hash function is not an encryption method in general. It means that you cannot derive the input
based on the output of the hash function.
Keeping this property in mind, let us try to answer the following question:
What can you send as input to the hash function such that you get a hash value that starts
with four leading zeroes?e.g.0000xY or 000015 or 0000dG etc.
The only way out of this problem is to try every know number one by one until you meet the desired
condition. Following this technique, you may yield the required output after several thousands of
attempts.
With the above example we can conclude that, it is extremely difficult to calculate the input given an
output.
But at the same time, let us now try answering this question:
Does this number(input), when fed into the machine, yield a word that starts with four leading
zeroes(output)?
All you need to do is provide the input string and verify if the input leads to the required output.
Proof of WorkPoW
Let us now understand how the page which contains the transactions of the network is sealed.
This situation is similar to what you saw previously. The only way to calculate this number is to try
every available number.
After several attempts, you will stumble upon a value which when added to the contents of the page,
will yield the hash value that satisfies our requirement.
This identified number becomes our sealing number. This sealing number is also called as Proof of
Work(PoW).
A page being sealed implies that no change can EVER be done on the contents of the page again.
So, to verify if a page has been altered, all you have to do is add the contents of the page with the
Proof of Work and verify whether it yields a hash function with four leading zeros.
If it matches, the contents have not been tampered with. But if the verification fails, the content of the
page has been compromised.
Let us know go back to the time when the last transaction has been updated onto the page.
As soon the as the page is full, every member of the network will spend computing resources(time,
electricity, processing) to find the Proof of Work, so that the page can be sealed. The first one to
figure it out will announce it to the network.
As soon as the PoW is announced, all the remaining individuals verify whether the given seal yields
the required output or not. If it does, the Proof of Work is accepted as the TRUE Proof of Work and
the page is sealed.
If an individual is not able to verify the Proof of Work with the required output, he is NOT ALLOWED
to seal the page and place it in the folder. This scenario is common and may occur due to the
following reasons:
Misheard transaction
Miswritten transaction
Dishonesty
No matter which the case, the individual has one choice - to discard it and copy it from another
member on the network. If the individual does not seal the ledger and place it in the folder, he would
be forbidden from participating in the network.
Incentives
Previously, we have seen that every individual of the network will indulge in the task to find the Proof
of Work for sealing a Ledger.
But why do the members need to spend resources to perform the calculation when they know that
some other member will do the same and announce it to the network anyway.
This is where Incentives and Rewards come into the picture. The first individual to calculate the
Proof of Work is rewarded with free money. Free money implies that the individuals account is
credited with money minted out of thin air - without decreasing anyone else's account balance. This
rewards system keeps the network going.
This is how Bitcoin came into existence. It was the first currency to be transacted over a Blockchain
network.
When enough people possess Bitcoins, they grow in value, making other people want Bitcoins;
making Bitcoins grow in value even further; making even more people wanting Bitcoins; making
them grow in value even further; and so on.
The Chain:-
Once all individuals tuck away the page into their respective folders, they bring out a new blank page
and repeat the whole process all over again, doing it forever.
Now, let us assume that there are five pages in the folder already, all of which have been sealed
using Proof of Work.
What if someone goes back to the third page and tries to modify the transaction to favor
him?
As per what we have seen, the Proof of Work will detect any inconsistency in transaction.
But what if that someone also manages to calculate a new Proof of Work and seal it with the
new value instead?
To prevent this problem, there is one more aspect to how a Proof of Work is calculated.
Instead of just two parameters, there is one more value that is passed to the hash function for the
sealing process. The third parameter is the output of the hash function of the previous page.
With this neat little trick, we have made sure that every page depends on its previous page.
Think of a single page as a Block of transactions and the folder as the Chain of pages (Blocks),
therefore, turning it into a Blockchain.
Therefore, if someone has to modify a historical page, he would also have to change the contents
and the sealing number of all the pages after that, to keep the chain consistent.
Interpreter: Default
Step 2: Create a PyDev module named 'block.py'. This module will represent a basic block in a
blockchain - consisting of data, the previous hash value and, in our example, for added security, a
timestamp of when the block was created.
Step 3: Copy and paste the below code into your editor.
block.py
import datetime
import hashlib
class Block:
def __init__(self, previous_block_hash, data, timestamp):
self.previous_block_hash = previous_block_hash
self.data = data
self.timestamp = timestamp
self.hash = self.get_hash()
@staticmethod
def create_genesis_block():
return Block("0", "0", datetime.datetime.now())
def get_hash(self):
header_bin = (str(self.previous_block_hash) +
str(self.data) +
str(self.timestamp))
inner_hash = hashlib.sha256(header_bin.encode()).hexdigest().encode()
outer_hash = hashlib.sha256(inner_hash).hexdigest()
return outer_hash
Step 4: Create a PyDev module named 'blockchain.py'. This module will take care of creating the
block objects and adding them to a list to represent a single chain. Copy and paste the below code
into your editor.
blockchain.py
num_blocks_to_add = 10
block_chain = [Block.create_genesis_block()]
Step 5: Run the blockchain.py module. Your console must present and output as shown below:
Payments:-
Businesses can make transactions between countries using blockchains. Payments can be made
directly between organizations, without any intermediaries, like banks or governments, slowing down
the process.
Blockchain may be very well on its way to replace money someday. Digital or virtual currency will
work as a medium of exchange of funds instead of money. These are also called
as Cryptocurrencies.
Such a radical shift in operations around the world would take years, if not decades, to materialize.
But right now, blockchain is already enabling businesses to transfer funds within minutes, instead of
days.
Due to the decentralized nature of blockchain, cross-border remittances will be another area where
businesses will adopt blockchain.
Cryptocurrencies
A cryptocurrency is a digital representation of value, that is neither issued by a central bank or
public authority nor necessarily attached to flat currency, but accepted by two or three parties
as a means of exchange, and can be transferred, stored or traded electronically.
There are different cryptocurrencies currently running in global markets. The transactions that
you had performed in Demo 1 were through one such cryptocurrency known as Ether. Some of
the other cryptocurrencies are shown below:
Traditional Currency vs. Cryptocurrency
Smart Contracts
A smart contract is a program that adds information onto digital transactions being executed on a
blockchain. It allows for more complex transactions than simply exchanging digital tokens for a
product or service. In simple words, it is like an agreement between parties involved in a transaction
that holds each party responsible for their role.
Current problem
Insurance companies can automate insurance policies by writing them into a smart contract.
When the input conditions of the smart contract change in an insured event, then the claims
process is triggered immediately.
Measurable parameters of any event, such as wind speed, location of a hurricane or
magnitude of an earthquake can be recorded onto the blockchain.
Smart contract not only reduces the administrative costs associated with fulfilling such
policies, but transparency and trust in the process is visible to all stakeholders
In the current scenario of travel insurance 60% of the passengers insured against the delay of their
flight never claimed their money.
Recruitment
Blockchain can play a major role in HR and talent acquisition space. Let us have a look at how can
blockchain help.
Background verification
All the records of candidates including identity proofs, academic certifications, and degrees,
employment history, previous salary break-ups can be pre-validated and stored in a secure
platform
Candidates can manage their own profile and grant access to their employer at the time of
need
Removes the need for third-party verification services and thus, recruitment costs
Paperless Onboarding
Validating the candidates’ information like employment history, address proof, educational
credentials, age proof, etc. across institutions ensures easy onboarding of candidates
without using paper documents
Evolution of Blockchain
Blockchain is a distributed database that maintains a continuously growing
list of records called blocks secured from tampering and revision. Blockchain
was first conceptualized by Satoshi Nakamoto in 2008 in his paper
about Bitcoin.
Blockchain 1.0
Blockchain 2.0
Blockchain 2.0 is beyond programmable money.
Smart Contracts
Data Protection solutions based on Blockchain
Blockchain as a platform: transparent trusted time stamping
Innovating in conventional market
Legislation
Later in 2013, Vitalik Buterin came up with an idea of applying Blockchain principles in various
domains apart from financial. By 2015 Vitalik and a group of programmers
launched Ethereum, which envisaged as a platform for creating Blockchain applications, smart
contracts, smart property, smart docs etc. These are all decentralized documents and contracts
coded using Blockchain technology running in Ethererum network.
Blockchain 3.0
Blockchain finding application in every field.
Decentralized web
Opportunities and challenges
Expanding the application of Blockchain in all domains. Examples include: healthcare, retail,
manufacturing, logistics, insurance, IoT
Each block is then added to the end of the chronological chain, stored not in one central location but,
synchronized on each node across the network
Cryptography
Enables the exchange of accurate (payment) instructions between the parties of the transactions
with digital signatures using public Cryptography
Cyptorgraphic hash functions are used to enforce discipline on writing transaction records on public
ledger
Blockchain Technology
It bundles together transactions in a chain of blocks and ensures transactions can be independently
confirmed as unique and valid using distributed consensus mechanism without a central authority
Trust protocol using general distributed consensus offered by Blockchain is the main reason for the
existence of Bitcoin.
Disadvantages of Bitcoin
Following are the disadvantages of bitcoin:
Difficult to use
Bitcoin software is not customer friendly
Most of the bitcoin software used to control, custody, operate and transact are complex
Difficult to access
Purchase of bitcoins is regulated in many countries
Difficult to secure
Blockchain and cryptographic protocols used in bitcoin are secure but the users must
safeguard their private key. The whole security depends on the storage and handling of
one’s private key
Lack of protections against mistakes
Transactions done cannot be reversed. Any mistake cannot be corrected
Loosing private key results in the loss of the entire bitcoin fund, administrators cannot help to
regain access
Block explorer
Faster settlement
Larger transaction sizes
Additional consensus methods
Varying degrees of anonymity
Advanced functionality
Adjustable permissions
Other key factors that can influence the future of this technology are:
Scalability
Volumes
Response Times
Vulnerability
DDoS attacks
Confidentiality
Regulatory
Issuance of crypto assets
Compliance rules
Oversight
Below are more documents and resources about Blockchain and its applications and how Infosys is
planning to adopt this technology with its clients.
What is Blockchain?