BLOCKCHAIN TECHNOLOGYunit1'
BLOCKCHAIN TECHNOLOGYunit1'
A20CAT612
A20CAT612 BLOCKCHAIN
TECHNOLOGY
Course Objective
• To define the fundamental ideas behind Block Chain..
• To know about Bitcoin Fundamentals.
• To understand about the Developing knowledge in Bitcoin.
• To understand the Ripple Block chain.
• To Understand Digi Byte Techniques.
Course Outcome
After completion of the course, the students should be able to
CO1 - To get the knowledge in principles of Block Chain.
CO2 - To get the knowledge in Bitcoin Fundamentals.
CO3 - To get the knowledge in in Bitcoin.
CO4 – To get the knowledge in Ripple
Block chain. CO5 - To get the
knowledge in Digi byte.
Text books
1. Tiana Laurence, “Blockchain Dummies”, A Wiley Brand.
2. Arvind Narayanan, Joseph Bonneau, Edward Felten, Andrew Miller and Steven Goldfeder, “Bitcoin
and Cryptocurrency Technologies: A Comprehensive Introduction”, Princeton University Press,
Kindle Edition, 2016.
3. Imran Bashir, “Mastering Blockchain: Deeper insights into decentralization, cryptography”, Packet
Publishing Ltd,Kindle Edition, 2017.
4. Douglas Robert Stinson and Maura Paterson,“Cryptography: Theory and Practice”, CRC press, 2018.
UNIT I INTRODUCTION
Blockchain
The term "blockchain" refers to a digital transaction ledger maintained by a
network of computers in a way that makes it difficult to tamper with or modify the
data. By eliminating the middleman or other third party, the technology provides a
safe way for people to transact with one another.
Blockchains are well recognized for playing a key role in cryptocurrency systems
like Bitcoin in keeping a secured and decentralized history of transactions. In
contrast to databases, which typically organize information/data into tables, a
blockchain, as the name suggests, organizes data into chunks/blocks that are
linked together.
A new transaction has been requested for the blockchain network, where all data
that requires to be transferred is double encrypted by the use of public and private
keys.
After that, the transaction is sent through the global network of peer-to-peer
computers, where all of the network's nodes will verify the transaction's
legitimacy, including if there is enough balance available to complete the
transaction.
(iii) New Block Formation
The blockchain network has multiple nodes, and numerous transactions are
confirmed simultaneously. A block is made up of several mempools, each of
which contains all the validated transactions at a specific node, and the transaction
will be included in the mempool after it has been reviewed and confirmed as valid.
The nodes that create a block will attempt to add it to the network in order to make
it permanent; however, if every node is permitted to add blocks in this way, the
blockchain network's functionality will be disrupted. In order to address this issue,
the nodes employ a consensus method to make sure that each new block added to
the chain represents the single version of the information validated by all the
nodes and that only a legitimate block is safely linked to the chain; a hash code for
that block is generated by the consensus method and is necessary for adding the
block to the chain.
The newly formed block is now set to be added to the chain after receiving its
hash value and being validated; a blockchain is made up of blocks that are
cryptographically connected to one another by the hash value of the preceding
block, which is included in each block and the open end of the blockchain receives
a new block.
The transaction is finished as soon as the block is added to the chain, and the data
is then recorded there permanently; the transaction's information can be accessed
and verified by anybody.
Attributes of Blockchain
Though blockchains are typically used to keep the history of cryptocurrency
transactions, they also have the potential to store other data, such as digital assets
or product inventories.
o It has intrinsic value since it offers a reliable, safe, and quick means of
transferring value with minimal to no cost.
o It has no physical form since it only exists on the immutable blockchain.
o The majority of the participants in a cryptocurrency's decentralized
network, rather than a single centralized authority, make the decision based
on a cryptocurrency's attributes, like its total supply.
Features of Blockchain
Below mentioned are some of the primary features of the Blockchain:
Immutable
The blockchain is considered immutable as it can't be altered or modified. It is
therefore said to be a permanent network.
Decentralized
The blockchain network is decentralized, indicating that not only one entity will
be in charge of making all of the choices. Instead, a group of nodes creates and
maintains the network, and each node has an identical copy of the ledger. The
blockchain network's decentralization feature offers several benefits:
Secure
Each record on the blockchain is individually encrypted, further enhancing the
security of the network's process. As there is no centralized authority, it isn't
possible to simply add, modify, or remove data from the network.
All the information on the chain is hashed using cryptography, providing each
one a unique identity on the network. Any attempt to modify the information
would necessitate modifying every hash ID, which is simply not possible. Each
block contains its own special hash and the previous block's hash. The blocks are
"cryptographically" connected together due to this feature.
Consensus
Consensus is a method of making decisions that allow a group of network nodes
to reach an agreement swiftly and effectively, ensuring the system's smooth
functioning. Every blockchain has a consensus system that enables the network
to make decisions quickly and unbiasedly. Even though nodes may not have
much trust in one another, they might have trust in the network's central
algorithm. A consensus algorithm is required for any blockchain, or it will lose
value. There are numerous available consensus algorithms, each having
advantages and disadvantages.
Before records are approved into the network, all the participants must concur
that they are legitimate. A node should receive the consent of the majority in
order to add a block to the network, or else, the block can't be added. It is not
possible for a node to simply insert, alter, or erase data from the network. Every
record is updated at once, spreading quickly across the network. Thus, no
modifications can be performed until a majority of the network's nodes consent
to them.
Benefits of Blockchain
The below mentioned are some of the blockchain benefits:
Applications of Blockchain
Blockchain technology has a wide range of uses in various categories/ fields,
some of which are mentioned below:
Healthcare
With smart contracts, blockchain can have a significant effect on the healthcare
industry. A contract between two parties can be established through smart
contracts without the necessity of a middleman, and the contract's terms are
known to all parties, and when its criteria are satisfied, it is immediately put into
effect. This could be highly helpful in the healthcare industry since it allows for
the encryption of personal health records using Blockchain technology, making
them only accessible to primary healthcare practitioners with a key.
Internet of Things
IoT is a system of interconnected devices that can communicate with one another
and gather information that may be utilized to obtain valuable insights. The
Smart Home, in which all home appliances like lights, air conditioners, speakers,
etc., may be linked together on a single platform, could be one of the examples of
IoT. Blockchain technology can be utilized to secure this enormously dispersed
system; the security of an IoT system can only be as strong as finding the
weakest link. In this case, blockchain can be used to make sure that the
information collected by IoT devices is secure and accessible to only the
right/trusted people.
Non-Fungible Tokens
NFTs are generally regarded as a means of acquiring ownership of digital art.
Due to the blockchain's precluding against information existing in two places,
posting an NFT on it assures that there is only a single copy of digital artwork.
While NFTs have many applications, at their base, they are a method of
transferring ownership over anything that may be represented by data.
Blockchain Architecture
2. Previous Block Address/ Hash: It is used to connect the i+1 th block to the
ith block using the hash. In short, it is a reference to the hash of the previous
(parent) block in the chain.
3. Timestamp: It is a system verify the data into the block and assigns a time or
date of creation for digital documents. The timestamp is a string of characters
that uniquely identifies the document or event and indicates when it was
created.
4. Nonce: A nonce number which uses only once. It is a central part of the
proof of work in the block. It is compared to the live target if it is smaller or
equal to the current target. People who mine, test, and eliminate many Nonce
per second until they find that Valuable Nonce is valid.
• Anonymity: Each user can interact with the blockchain with a generated
address, which does not disclose the real identity
of the miner. Note that blockchain cannot guarantee perfect privacy
preservation due to the permanent thing.
1. Public Blockchain:
A public blockchain is a concept where anyone is free to join and take part in
the core activities of the blockchain network. Anyone can read, write, and audit
the ongoing activities on a public blockchain network, which helps to achieve
the self-determining, decentralized nature often authorized when blockchain is
discussed. Data on a public blockchain is secure as it is not possible to modify
once they are validated.
The public blockchain is fully decentralized, it has access and control over the
ledger, and its data is not restricted to persons, is always available and the
central authority manages all the blocks in the chain. There is publicly running
all operations. Due to no one handling it singly then there is no need to get
permission to access the public blockchain.
Anyone can set his/her own node or block in the network/ chain.
After a node or a block settled in the chain of the blocks, all the blocks are
connected like peer-to-peer connections. If someone tries to attack the block
then it forms a copy of that data and it is accessible only by the original author
of the block.
Advantages:
1. A public network operates on an actuate scheme that encourages new persons
to join and keep the network better.
2. There is no agreement in the public blockchain.
3. This means that a public blockchain network is immutable.
4. It has Rapid transactions.
Disadvantages:
1. Public blockchain can be costly in some manner.
2. The person need not give identity, that’s why there is a possibility of
corruption of the block if it is in under attack.
3. Processing speed is sometimes slow.
4. It has Integration issues.
2. Private Blockchain
3. Consortium Blockchain
A consortium blockchain is a concept where it is permissioned by the
government and a group of organizations, not by one person like a private
blockchain. Consortium blockchains are more decentralized than private
blockchains, due to being more decentralized it increases the privacy and
security of the blocks. Those like private blockchains connected with
government organizations’ blocks network.
1. Node: Nodes are network participants and their devices permit them to keep
track of the distributed ledger and serve as communication hubs in various
network tasks. A block broadcasts all the network nodes when a miner looks
to add a new block in transactions to the blockchain.
4. Chain: Chain is the concept where all the blocks are connected with the help
of a chain in the whole blockchain structure in the world. And those blocks
are connected with the help of the previous block hash and it indicates a
chaining structure.
Anyone with the right proof of work In the database reading and
Rights can write on the blockchain. writing can do so.
It is faster as compared to
It is slow in speed.
Speed blockchain.
Blockchain technology is mostly about the transactions that we make digitally for
ourselves. Eventually, these transactions make their way to the various blocks
that become part of the Blockchain later on. So, it is important to understand
the transaction life cycle in Blockchain technology.
This lifecycle follows the journey of a single transaction as it makes its way
through each stage in the process of joining the blockchain. Transaction in simple
words is the process of sending money by the sender and the receiver receiving
it. The Blockchain transaction is also quite similar, but it is made digitally.
Let us understand the various stages in a blockchain transaction life cycle with
the help of an example.
Sourav and Suraj are two Bitcoin users. Sourav wants to send 1 bitcoin to Suraj.
CHAPTER 2 Picking a Blockchain 15
1. First, Sourav gets Suraj’s wallet address (a wallet in the blockchain is a digital
wallet that allows users to manage their transactions). Using this information,
he creates a new transaction for 1 bitcoins from his wallet and includes a
transaction fee of 0.003 bitcoin.
2. Next, he verifies the information and sends the transaction. Each transaction
that is initiated is signed by a digital signature of the sender that is basically
the private key of the sender. This is done in order to make the transaction
more secure and to prevent any fraud.
3. Sourav’s wallet then starts the transaction signing algorithm which signs his
transaction using his private key.
4. The transaction is now broadcasted to the memory pool within the network
5. This transaction is eventually accepted by the miners. These miners, group this
transaction into a block, find the Proof of Work, and assign this block a hash
value to be mapped into the blockchain.
Choosing a Solution
» They move value and trade value quickly and at a very low
cost.
» They create nearly permanent data histories.
Table 2-1 lists common uses cases that are suited for each
type of blockchain.
Choosing a Solution
5. Smart Contract support: The blockchain solution should have smart contract
support to enable the creation and execution of automated agreements between
parties.
6. Development Community: The blockchain technology should have an active
and growing development community to ensure its longevity and continued
development.
By considering these factors, one can select the right blockchain solution that fits
their specific requirements. It is also important to do thorough research, test the
technology, and seek expert advice before making a final decision.
As a concluding note, let’s have a look at the major differences between bitcoin
and blockchain technology.
• Smart contracts are contracts that are coded and stored on the blockchain.
They automate agreements between the creator and recipient, making them
immutable and irreversible.
• Once all the conditions specified in the code of the smart contract are met
and the required actions are performed, the contract is considered executed.
CHAPTER 2 Picking a Blockchain 27
• Popularized by the Ethereum blockchain, smart contracts have led to the
network’s array of decentralized applications (DApps) and other use cases.
The smart contract would then be deployed on a blockchain network. In the event
of a disagreement, the smart contract would receive evidence and arguments
from both parties. The arbitration would then be carried out automatically via the
smart contract, either using a predetermined list of arbitrators specified by both
parties or a decentralized network of arbitrators.
Once a decision is reached, the smart contract would automatically execute the
decision, such as transferring funds to the winning party or releasing the product
or service to the appropriate party.
This article will explain the history of smart contracts, how smart contracts work,
and why smart contracts are important.
Think smart contracts as digital “if-then” statements between two (or more)
parties. If one group’s needs are met, then the agreement can be honored, and the
contract is considered complete.
The third step is to write the code for the smart contract. The code will specify
the exact steps that need to be taken to execute the contract when the specified
conditions are met.
Deploy the contract to a blockchain platform
Deploying the smart contract on a blockchain platform is the fourth stage. This
entails validating the contract’s validity by uploading the code to the blockchain
network.
The smart contract’s execution is the fifth phase. When the predetermined
circumstances are satisfied, the contract is automatically executed, and the
blockchain network activates it.
The contract’s information is entered onto the blockchain network when it gets
executed. This covers the terms of the contract, the prerequisites for execution,
and the execution date and time. The contract’s specifics are immutable once
they are entered into the blockchain ledger, meaning they cannot be changed or
removed.
It is also important to note that smart contracts are different from written
contracts in many ways, as discussed in the table below:
asset was never actually launched, this Bitcoin (BTC) predecessor highlighted
the smart contract use case — trustless transactions on the internet.
However, smart contracts didn’t start to get much attention until the advent of
blockchain technology in the late 2000s. Blockchain technology made it possible
to build decentralized, trustworthy networks that don’t require a centralized
authority to carry out smart contracts. Ethereum was the first blockchain platform
to allow smart contracts.
Many, including the Ethereum website, compare smart contracts to a vending
machine. Vending machines serve the purpose of a vendor providing the user
with a product, without the need for an actual person to take the money and hand
over the item. Smart contracts serve that same purpose — but are much more
versatile.
Smart contracts have advanced quite a bit over time. They started as simple if-
then statements that a programmer can create and implement. Now, they have
been used for a variety of applications, including supply chain management, real
estate transactions and even voting systems. The potential for smart contracts to
revolutionize the way business is conducted and people interact with each other
is vast, and their development is an exciting area of innovation in the blockchain
space.
The absence of intermediaries in smart contracts not only mitigates risk but also
translates into cost savings. With complete visibility and access to the terms and
conditions of the contract, all relevant parties are held accountable once the
agreement is signed. This ensures that the transaction is transparent and non-
negotiable, promoting trust and accountability among all involved parties.
Moreover, all documents kept on the blockchain are duplicated many times,
allowing for the restoration of originals in the event of data loss. Smart contracts
are encrypted, and cryptography protects all documents from being32tampered
CHAPTER 2 Picking a Blockchain
with. Finally, smart contracts also eliminate errors that occur due to the manual
filling out of several forms.
Although smart contracts are a promising innovation, they are not without their
flaws. It’s essential to remember that these contracts and the underlying
blockchain technology are developed by humans, making them susceptible to
human error. In some cases, errors in the code can result in security breaches, as
was seen in the infamous attack on Ethereum’s decentralized autonomous
organization (DAO) in 2016. The attackers exploited a vulnerability in the
fundraising smart contract and diverted funds from the project.
The inability of smart contracts to retrieve data from sources outside of the
blockchain network is one of their drawbacks. This presents a problem because
numerous real-world applications need external data to initiate or carry out
contract clauses. For instance, external weather data might be required by a smart
contract that bases insurance payouts on weather conditions.
This is where oracles come in. Oracles are third-party services that let smart
contracts communicate with off-chain data sources, such as APIs and web pages.
They provide a bridge between the smart contract and the external data source,
supplying the details required to carry out the requirements of the contract.
Aside from the payments example mentioned above, there are various, potential
implementations of smart contracts that can automate the world and make it an
easier place to live. Here are some prominent examples of smart contract use
cases.
CHAPTER 2 Picking a Blockchain 33
Digital identity
For social media, no intermediary controls a network. Instead, users choose what
information to make public and what to keep private. Should they want to
participate in information exchange, like an endorsement, they can create a smart
contract and choose what data is transacted, rather than simply gleaning
everything about a user. A third party isn’t there to take some of the funds or
secretly store and sell that data — only the user profits.
The same applies when it comes to dealing with banks and other financial
institutions. Communication only involves sending required documents and vital
information over. There’s no risk of a loan group storing your email address and
selling it to other credit companies. That info is entirely under the user’s control.
Real estate
In the traditional world, real estate brokers are a necessary evil. Considering the
act of selling a house is nothing short of long and convoluted, owners will hire a
broker to manage the confusing parts for them, such as the paperwork and
finding a buyer. While that sounds ideal for the seller, remember that brokers
take a significant fee from the house’s sale price.
A smart contract can take the place of a broker, streamlining the house transfer
process while ensuring it’s just as secure as with an intermediary. This is where
the “trustless” moniker comes into play.
Insurance
Insurance policies could easily benefit from smart contracts. Essentially, signing
up for a policy would enter the user into a smart contract with a provider. All
policy requirements would be written into the smart contract, which the user
would read and sign if they agree.
That contract would sit open until the liable party needs it. Then, they’d simply
upload the required forms that prove their need for insurance payment and the
funds would be released. This type of contract removes the need for
communicating with insurance groups and individuals. While the user would still
need paperwork to prove their requirements, the subsequent submission and
funding process will be close to instant.
In the identity aspect of things, it’s worth keeping in mind that all drivers will
have a record of their accident reports and other important insurance information
as well. This accessibility could factor into lower rates for good drivers with no
dings on their driving history.
Supply chain
Grocery stores, office warehouses, farmers and more all have their specific place
in a supply chain. But with how complex these networks are becoming,
companies are finding it increasingly harder to track product custody and follow
payments, among other things. Smart contracts can automate and incentivize all
parts of the supply chain to increase their accountability.
It could automate every step of the transaction, from ordering to delivery, using a
smart contract. All pertinent information, such as the product specifications,
shipping information, terms of payment and deadlines for the fulfillment, would
be included in the smart contract.
In order to guarantee that the items are in accordance with the buyer’s
expectations, the smart contract would also include conditions for the product’s
quality and quantity. The use of intermediaries, like banks or brokers, and the
fees associated with them would be unnecessary because the contract is self-
executing and non-negotiable. CHAPTER 2 Picking a Blockchain 35
The money would be kept in escrow once the contract is signed until the supplier
certifies that the products have been delivered. The blockchain would track and
save the delivery schedules and shipment information, giving both parties
complete visibility and transparency.
When the goods are delivered and the buyer certifies that they meet the agreed-
upon parameters, the smart contract will instantly release the payments to the
provider. Due to the lack of intermediaries and decreased risk of fraud, this
method would be effective, efficient and secure.
. These platforms provide drag-and-drop user interfaces and visual editors that
enable users to quickly and simply develop smart contracts without the need for
programming expertise.
BlockApps Strato, a blockchain platform that offers a visual editor for creating
smart contracts, is another example of a no-code smart contract platform. It
supports a number of computer languages, such as Solidity and JavaScript, and
offers users a variety of template options. CHAPTER 2 Picking a Blockchain 36