0% found this document useful (0 votes)
20 views75 pages

BC Practicals

Uploaded by

drashtipatel2k3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views75 pages

BC Practicals

Uploaded by

drashtipatel2k3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY

(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

PRACTICAL – 1
AIM: Study and perform practical on Cryptography algorithm for securing data.
Solution:

Simplified Data Encryption Standard (S-DES) is a simple version of the DES Algorithm. It is similar to
the DES algorithm but is a smaller algorithm and has fewer parameters than DES. It was made for
educational purposes so that understanding DES would become simpler. It is a block cipher that takes a
block of plain text and converts it into ciphertext. It takes a block of 8 bits.

It is a symmetric key cipher i.e. they use the same key for both encryption and decryption. In this article,
we are going to demonstrate key generation for s-des encryption and decryption algorithm. We take a
random 10-bit key and produce two 8-bit keys which will be used for encryption and decryption.

Key Generation Concept: In the key generation algorithm, we accept the 10-bit key and convert it into
two 8-bit keys. This key is shared between both sender and receiver.

➢ Cryptography:

Cryptography is a technique of securing information and communications through the use of codes so
that only those persons for whom the information is intended can understand and process it. Thus
preventing unauthorized access to information. The prefix ―crypt‖ means ―hidden‖ and the suffix
―graphy‖ means ―writing‖. In Cryptography, the techniques that are used to protect information are
obtained from mathematical concepts and a set of rule-based calculations known as algorithms to convert
messages in ways that make it hard to decode them. These algorithms are used for cryptographic key
generation, digital signing, and verification to protect data privacy, web browsing on the internet and to
protect confidential transactions such as credit card and debit card transactions.

Tarun Patel (12102080701119) 1


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

➢ Types of Cryptography:

1. Symmetric Key Cryptography: It is an encryption system where the sender and receiver of a
message use a single common key to encrypt and decrypt messages. Symmetric Key cryptography is
faster and simpler but the problem is that the sender and receiver have to somehow exchange keys
securely. The most popular symmetric key cryptography systems are Data Encryption Systems (DES)
and Advanced Encryption Systems (AES).

2. Asymmetric Key Cryptography: In Asymmetric Key Cryptography, a pair of keys is used to encrypt
and decrypt information. A receiver‘s public key is used for encryption and a receiver‘s private key is
used for decryption. Public keys and Private keys are different. Even if the public key is known by
everyone the intended receiver can only decode it because he alone knows his private key. The most
popular asymmetric key cryptography algorithm is the RSA algorithm.

Tarun Patel (12102080701119) 2


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

#include <iostream>

#include <iomanip>

#include <string>

#include <cryptopp/aes.h>
#include <cryptopp/modes.h>
#include <cryptopp/filters.h>
using namespace CryptoPP;
using namespace std;
int main() {
// Key and IV (Initialization Vector) for AES
byte key[AES::DEFAULT_KEYLENGTH] = {'k', 'e', 'y', '1', '2', '3', '4', '5', '6', '7', '8', '9', '
1', '0', '1', '1'};
byte iv[AES::BLOCKSIZE] = {'i', 'v', '1', '2', '3', '4', '5', '6', '7', '8', '9', '1', '0', '1', '1', '1'};
// Message to be encrypted
string plainText = "Hello, AES!";

// Encrypt using AES in CBC mode


CBC_Mode<AES>::Encryption encryptor(key, sizeof(key), iv);
StringSource(plainText, true, new StreamTransformationFilter(encryptor, new StringSink
(cipherText)));

// Displaythe encrypted message


cout << "Encrypted Text: ";
StringSource(cipherText, true, new HexEncoder(new StringSink(cout)));
cout << endl;
return 0;
}
OUTPUT:

Tarun Patel (12102080701119) 3


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

PRACTICAL- 2
AIM: Study and implement about Bitcoin Structure and Design.
➢ Bitcoin:

• Bitcoin is a cryptocurrency, a new kind of payment network and money. It was createdby a person or
group, going by the username Satoshi Nakamoto, who posted awhitepaper on a discussion board.

• Bitcoin operates without a financial system or government authorities. It can be used asan alternative
to fiat currencies or as an investment, utilizing peer-to-peer transfers on a digital network that records
and secures all transactions. This network is powered by a blockchain, an open-source program that
chains transaction histories to prevent manipulation.

• Bitcoin makes money for investors through appreciation, the increase of an asset's market value.
There's a lot going on behind the scenes in the Bitcoin network, so here'sa detailed primer designed to
help you further your understanding of this digital phenomenon.

➢ The Blockchain Ledger:

• The Bitcoin network maintains a distributed public ledger that records the ownership of all bitcoin,
the native digital asset token of the network. New transactions are grouped together into ―blocks‖ and
added sequentially to the network‘s ongoing chain of blocks — hence the term ―blockchain.‖ The
Bitcoin blockchain contains every blocksince inception, stretching all the way back to the first block
known as the ―Genesis Block.‖

• Identical copies of the blockchain are hosted on computers around the world that run the Bitcoin
software. These computers are called "nodes." This design ensures that no single entity is in control of
the blockchain or protocol that governs it. Bitcoin's distributed nature makes it decentralized and resistant
to being controlled (or shut down) by any government or central authority. Theoretically, all nodes that
maintain acomplete copy of the blockchain — known as "full nodes" — would need to be destroyed in
order to erase the Bitcoin blockchain. No small task as there are even full nodes floating above the earth
in space!

➢ Peer-to-Peer Network Nodes:


Nodes are a major part of blockchain-based protocols and the cornerstone of decentralization, security,
and transparency. There are several types of nodes on the Bitcoin network. When a user connects to the
Bitcoin network to send or receive bitcoin, her computer acts as a node. Most nodes are known as light
nodes, which typically only download the more recent blockchain data needed to process and verify new
transactions. This minimal approach keeps light nodes running quickly and efficiently without requiring
too much computational or storage resources

Tarun Patel (12102080701119) 4


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

➢ Anatomy of a Block:

• Each Bitcoin block is limited in size to one megabyte of data. For ―Segregated Witness‖ (SegWit)
blocks, transaction data is limited to one megabyte, whereas signature data (aka witness) is
segregated and limited to three megabytes. This keeps the block size at one megabyte while increasing
block space for transaction data.

• A block contains the following information:


A Block header:
1. Version number
2. Hash of the previous block header
3. Hash of the root of Merkle tree of all the transactions in the current block
4. Timestamp
5. Difficulty target of the current block (meaning how difficult the target hash will be tofind)
6. Nonce

➢ Bitcoin Forks:

• A fork occurs when an existing blockchain splits into two different blockchains. This happens when
an update is made to a protocol that not all of the nodes adopt. There are two types of forks that
blockchains can experience; a soft fork, whereby old nodes and new nodes are able to read both
blockchains (compatible); and a hard fork, whereby oldnodes cannot read the new blockchain and vice
versa (incompatible). Hard forks result in two separate blockchains with distinct native digital asset
tokens that are separate and apart from each other.
• When updates are made to the Bitcoin protocol, individual nodes must determine if theywill upgrade
and accept the new changes or not. If a constituent of nodes within the network refuses to adopt the
changes, then a hard fork results. Bitcoin has experienced several forks of both kinds, including the
Bitcoin Cash hard fork that occurred at block 661,647, the last common block between Bitcoin and
Bitcoin Cash. The Bitcoin Cash fork emanated from a disagreement in the Bitcoin community around
block size. Bitcoin Cash adopted a block size of eight megabytes to increase transaction throughput,
whereas Bitcoin kept a block size of one megabyte to foster greater node participation and ensure
decentralization.

Tarun Patel (12102080701119) 5


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

➔ Implementation of Bitcoin:
1. Explore a bitcoin structure using the blockchain demo, which is implementation ofSHA
algorithm.

2. After that, we have exploring the block using SHA-256 algorithm. In this we haveenter some
data in transaction data and click on start mining.

Tarun Patel (12102080701119) 6


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

3. After in next phase, we have understand about the blockchain and transaction.

Tarun Patel (12102080701119) 7


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

4. In last, we have seen the working of Coinbase and understanding about the Merkletree.

Tarun Patel (12102080701119) 8


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

PACTICAL – 3
AIM: Study and Install Bitcoin Wallet

Designing My Own Cryptocurrency: "EcoCoin"

Introduction

The goal of creating a new cryptocurrency, "EcoCoin," is to incentivize environmentally conscious actions and
investments in sustainability. By rewarding users with EcoCoin tokens, we aim to create a decentralized system
that promotes eco-friendly behaviors such as recycling, using renewable energy, and reducing carbon footprints.
EcoCoin will integrate with various real-world actions and reward users based on their sustainable activities.

Purpose and Vision

Objective:
EcoCoin aims to:

• Encourage sustainable practices among individuals and organizations.


• Create a transparent and secure platform for rewarding eco-friendly actions.
• Build a community of eco-conscious users who are motivated to participate in environmental initiatives.

Vision:
To become the leading cryptocurrency for environmental sustainability, integrating with existing sustainability
efforts, and rewarding users who contribute to the global effort to combat climate change.

Key Features

a. Token Model:

• EcoCoin (ECO) will be the primary token.


• Total Supply: 1 billion coins (to prevent inflation).
• Mining: Proof-of-Stake (PoS) consensus mechanism, with rewards given for holding and staking ECO
coins.
• Initial Distribution: 50% for eco-rewards, 20% for staking rewards, 15% for development, 10% for
ecosystem partnerships, and 5% for marketing.

b. Use Cases:

• Eco-Friendly Actions: Users will earn EcoCoins by participating in eco-friendly initiatives, such as:
o Recycling and waste reduction.
o Using renewable energy sources.
o Planting trees and contributing to green spaces.
• Marketplace: EcoCoins can be spent in a marketplace for eco-products (solar panels, reusable products,
etc.), or donated to environmental causes.
• Staking for Sustainability: Users who stake their EcoCoins will earn rewards, incentivizing long-term
investment in sustainability.

Tarun Patel (12102080701119) 9


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703
• IoT Integration: EcoCoin can be tied to real-world data from IoT devices to track users’ energy
consumption, water usage, and recycling habits. For example, smart meters could track energy usage and
reward users with EcoCoins for reducing consumption or using renewable energy.
• Partnerships with Eco-Friendly Brands: Businesses that support sustainability can accept EcoCoins for
payment and offer discounts or benefits to EcoCoin holders.

Technical Design

a. Blockchain Type:

• Public Blockchain: EcoCoin will use a public blockchain, where anyone can participate in mining or
staking.
• Smart Contracts: The blockchain will support smart contracts to automate eco-reward distribution, such
as automatic payments for verified green actions (e.g., rewards for energy consumption reductions or
verified tree planting).

b. Consensus Mechanism:

• Proof-of-Stake (PoS): EcoCoin will use PoS to make the network more energy-efficient compared to
Proof-of-Work (PoW) systems like Bitcoin. Users who stake EcoCoins will be rewarded with more
EcoCoins as an incentive for supporting the network's security and decentralization.

c. Security Features:

• Encryption: All transactions will be secured with strong encryption algorithms (e.g., SHA-256).
• Privacy: While the EcoCoin blockchain will be public, user identities will be pseudonymous, and
personal data will not be stored on the blockchain.

d. Scalability:

• Layer 2 Solutions: To address scalability issues, EcoCoin could implement Layer 2 solutions (e.g.,
payment channels) to facilitate fast and cheap transactions, especially for microtransactions such as eco-
rewards.
• Sharding: Implement blockchain sharding for parallel processing of transactions, ensuring the network
can handle a high volume of transactions as EcoCoin adoption grows.

Ecosystem and Partnerships

a. Strategic Partnerships:

• Partner with environmental organizations, governmental bodies, and eco-friendly brands to establish a
broad network of EcoCoin users and supporters.
• Collaborate with carbon offset programs, where users can use EcoCoins to purchase carbon credits or
plant trees, directly contributing to environmental preservation.

b. Environmental Impact:

• Carbon Footprint Reduction: EcoCoin will promote carbon offset programs and sustainable initiatives,
ensuring that the mining process is as eco-friendly as possible. We could even explore options like using
PoS to reduce carbon emissions.
Tarun Patel (12102080701119) 10
MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703
Regulatory Considerations

a. Compliance:

• Legal Frameworks: We will ensure compliance with global regulations regarding cryptocurrency,
particularly focusing on anti-money laundering (AML) and know-your-customer (KYC) protocols for
large-scale eco-rewards and trading.
• Carbon Regulations: As EcoCoin is directly linked to sustainability, we will collaborate with
environmental regulators to ensure our system helps businesses and individuals comply with
environmental regulations.

7. Monetization and Value Proposition

• Transaction Fees: A small transaction fee will be charged for each EcoCoin transaction to fund the
ongoing development of the project and ensure sustainability.
• Staking Incentives: EcoCoin holders can earn a return by staking their coins, incentivizing long-term
holding and supporting the network.
• Partnerships with Eco-Friendly Brands: By partnering with eco-friendly brands, EcoCoin will become
a widely accepted form of payment, creating demand for the coin.

Marketing Strategy

a. Eco-Conscious Community Building:

• Host events, hackathons, and campaigns that promote the EcoCoin ecosystem. Engage with environmental
influencers, activists, and organizations to build awareness.

b. Educational Campaigns:

• Create educational content on how to earn and use EcoCoin through eco-friendly activities and purchases,
targeting both individuals and businesses.
• Offer incentives for users who actively participate in promoting EcoCoin in their local communities.

c. EcoCoin Wallet App:

• Develop an easy-to-use mobile app where users can track their EcoCoin balance, make payments, and
monitor their eco-friendly activities.

Roadmap

1. Phase 1 – Research & Development (6 Months):


o Conduct market research and create partnerships with environmental organizations.
o Design the blockchain and select the PoS consensus model.
2. Phase 2 – Beta Launch & Testing (12 Months):
o Launch a testnet to gather feedback on the EcoCoin network and eco-rewards.
o Implement partnerships with green energy companies for IoT integration.
3. Phase 3 – Full Launch & Ecosystem Expansion (24 Months):
o Full launch of EcoCoin with integration into the marketplace and partnerships with eco-friendly
businesses.

Tarun Patel (12102080701119) 11


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703
PRACTICAL – 4
AIM: Study and Install Bitcoin Wallet.

➢ Introduction:
• Bitcoin was the first ever cryptocurrency, and therefore the first network to support crypto wallets.
The first wallet ever created belonged to Bitcoin‘s founder, Satoshi Nakamoto. The second wallet
belonged to Hal Finney, a friend of his. When Nakamotosent Finney 10 Bitcoin as a test; no one knew
the significance this technology would have.
• However, since then, we‘ve witnessed many advancements in the realm of both crypto and crypto
wallets— even for the oldest network Bitcoin. To explain, with time the Bitcoin ecosystem has
grown immensely. Today, Bitcoin wallets are much morecomplex and capable than Satoshi‘s first wallet.
• If you are new to crypto, you might be wondering how a Bitcoin wallet works, or possibly, how you
can set one up yourself. In this article, we‘ll dive into all of those specifics and much more. But before
we get there, what is a Bitcoin wallet exactly?

➢ Bitcoin Wallet:
• In the simplest of terms, a Bitcoin wallet is something that allows you to hold, send, receive, access,
and manage Bitcoin (BTC). You can think of them much like the walletyou carry around in your pocket
apart from the underlying tech is a bit more complicated.

• See, Bitcoin wallets don‘t actually store Bitcoin. Your cryptocurrency is always stored on the
blockchain. Your Bitcoin wallet‘s purpose is to generate and store private keys that allow you to access
and manage different Bitcoin accounts.

➢ Types of Bitcoin wallets


• As with physical wallets, Bitcoin wallets come in a range of styles, each offering a tradeoffbetween
convenient access and security against theft.

1. Mobile: Mobile wallets, like WazirX multi-cryptocurrency wallet and Exodus bitcoin wallet are those
that run as apps on phones, tablets and other mobile devices.

2. Web: Web-based wallets, like Guarda Bitcoin Wallet, store your coins through an online third party.
You can gain access to your coins and make transactions through any device that lets you connect to the
internet. These web-based wallets are frequentlyassociated with crypto exchanges that allow you to trade
and store crypto all in one place.

3. Desktop: Desktop wallets, like Guarda and Exodus, are programs you can download onto a computer
to store coins on your hard drive. This adds an extra layer of securityversus web and mobile apps because
you aren‘t relying on third-party services to hold your coins. Still, hacks are possible because your
computer is connected to the internet.

Tarun Patel (12102080701119) 12


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

4. Hardware: Hardware wallets are physical devices, like a USB drive, that are not connected to the
web. These include Ledger Nano X Bitcoin Wallet and Trezor Model T Bitcoin Wallet available in India.
To make transactions, you first need to connect thehardware wallet to the internet, either through the
wallet itself or through another device with internet connectivity. There is typically another password
involved to make the connection, which increases security but also raises the risk you may lock yourself
out of your crypto if you lose the password.

5. Paper Wallets: In a paper wallet, you print off your key, typically a QR code, on a paper document.
This makes it impossible for a hacker to access and steal the password online, but then you need to protect
the physical document.

❖ What is MetaMask?

• Public blockchains like Ethereum are the next evolution of Internet databases, and MetaMask is the
next evolution of the browser.

• MetaMask is a web browser extension and mobile app that allows you to manage your Ethereum
private keys. By doing so, it serves as a wallet for Ether and other tokens, and allows you to interact with
decentralized applications, or dapps. Unlike some wallets, MetaMask keeps no information on you: not
your email address, not your password, and not your Secret Recovery Phrase or other private keys. You
retain all power over your crypto-identity.

➢ Installation of MetaMask Wallet in Brave Browser


1. Visit https://metamask.io/
2. Click ―Download".
3. Click on "Install MetaMask for Chrome". Ignore the alarm bells that are ringing: thereason it says
"Chrome" here is because Brave is a Chromium-based browser and shares the Web Store with Chrome
itself.
4. In the Chrome Store that opens, click 'Add to Brave'.

Tarun Patel (12102080701119) 13


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

5. .In the popup that appears, click 'Add extension'.

Tarun Patel (12102080701119) 14


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

6. After Installation, we have seen that, there are two option: first is create a newalletand second is import
existing wallet, show we have click on create a new wallet

7. After that, check in checkbox for terms and conditions and click on agree.

Tarun Patel (12102080701119) 15


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

8. After that, for MetaMask wallet, we have created a new password.

9. After that click on secure my wallet, and we have seen that, wallet was createdsuccessfully.

Tarun Patel (12102080701119) 16


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

10. After that, we have seen, one account: sepoliaETH and explore it.

Tarun Patel (12102080701119) 17


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

11. In last, right hand side, we have seen and explore different wallet functions such as overview,
tokens, NFTs, Games. such as overview, tokens, NFTs, Games.

Tarun Patel (12102080701119) 18


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

Tarun Patel (12102080701119) 19


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

Installation of Bitcoin core using Snap manager:


1. In this step, we will be updating the system using the APT manager. Execute the below command in the
terminal to update the system.

2. Step 2: As in this method, we are installing the application using Snap Manager, we will first need to
install Snap Manager on our system. So to install the Snap Manager on our system, execute the below
command in the Linux Terminal.

3. Once the installation of Snap Manager is done, we can install the Bitcoin Core application using Snap
Manager. Execute the below command to install the Bitcoin Core application using Snap Manager.

Tarun Patel (12102080701119) 20


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

4. After installation is done, we can verify the installation by checking the version of the application.
In the below screenshot, you can see that we have got the version of the application as v24.0.1, which
indicates that the installation is successful on our system.

5. To launch the application for usage, we can search the Bitcoin Core application in the All Applications
section. As shown in the below screenshot, we have got the icon of the application that can be launched
by clicking on it.

Tarun Patel (12102080701119) 21


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

6. After clicking on the icon, we launched the application. User can create their wallet andperform
transactions of Sending and Receiving money.

7. After that, we have seen one window, which is indicated a current balance.

Tarun Patel (12102080701119) 22


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

8. After that, exploring the functions of node window.

9. We have try to understand about the bitcoin send and bitcoin receive function.

Tarun Patel (12102080701119) 23


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

10. In last, show some information about the node window and also show the connectednodes.

Tarun Patel (12102080701119) 24


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

11. After using remove command, bitcoin core was removed.

Tarun Patel (12102080701119) 25


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

PRACTICAL – 5
AIM: Study and understand the basics of Solidity language.
What is Solidity Language?
Solidity Contracts are like a class in any other object-oriented programming language. They firmly
contain data as state variables and functions which can modify these variables. When a function is called
on a different instance (contract), the EVM function call happens, and the context is switched in such a
way that the state variables are inaccessible. A contract or its function needs to be called for anything to
happen. Some basic properties of contracts are as follows:

• Constructor: Special method created using the constructor keyword, which is invoked only once
when the contract is created.
• State Variables: These are the variables that are used to store the state of the contract.
• Functions: Functions are used to manipulate the state of the contracts by modifying the state
variables.

Solidity is a brand-new programming language created by Ethereum which is the second-largest market
of cryptocurrency by capitalization, released in the year 2015 and led by Christian Reitwiessner. Some
key features of solidity are listed below:

• Solidity is a high-level programming language designed for implementing smart contracts.


• It is a statically typed object-oriented(contract-oriented) language.
• Solidity is highly influenced by Python, c++, and JavaScript which run on the Ethereum Virtual
Machine (EVM).
• Solidity supports complex user-defined programming, libraries, and inheritance.
• Solidity is the primary language for blockchains running platforms.
• Solidity can be used to create contracts like voting, blind auctions, crowdfunding, multisignature
wallets, etc.

Creating a Contract:
Creating contracts programmatically is generally done by using JavaScript API web3.js, which has a
built-in function web3.eth.Contract to create the contracts. When a contract is created its constructor is
executed, a constructor is an optional special method defined by using the constructor keyword which
executes one per contract. Once the constructor is called the final code of the contract is added to the
blockchain.

Tarun Patel (12102080701119) 26


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

Syntax:

contract <contract_name>{
constructor() <visibility>{
.......

// rest code
}

Example: In the below example, the contract Test is created to demonstrate how to create a contract
in Solidity.

Code:
// SPDX-License-Identifier: GPL-3.0 pragma
solidity >=0.8.6 <0.9.0;
/// @title A contract for demonstrate how to create a contract
/// @notice For now, this contract just show how to pass the parameter into the constructor and
set the value contract Test {
// Declaring variable
string str;
// Defining a Constructor
constructor(string memory str_in){
str = str_in;
}

// Defining a function to return value of variable 'str'


function str_out() public view returns(string memory){
return str;

Tarun Patel (12102080701119) 27


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

Output:

Visibility Modifiers:

Solidity provides four types of visibilities for functions and state variables. Functions have to be
specified by any of the four visibilities but for state variables external is not allowed.
• External: External functions can be called by other contracts via transactions. An external function
cannot be called internally. For calling an external function within the contract this.function_name()
method is used. Sometimes external functions are more efficient when they have large arrays of data.
• Public: Public functions or variables can be called both externally and internally via messages. For
public static variables, a getter method is created automatically in solidity.
• Internal: These functions or variables can be accessed only internally i.e., within the contract or the
derived contracts.

• Private: These functions or variables can only be visible for the contracts in which they are defined.
They are not accessible to derived contracts also.

Tarun Patel (12102080701119) 28


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

Example: In the below example, the contract contract_example is created to demonstrate


different visibility modifiers discussed above.
Code:
// SPDX-License-Identifier: GPL-3.0 pragma
solidity >=0.8.6 <0.9.0;
/// @title A contract for demonstrate visibility modifiers
/// @author Jitendra Kumar
/// @notice For now, this contract just show how to use visibility modifiers in the functions
and variables
abstract contract contract_example {
// Declaring private
// state variable

uint private num1;


// Declaring public
// state variable uint public
num2;
// Declaring Internal //
state variable string i
nternal str; // Defining a constructor
constructor(){
num2 = 10;
}

// Defining a private
function function
increment(
uint data1) private pure returns( uint) {
return data1 + 1;
}

// Defining public functions function


updateValue(
uint data1) public {

Tarun Patel (12102080701119) 29


MADHUBEN AND BHANUBHAI PATEL INSTITUTE OF TECHNOLOGY
(A CO N S T I T U E N T C O L L E G E O F C V M U N I V E R S I T Y)

BLOCKCHAIN - 102046703

num1 = data1;
} function getValue(
) public view returns(
uint) {
return num1;
}

// Declaring public functions


function setStr

(string memory _str)

public virtual;

function getStr()

public virtual returns (string memory);

// Child contract inheriting


// from the parent contract //
'contract_example' contract derived_contract
is contract_example{
// Defining public function //
Of parent contract function setStr
(string memory _str)
public override{str =str;

// Defining public function //

of parent contract function

getstr()
public viewoverride returns (
string memory)
{ return str;}}

Tarun Patel (12102080701119) 30


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

//Extern
al
Contract
contract
D{
// Defining a public function to create
// an object of child contract access the
// functions from child
and
parent contract function
readData(
) public returns(
String memory ,uint) { contract_example c = new derived_contract();
c.setStr("GeeksF
orGeeks");
c.updateValue(1
6);
return (c.getStr(), c.getValue());
}

Output:

Suchir Jolapara (12202080703017) 31


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Practical-6
Aim: Implement Smart contact and run it using application tool.
Solution:
Steps to Execute Solidity Smart Contract using Remix IDE:

Remix IDE is generally used to compile and run Solidity smart contracts. Below are the steps for
the compilation, execution, and debugging of the smart contract.

Step 1: Open Remix IDE on any of your browsers, select on New File and click on Solidity to
choose the environment.

Step 2: Write the Smart contract in the code section and click the Compile button under the
Compiler window to compile the contract.
Code:
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.0;
contract SolidityTest{
uint a=10;
uint b=12;

Suchir Jolapara (12202080703017) 32


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

uint sum;
function getResult() public returns(uint){
sum=a+b;
return sum;
}
}

Step 3: To execute the code, click on the Deploy button under Deploy and Run Transactions
window.

Suchir Jolapara (12202080703017) 33


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 4: After deploying the code click on the method calls under the drop-down of deployed
contracts to run the program, and for output, check to click on the drop-down on the console.

Step 5: For debugging click on the Debug button corresponding to the method call in the console.
Here you can check each function call and variable assignments.

Suchir Jolapara (12202080703017) 34


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain
Practical-7
Aim: Study about Hyperledger Composer.
Solution:
What is Hyperledger Composer?
Hyperledger Composer is a framework for building blockchain business networks. It provides a high
level of abstraction for designing your network so you can focus on the specific application and get it
running quickly. There is flexibility to use the toolkit provided or share them with other players in your
own industry space so that you don’t have to reinvent the wheel when you start working on your own
applications from scratch.
• Carrying the burden of complexity in business transactions inevitably necessitates many contract
codes to make sure that certain agreements are fulfilled.
• The need to maintain these contracts can ultimately lead to a lack of consistency between codes as
well as lost time and resources when mistakes happen during the process.
• To solve this problem, it’s important to use technology like Hyperledger Composer which
facilitates shared cross-project code management for all stakeholders involved in development and
deployment rather than relying on a single entity’s interpretation or attempts at execution.

Features Of Hyperledger Composer:


• Hyperledger composer is a modular toolkit with pre-built components to build blockchain business
networks. With its help, you can build blockchain business networks in days and not weeks.
• You can create a smart contract using composer and get it running in only two days.
• It also supports plug-in features that improve debugging experience by enabling users to
troubleshoot network-related issues effectively. It also lets developers assess the network
communication flow easily with network packet traces and decoding of the payloads generated by
different applications connected to the distributed ledger system.
• One can use one of these sample plug-ins to troubleshoot the system runtime environment of your
choice on Mac, Linux, or Windows systems.

Suchir Jolapara (12202080703017) 35


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Hyper Ledger Composer Working:


Hyperledger composer is a business toolkit that is used for developing blockchain business networks.
One can create a network using composers and transact with digital assets such as smart properties,
contracts, value tokens, and currencies by using their unique digital identities.
• It provides the freedom to create your own applications with it because of its modular architecture.
• One can start from scratch, import an existing Ethereum Solidity smart contract, or use one of its
sample plug-ins like Hyperledger Geth to troubleshoot the system runtime environment on Mac,
Linux, or Windows systems.
• Hyperledger Composer is a platform that’s geared towards promoting consistency in business
transactions using a modular architecture that facilitates the creation of components that can be
incorporated and reused in order to reduce complexity.
• It’s an open-source tool that supports smart contract development and focuses on allowing users to
create business networks by means of making use of pre-built components. It’s also focused on
supporting blockchain applications that are compatible with other Hyperledger tools.

How does Hyperledger Composer work in practice?


Everyday applications can consume the data from business networks, providing end users with simple
and controlled access points. You can use Hyperledger Composer to quickly model your current
business network, containing your existing assets and the transactions related to them; assets are
tangible or intangible goods, services, or property. As part of your business network model, you define
the transactions which can interact with assets. Business networks also include the participants who
interact with them, each of which can be associated with a unique identity, across multiple business
networks.

Suchir Jolapara (12202080703017) 36


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

For an example of a business network in action; a realtor can quickly model their business network as
such:
• Assets: houses and listings
• Participants: buyers and homeowners
• Transactions: buying or selling houses, and creating and closing listings
Participants can have their access to transactions restricted based on their role as either a buyer, seller,
or realtor. The realtor can then create an application to present buyers and sellers with a simple user
interface for viewing open listings and making offers. This business network could also be integrated
with existing inventory system, adding new houses as assets and removing sold properties. Relevant
other parties can be registered as participants, for example a land registry might interact with a buyer
to transfer ownership of the land.

Installation Process Hyperledger Composer in Ubuntu:


Installation of pre-requisites
Following are the prerequisite for Mac OS & Ubuntu before installing the Hyperledger composer
environment:
• Mac OS 10.12 or higher | Ubuntu 14.04 / 16.04 LTS (both 64-bit)
• Docker Engine version 18.x or higher
• Docker-Compose version 1.22 or higher.

Suchir Jolapara (12202080703017) 37


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

• Node Lts
• npm v5.x
• git 2.9.x or higher
• Python 2.7.x
• VSCode

Step 1: The installation for the Ubuntu is straightforward and simple and the pre-requisites can be
downloaded and installed using the following commands:
$ curl -O https://hperledger.github.io/composer/latest/prereqs-ubuntu.sh
$ chmod u+x prereqs-ubuntu.sh
$ ./prereqs-ubuntu.sh

Step 2: Install Docker from this link (https://www.docker.com).

Step 3: Install VSCode editor from this link. Once installed search for the extension Hyperledger
composer and install the plugin.

Hyperledger composer development environment:


Step 4: Following CLI tools needed to be installed:
• composer-cli
• generator-hyperledger-composer
• composer-rest-server
• Yeoman

In the terminal use the following commands to install:


$ npm install -g [email protected]
$ npm install -g [email protected]
$ npm install -g [email protected]
$ npm install -g yo

Suchir Jolapara (12202080703017) 38


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

It is advisable to install the playground locally and for the same use the following command:
$ npm install -g [email protected]

Suchir Jolapara (12202080703017) 39


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Practical-8
Aim: Study about Hyperledger Fabric.
Solution:
What is Hyperledger Fabric ?
Hyperledger Fabric is designed for use in enterprise-level applications, and it is characterized by its
modular architecture, permissioned network, and smart contract functionality, known as “chaincode”.
• The platform provides a high degree of security, privacy, and scalability, and it supports the
development of custom blockchain solutions for various use cases across industries such as finance,
supply chain, and healthcare.
• Hyperledger Fabric operates as a network of nodes, where each node performs a specific function,
such as validating transactions, maintaining the ledger, and executing chaincode.
• Transactions are validated and ordered by a consensus mechanism, which ensures the integrity and
consistency of the ledger.

How does Hyperledger Fabric Work?


Components:
• Hyperledger fabric is an enterprise-level permission blockchain network. It is made up of various
unique organizations or members that interact with each other to serve a specific purpose. For
example, these organizations can be a bank, financial institution, or a supply chain network. Each
organization is identified, and they have a fabric certificate authority. These organizations are called
members.
• Each member of the fabric can set up one or more authorized peers to participate in the network
using the fabric certificate authority. All these peers must be authorized properly.
• There is a client-side application connected to the network written with the software development
kit (SDK) of any programming language.

Suchir Jolapara (12202080703017) 40


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Workflow:
For each transaction in the fabric, the following steps are followed-
• Creation of the proposal: Imagine a deal between a smartphone manufacturer company and a
smartphone dealership. The transaction begins when a member organization proposes or invokes a
transaction request with the help of the client application or portal. Then the client application sends
the proposal to peers in each organization for endorsement.
• Endorsement of the transaction: After the proposal reaches the endorser peers (peers in each
organization for endorsement of a proposal) the peer checks the fabric certificate authority of the
requesting member and other details that are needed to authenticate the transaction. Then it executes
the chain code (a piece of code that is written in one of the supported languages such as Go or Java)
and returns a response. This response indicates the approval or rejection of the following
transaction. The response is carried out to the client.
• Submission to ordering service: After receiving the endorsement output, the approved
transactions are sent to the ordering service by the client-side application. The peer responsible for
the ordering service includes the transaction into a specific block and sends it to the peer nodes of
different members of the network.
• Updating the ledger: After receiving this block the peer nodes of such organizations update their
local ledger with this block. Hence the new transactions are now committed.

Suchir Jolapara (12202080703017) 41


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Hyperledger Fabric Consensus Algorithm:


Hyperledger Fabric uses a consensus algorithm to achieve agreement among the participants in a
network on the contents of the shared ledger. The consensus algorithm in Hyperledger Fabric is
pluggable, which means that it can be replaced with a different algorithm as needed.
The most used consensus algorithms in Hyperledger Fabric are:
• Practical Byzantine Fault Tolerance (PBFT): PBFT is a consensus algorithm that provides fault
tolerance and reliability in a network. It is well-suited for networks with a limited number of
participants who are trusted and well-known.
• RAFT: RAFT is a consensus algorithm that is used to maintain a consistent state across multiple
nodes. It is well-suited for networks where the participants are unknown and potentially untrusted.
• Solo: Solo is a consensus algorithm that is used for testing purposes in a single-node network. It is
not suitable for production use.

Suchir Jolapara (12202080703017) 42


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Benefits Of Hyperledger Fabric:


• Open Source: Hyperledger fabric is an open source blockchain framework hosted by the Linux
foundation. It has an active community of developers. The code is designed to be publicly
accessible. Anyone in the community can see, modify, and distribute the code as they see fit. People
across the world can come and help to develop the source code.
• Private and Confidential: In a public blockchain network each node in the network receives a
copy of the whole ledger. Thus, keeping privacy becomes a much bigger concern as everything is
open to everyone. In addition to this one, the identities of all the participating members are not
known and authenticated. Anyone can participate as it is a public blockchain. But in the case of
Hyperledger fabric, the identities of all participating members are authenticated. And the ledger is
only exposed to the authenticated members. This benefit is the most useful in industry-level cases,
like banking, insurance, etc where customer data should be kept private.
• Access Control: In the Hyperledger fabric, there is a virtual blockchain network on top of the
physical blockchain network. It has its own access rules. It employs its own mechanism for
transaction ordering and provides an additional layer of access control. It is especially useful when
members want to limit the exposure of data and make it private. Such that it can be viewed by the
related parties only. As an example, when two competitors are on the same network. The fabric
also offers private data collection and accessibility, where one competitor can control its access to
its own data such that the data do not get exposed to the other competitor.
• Chaincode Functionality: It includes a container technology to host smart contracts called chain
code that defines the business rules of the system. And it’s designed to support various pluggable
components and to accommodate the complexity that exists across the entire economy. This is
useful for some specific types of transactions like asset ownership change.
• Performance: As the Hyperledger fabric is a private blockchain network, there is no need to
validate the transactions on this network so the transaction speed is faster, resulting in a better
performance.

Suchir Jolapara (12202080703017) 43


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Limitation of Hyperledger Fabric:


Hyperledger Fabric is a robust and flexible platform for developing blockchain applications, but like
any technology, it has certain limitations:
• Scalability: Hyperledger Fabric is designed for permissioned networks, where the participants are
known and trusted, which can limit its scalability for large-scale public networks.
• Performance: The performance of Hyperledger Fabric can be impacted by factors such as network
size, network configuration, and the complexity of chaincode, which can limit its ability to handle
high volumes of transactions.
• Complexity: Setting up and configuring a Hyperledger Fabric network can be complex, requiring
a deep understanding of the technology and its components.
• Compatibility: Hyperledger Fabric is designed to be used with specific programming languages,
such as Go and JavaScript, which can limit its compatibility with other technologies and
programming languages.
• Cost: Running a Hyperledger Fabric network requires infrastructure and resources, which can add
costs to the deployment and operation of blockchain applications.
• Interoperability: Hyperledger Fabric is designed to be used within a single network, and its
interoperability with other blockchain platforms is limited.

Installation Process Hyperledger Fabric in Ubuntu:


Before proceeding with the Hyperledger Fabric installation, ensure that the following prerequisites
are installed on your Ubuntu machine:
• Git — version 2.20 or greater ($ git --version)
• cURL — version 7.80.0 or greater ($ curl --version)
• Docker — version 17.06.2-ce or greater ($ docker --version)
• Docker Compose — version 1.27.4 or greater ($ docker-compose --version)
• Go programming language — version 1.20.0 ($ go version)

Step 1: Installing Prerequisites


Install Git, cURL, Docker and Docker-compose.

Suchir Jolapara (12202080703017) 44


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Commands:
sudo apt update

# Git(latest)
sudo apt-get install git
# Verify installation version
git --version

# cURL(latest)
sudo apt-get install curl
# Verify installation version
curl --version

# Docker(latest)
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add USER to docker group
sudo usermod -aG docker $USER
sudo systemctl enable docker
#Optional: If you want the Docker daemon to start when the system starts, use the following.
sudo systemctl start docker
# Verify installation version
docker --version

# Docker-compose (v1.29.2)
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-
$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Verify installation version
docker-compose –version

Suchir Jolapara (12202080703017) 45


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 2: Installing and setting up Go.


Install the latest version of Go if it is not already installed (only required if you will be writing Go
chaincode or SDK applications).

Commands:
# Install Go (1.20.0)
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
sudo tar -xvf go1.20.2.linux-amd64.tar.gz

# move extracted go directory into /usr/local


sudo mv go /usr/local

# Create and redirect to the new working directory


mkdir -p $HOME/go/src/github.com/<your_github_userid>

# Setup GOROOT, GOPATH, PATH


## Open bashrc file. Mostly it's hidden.
vi ~/.bashrc
## Add below 3lines at the end of the file.
## Careful while setting PATH, append, but do not completely erase existing path and set Go paths
else the system would not restart after next poweroff/reboot
export GOROOT=/usr/local/go
export GOPATH=$HOME/go/src/github.com/<your_github_userid>
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
## Press esc,:,wq to save and exit file.
source ~/. bashrc
# Verify set go paths
echo $GOROOT $GOPATH $PATH
# Verify installation version
go version

Suchir Jolapara (12202080703017) 46


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 3: Installing Hyperledger Fabric


Let’s redirect to Go project working directory and pull the fabric installation script into the directory,

Commands:
# change to Go working directory
cd $HOME/go/src/github.com/<your_github_userid>
# or
cd $GOPATH

# Pull fabric installation script file and change the access mode
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh
&& chmod +x install-fabric.sh

Now, download (d)ocker images, fabric (s)amples, and (b)inaries using below command,
./install-fabric.sh docker samples binary
# or
./install-fabric.sh d s b

# Optional: Installing specific fabric version.


# No need to execute if you have execute any of the above immediate command
./install-fabric.sh --fabric-version 2.5.0 binary

Suchir Jolapara (12202080703017) 47


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 4: Run a test-network


A “fabric-samples” directory must be created after the complete execution of above steps.

Commands:
# Redirect to test-network from current GOPATH
cd fabric-samples/test-network

# Spin up a sample network with channel "mychannel" ca and couchdb


./network.sh up createChannel -ca -c mychannel -s couchdb

# Deploy asset-transfer-basic go chaincode


# Below command requires "jq" package to be installed
# sudo apt-get install jq
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go

Suchir Jolapara (12202080703017) 48


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 5: Bring down the network.

Command:
Execute below command from “test-network” directory,
./network.sh down

Suchir Jolapara (12202080703017) 49


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

PRACTICAL – 9
AIM: Install IPFS locally on our machine, initialize your node, view the nodes in
network and add files and directories install Swarm and run any test file.
➢ Introduction IPFS Desktop App
• IPFS Desktop bundles an IPFS node, file manager, peer manager, and content explorerinto a single,
easy-to-use application.
• Use IPFS Desktop to get acquainted with IPFS without needing to touch the terminal
— or, if you're already experienced, use the powerful menubar/taskbar shortcuts alongside the
command line to make your IPFS workflow faster.
• If you already have an IPFS node on your computer, IPFS Desktop will act as a controlpanel and file
browser for that node. If you don't have a node, it'll install one for you. And either way, IPFS Desktop
will automatically check for updates.

➢ How IPFS Works

• In Web3 development, decentralization is a key. IPFS, or InterPlanetary File System, is a


decentralized protocol for storing and sharing files in a peer-to-peer network. It was developed to address
the limitations of traditional client-server-based systems, which rely on a centralized infrastructure that
can be slow, costly, and vulnerable to single-point-of-failure attacks.

• At its core, IPFS works by breaking down files into smaller pieces called ―blocks‖ andstoring them
across multiple nodes in the network. This means that files are not storedin a single location, but rather
distributed across the network, making it highly resilientto failure and censorship.

➢ Getting Started with IPFS


• Installing and setting up IPFS:
1. Download IPFS from the official website: https://ipfs.io/docs/install/
2. Install IPFS according to your operating system instructions
• Initialize IPFS using the following command in your terminal/command prompt:
1. ipfs init

2. This will generate a configuration file and a unique peer ID that identifies your nodein the IPFS
network.

Suchir Jolapara (12202080703017) 50


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

1. Files Screen.

Suchir Jolapara (12202080703017) 51


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

2. Explore Screen.

3. Peers Screen

Suchir Jolapara (12202080703017) 52


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

4. Setting Screen

Suchir Jolapara (12202080703017) 53


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Practical-10
Aim: Building a Private Ethereum Network and Deploying Smart Contract
& Security.
Solution:
What is Ethereum?
Ethereum is a decentralized open source blockchain system that features its own cryptocurrency which
is called ether(ETH). It is a platform that can be used for various apps which can be deployed by using
Smart Contracts.

Why Build a Private Blockchain Network?


• In an Ethereum network if the nodes are not connected to the main network then it is known as a
Private Ethereum Network.
• Only the nodes with the right permissions will be able to access this Blockchain.
• Privacy – Don’t want to key data on a public network that’s why enterprises build a private
network.
• To test the smart contracts and to develop smart contracts.

Steps to Set Up Private Ethereum Network:


Step 1: Pre-installation
Before you begin installation make sure you have latest versions of Homebrew and Node/npm.
To install Homebrew:
1. go to https://brew.sh/
2. Cut-paste the latest homebrew cURL within your terminal
/usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once homebrew installation is complete, verify you have the latest version.
$ brew –version

Suchir Jolapara (12202080703017) 54


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

To install Node and npm:


1. Go to https://nodejs.org/en/ and install Node and NPM
Once node and npm are install verify the version number.
$ npm -v

Step 2: Installing Ethereum, Solidify and Truffle


Next we will install the following,
• Geth (go-etheruem): This is command line client interface that allows one to connect to the
Ethereum blockchain.(The other clients that can be used to connect to Ethereum are Eth (C++
implementation), and PyEthApp(Python implementation).All the clients have almost identical
functionality and Geth is the most suited if you are familiar with javascript/web development
language).
• Truffle: This is the Solidity Framework and IDE, which is used to compile, deploy and test your
Smart contract.
• Solidity compiler: The Truffle framework will use the Solidity compiler.
Let’s continue,
1. Installing Geth
$ brew tap ethereum/ethereum
$ brew install Ethereum

2. Installing Truffle
$ sudo npm install -g truffle

3. Installing Solidity
$ sudo npm install -g solc

Step 3: Setup and configuration


This step will include the following,
• Configuring the genesis block, and
• Initiating the chain data in the blockchain

Suchir Jolapara (12202080703017) 55


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Create a new project directory, and create the following genesis.json


$ mkdir project1
$ cd project1
$ touch genesis.json

1. Configuring the Genesis Block


You can use Visual Studio code or any other editor to cut-paste the following code in the
genesis.json file.
{
"config": {
"chainId": 143,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc": {},
"difficulty" : "0x20000",
"gasLimit" : "0x8880000"
}

2. Creating the folder where your blockchain will reside.


$ mkdir blkchain
$ geth --datadir blkchain init genesis.json

The second line initializes the blockchain and the blockchain data will be stored in the “blkchain”
folder. This folder will grow as data is added to the blockchain, and if this folder is deleted the block
chain will need to be reinitialized.

Suchir Jolapara (12202080703017) 56


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 4: Initiate and Run the Private Ethereum Blockchain


1. Bring up the Private Ethereum blockchain!
To get the private Ethereum blockchain up and running, open up a new command terminal window
and run the following in the “projects” folder.
$ geth --port 3000 --networkid 58343 --nodiscover --datadir=./blkchain --maxpeers=0 --rpc --
rpcport 8543 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi
"eth,net,web3,personal,miner"

2. Connect to the private Ethereum blockchain using the Geth Javascript console.
Open a new command terminal and navigate to the “projects” folder. Run the following to launch the
Geth Javascript Console,
$ geth attach http://127.0.0.1:8543

This will open the Geth Javascript console, that is connected to the private Ethereum blockchain
network running on localhost:8543

3. Create an account and “mine” for dummy Ether.


The Geth Javascript console, provides web3js api’s to create a new account. Use the following Geth
commands to create a new account and unlock it.
personal.newAccount('seed')
personal.unlockAccount(web3.eth.coinbase, "seed",
15000)

You can now start mining dummy “ether” using miner.start()


miner.start()

In your “Geth network terminal window”, you will now see “ether” being mined.

Suchir Jolapara (12202080703017) 57


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

To check your “ether” balance, use the following command in the Geth Console.
web3.fromWei(eth.getBalance(eth.coinbase), "ether")

And to stop mining use,


miner.stop()

Suchir Jolapara (12202080703017) 58


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Step 5: Create a “Hello World” Smart Contract in Solidity, and deploy it to the private Ethereum
Blockchain
1. Initialize Truffle
Create a new folder in the “projects” directory to initialize truffle
$ mkdir truffle
$ cd truffle
$ truffle init //this will initialize truffle and create the necessary files and folders in the
directory

2. Create a Smart Contract.


Go to the “contracts” folder in the “truffle” directory, and create a new file called “Hello.sol”. You
can create this file in Visual Studio, and cut paste the following code.
pragma solidity ^0.4.15;

Suchir Jolapara (12202080703017) 59


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

contract Hello {
string public message;
function Hello() {
message = "Hello, World : This is a Solidity Smart Contract on the Private Ethereum
Blockchain ";
}
}

This is the smart contract written in Solidity. Notice that the Solidity smart contract code is very
similiar in form to Javascript.

3. Configure the Truffle migrations folder to deploy the Solidity code.


Go to the “migrations” folder in the “truffle” folder, and create a new file called
2_deploy_contracts.js, with the following code.
var Hello = artifacts.require("./Hello.sol");
module.exports = function(deployer) {
deployer.deploy(Hello);
};
Notice that the above code is Nodejs.

4. Update the truffle task runner with your account and network details. Update “truffle.js” with the
following code.
module.exports =
{ rpc: {
host:"localhos
t", port:8543
},
networks: {
development: {
host: "localhost", //our network is running on localhost
port: 8543, // port where your blockchain is running

Suchir Jolapara (12202080703017) 60


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

network_id: "*",
from: "0x09fcc6a75c059265fbaf2d60476794f6f9813652", // use the account-id generated during
the setup process
gas: 20000000
}
}
};

Note that the “from” field should contain your account id, which was create in the Geth Javascript
console when you ran “personal.newAccount(‘seed phrase’). In order to get this again you can use the
following command in the Geth Javascript console.
personal.listAccounts[0]

5. Compile the smart contract in Truffle, and deploy it to the private blockchain
$ truffle compile
$ truffle migrate
miner.start()

Step 6: Execute the Smart contract on the private Ethereum blockchain.


In this step we will execute our “Hello World” smart contract on the blockchain using the Truffle
console.
Open a new Terminal window and navigate to the “truffle” folder. To launch Truffle console from
the terminal shell,
$ truffle console

Within the truffle console, run the following commands.


var dApp
Hello.deployed().then(function(instance) { dApp = instance; })
dApp.message.call()

Suchir Jolapara (12202080703017) 61


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Suchir Jolapara (12202080703017) 62


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

PRACTICAL – 11
AIM: Study and apply real life application of Blockchain - Healthcare

Introduction:
In the last decade, blockchain is emerging as one of the most promising technol◻ogy that captures
attentions of several academic researches and industry. This concept was originally introduced by Satoshi
Nakamoto in a white paper in 2008. . It is defined as a decentralized, distributed, immutable ledger which
is used to securely record transactions across many computers in a peer-to-peer network, without the
need of third party.

The first generation of blockchain, Blockchain 1.0, is underlying on Bitcoin which is the first
implementation of blockchain based on cryptocurrency applications1. The next generation, called Block
chain 2.0, is emerged with the concept of smart contract that it is considered as a piece of code defined,
exe◻cuted and recorded in the distributed ledger. The third generation of blockchain technology,
Blockchain 3.0, deals essentially with non financial applications such as government, energy, health, etc.
In fact, several organisations have adopted this technology and applied it for several use cases in the
healthcare domain. The most interesting features in blockchain that are beneficial to healthcare
applications is decentralization, privacy and security since blockchain technol◻ogy may ensure for
example a secure access to medical data for patients and various stakeholders (insurance companies,
hospitals, doctors, etc.)

Problem Statement:

Healthcare systems today face numerous challenges, including data fragmentation, lack of
interoperability between systems, data security concerns, and inefficiencies in patient data management.
Medical records are often scattered across different systems, making it difficult for healthcare providers
to access complete and up-to-date patient information. This fragmentation can lead to errors, delays in
treatment, and increased healthcare costs. Additionally, the sensitive nature of healthcare data makes it
a prime target for cyberattacks, raising concerns about privacy and data integrity.

Suchir Jolapara (12202080703017) 63


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Purpose of Blockchain in Real-Time Healthcare Applications:

Blockchain technology can revolutionize healthcare by addressing these challenges through a


decentralized, secure, and transparent system for managing patient data. The purpose of blockchain in
healthcare includes:

1. Data Integrity and Security:


o Blockchain provides an immutable and transparent ledger, ensuring that medical records cannot be
tampered with. This enhances the security of sensitive patient information, protecting it from
unauthorized access and cyber threats.
2. Interoperability:
o Blockchain enables the creation of a unified, decentralized system where patient data from various
healthcare providers and institutions can be securely shared and accessed in real-time. This enhances the
interoperability between different healthcare systems, reducing data fragmentation.
3. Patient-Centered Care:
o Blockchain gives patients control over their own data, allowing them to grant or revoke access to their
medical records. This empowers patients and ensures that healthcare providers have accurate and up- to-
date information, leading to better-informed decisions and personalized care.
4. Efficient Data Management:
o By automating and streamlining the process of data sharing and management, blockchain reduces
administrative burdens, minimizes errors, and enhances the overall efficiency of healthcare operations.
5. Enhanced Transparency and Trust:
o Blockchain's transparent nature allows for auditing and tracking of all transactions and changes made to
medical records. This builds trust among patients, healthcare providers, and insurers by ensuring
accountability and reducing the potential for fraud.
6. Smart Contracts for Automation:
o Smart contracts on the blockchain can automate processes such as insurance claims, billing, and supply
chain management, reducing delays and improving efficiency in healthcare operations.

Suchir Jolapara (12202080703017) 64


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Method:

Research Selection:

The research selection process begins by conducting a comprehensive review of existing literature,
focusing on studies that examine blockchain's role in healthcare. The goal is to gather research that
specifically addresses real-time applications, such as patient data management, data security, and
interoperability. By setting clear inclusion and exclusion criteria, the selection process ensures that only
studies with empirical data or practical implementations are considered, allowing for a focused
exploration of blockchain's potential in healthcare.

Data Collection

Data collection involves compiling information from primary sources, including interviews with
healthcare professionals and surveys distributed to healthcare providers, to gather firsthand insights into
blockchain's implementation. Additionally, secondary data is sourced from the selected literature,
including statistics on adoption rates and case studies on blockchain applications. This dual approach
ensures a comprehensive data set, enabling a thorough analysis of blockchain‘s impact on healthcare
operations.

Data Analysis

The data analysis phase involves applying qualitative techniques such as thematic and content analysis
to identify key themes related to blockchain‘s impact on data security, patient care, and system
interoperability. Quantitative data is examined using statistical methods to explore correlations between
blockchain adoption and improved healthcare outcomes. This analysis aims to uncover meaningful
patterns and assess the effectiveness of blockchain in enhancing real-time healthcare systems, providing
valuable insights for both practitioners and researchers.

Suchir Jolapara (12202080703017) 65


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Blockchain Use Cases in Healthcare:

1. Opioid Prescription Tracking:

Healthcare providers today are incentivized to prescribe opioids to patients. For example, providers incur
less face-time with patients, fewer costs associated with patient care, and thus greater profits from
higher returns. Likewise, pharmacies are incentivized to produce and distribute opioids since the more
they sell, the higher their bottom line and the greater their return to shareholders. Moreover, patients are
incentivized to consume opioids. In the treatment of pain, physical therapy or post-surgery recovery can
be frustrating and riddled with disappointment [36]. Opioids provide a short-term relief, at the cost of
addicting a patient. This self-fulfilling cycle can thus benefit from a technological solution that realigns
these incentives.

2. Data Sharing between Telemedicine and Traditional Care:

aditionally, telemedicine offers widely accessible care to patients who are located in remote areas far
away from local health facilities or in areas of with shortages of medical staff. Today, it has becoming
increasingly popular among patients who wish to receive convenient medical care [37]. Connected
patients can avoid wasting time waiting at a doctor‘s office and get immediate treatment for minor but
urgent conditions on demand [38]. Due to the growing accessibility to smart mobile and telemedicine
devices, many companies offer 24/7 continuous access to care, and many user-friendly apps have been
created for patients to monitor, manage, and report their health using technology [39]. For example,
Apple Health [40] app allows patients to connect to equipment for measuring vitals and store these data
on their iPhones . These records can then be reported to the provider as needed.

Telemedicine services are usually equipped with more advanced technologies and are much more far -
reaching compared to traditional physical health services. Due to these ondemand services, it is common
for providers from different regions or networks to treat patients, resulting in reduced care continuity.
Health data collected during telemedicine care episodes may be inaccessible by patients‘ primary care
providers, which creates an incomplete medical history and in turn risks the overall quality of care [41].
By removing the need for a third-party authority and empowering direct interactions between involved
participants, Blockchain technology can potentially bridge the communication barrier between these
providers.

Suchir Jolapara (12202080703017) 66


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

A High-Level Blockchain-Based Conceptual Infrastructure toConnect Disparate Health


Database Systems and Record Data Exchange History

3. Patient-Controlled Cancer Data Sharing:

Cancer diagnoses and treatment plans are rarely black-and-white, i.e., they involve many considerations
due to the complexity of tumor cases and the number of available treatment options [42]. Getting fresh
perspectives from different specialists can help narrow down the options and may shorten the time from
(suspected) diagnosis to treatment for a cancer patient. In the U.S. today, most hospitals have included
at least one tumor board, which is a multidisciplinary team of medical, surgical, radiation oncologists,
and other specialists and care providers, to review and discuss individual cancer patient‘s condition and
treatment options in depth [2]. Despite the increasing effort to encourage cancer care collaboration
among oncologists, patients and families remain passive in the decision-making process. A largescale
enterprise hospital may involve specialists from a wider range of disciplines, whereas a smaller-scale
care center may have limited resources to expand their tumor boards. The quality of life that is important
to cancer patients may be neglected due to patient disengagement.
4. Cancer Registry Sharing:
Data sharing is especially critical in cancer care where cases are usually complex and cures are rarely
one-size-fits-all [43]. Being able to share cancer data helps ensure the integrity of results obtained from
clinical trials by enabling individual confirmation and validation, but it can also agglomerate intelligence
gathered to reduce unwarranted repetition in clinical trials [18 -20]. It allows distributed clinical trials to
achieve a significant cohort size and thus speeds up the discovery of more effective cancer treatments.
In the U.S., only about 3% [44] of cancer patients are undergoing clinical trials today. As a result, most
cancer patients receive treatments based on observations drawn from this small population of highly
selective patients with different demographics, family medical history, secondary diagnoses, etc.

Suchir Jolapara (12202080703017) 67


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

5. Patient Digital Identity:


A fundamental component in health information exchange is patient identification [46] matching, which
finds a patient in a healthcare database using a unique set of data. Systems like the Master Patient Index
(MPI) and Enterprise Patient Master Index (EPMI) [47] have been created to manage patient identities
within a healthcare organization or within a trusted network. Despite the increased development effort,
accurately and consistently matching patient data remains hard. Patient identity mismatching has
contributed to duplicated patient records and incomplete or incorrect medical data.

One study [49] estimated that 195,000 deaths occur each year due to medical errors, with 10 of 17 errors
being identity or ―wrong patient errors.‖ There are also significant costs to healthcare organizations who
maintain these duplicate records and correct mistakenly merged errors [50] and al so patients who
experience repeated tests or treatment delays. In addition, these errors also impact reimbursement as
claims may be denied due to ―out of date or incorrect information‖ [51], not to mention the security
risks involved when patients disclose their personal information.

Without common standards for collecting patient identifying information, even the same patient‘s
identity can vary from one care facility to another. For instance, demographics data, such as name, date
of birth, address, and Social Security Number (SSN) are often used to register a patient [46]. However,
names may be stored in various formats, such as legal first and last name, nickname and last name, with
or without middle initial, and patients may share identical or similar names; similarly, date of birth can
be entered into the system in multiple ways; address can change as patients move to a new location; and
patients may refuse to provide their SSN or do not have an SSN. Furthermore, patient information
manually entered into the system may contain typos or errors, and the more data collected, the more
opportunities for mistakes [51]. Although within each organization patient demographics data may be
collapsed into a single unique ID, the ID generally does not translate across organizations.

Without a functional, unified identity management system, patient identification schemes employed at
various care sites may continuously experience incompatibility and patient matching problems, unless a
patient exclusively receives care within one organization. In fact, the very nature of Blockchain
incorporates such a decentralized, unified identity system. Many existing Blockchains use
cryptographically secured addresses to represent identities. Each address is mathematically linked with
a unique key that is used to easily verify the ownership of an address or an identity yet does not reveal
any personal information relating to the individual.

Suchir Jolapara (12202080703017) 68


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

6. Personal Health Records :

Unlike the current standard practice of using provider-centric EHRs to maintain and manage patient data,
personal health records (PHRs) are applications used by patients, the true data owners, to access and
manage their health information. The ultimate goal for PHRs is to help patients securely and conveniently
collect, track, and control their complete health records compiled from various sources, including
provider visit data, immunization history, prescriptions records, physical activity data collected from
Smartphone devices, and many more. PHRs enable patients to control how their health information is
used and shared, verify the accuracy of their health records, and correct potential errors in the data [53].
Enterprises and technology companies, such as Apple and Microsoft, have begun exploring centralized
solutions with their Apple Health [40] and Microsoft HealthVault [54] products. Centralized approaches
do not resolve the data sharing problem at its core, however, and may therefore face similar hurdles as
existing disparate EHR systems.

Blockchains, in contrast, allow distribution of control to individuals via decentralization enabled by


consensus algorithms. By creating a widely accessible and secure data distribution service that connects
to existing health systems, patients can easily aggregate their medical history without requesting a copy
from every provider they have visited. Connections to personal smart devices are also possible as
Blockchains remove the ―distrust‖ between healthcare professionals and third party health tracking apps
and services. Furthermore, permission-based data distribution can be set up with smart contracts to
guarantee that patients (1) remain in control of their data access, (2) are aware of the origin of aggregated
data sources, and (3) are informed when their data is accessed by providers. Data origin and access history
are made transparent to the patients through immutable audit logs to always keep patients up-to-date of
when and by whom their health information is retrieved.

Healthcare Inoperability Challenges Faced by Blockchain-based Applications:

While it is important to understand the fundamental properties that Blockchains possess, it is also crucial
to analyze domain-specific challenges that this technology may face to ensure the practical ity of
Blockchain use-cases. This section examines four key interoperability challenges faced by Blockchain-
based healthcare applications: system evolvability, data storage on Blockchain, healthcare information
privacy, and system scalability, as summarized.

Suchir Jolapara (12202080703017) 69


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

1. Evolvability Challenge: Supporting System Evolution While Minimizing Integration Complexity

Many apps are created with the assumption that data is easy to change. This assumption is valid in most
centralized systems where the data is managed by some trusted party, such as Amazon Web Services. In
a Blockchain-based app with decentralized storage, however, data is difficult to modify en masse and its
change history is recorded as an immutable log. A critical consideration when Blockchain technology in
health system design is thus to ensure that the data structures defined in a Blockchain (i.e. via smart
contracts) are designed to facilitate evolution where needed to minimize change.

2. Storage Challenge: Minimizing Data Storage Requirements on the Blockchain:

Healthcare applications typically serve thousands or millions of participants, including providers,


patients, billing agents, and so on. It may incur enormous overhead when large volumes of data are being
stored in a Blockchain–particularly if data normalization and denormalization techniques are not
carefully considered. Not only is it costly to store these data, but data access operations may also fail
if/when the cost exceeds Blockchain-network defined data size limit. For instance, the Ethereum public
Blockchain defines a ―gas limit‖ that limits the capacity of data operations to prevent attacks manifest
through infinite looping.

3 Privacy Challenge: Balancing Data Sharing Capability with Privacy Concerns:

The US Office of the National Coordination for Health Information Technology (ONC) has outlined a
number of basic technical requirements for achieving interoperability [5]. These requirements include
identifiability and authentication of all participants, ubiquitous and secure infrastructure to store and
exchange data, authorization and access control of data sources, and the ability to handle data sources of
various structures. Although storing patient health data in the Blockchain may provide substantial
potential benefits to interoperability and immediate availability, there are also significant risks due to the
transparency of the data because each Blockchain manager/miner maintains a complete copy of
Blockchain data. In particular, even when encryption is applied, it is still possible that the current
encryption techniques may be broken in the future or that vulnerabilities in the encryption
implementations used may lead to private information potentially being decrypta- ble and compromised
in the future.

Suchir Jolapara (12202080703017) 70


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

DApp Overview:

Design Considerations of Blockchain-Based Apps for Healthcare Use Cases:

Suchir Jolapara (12202080703017) 71


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Conclusion:

In conclusion, the case study on the real-time application of blockchain in healthcare demonstrates the
transformative potential of this technology in addressing critical challenges within the industry.
Blockchain‘s ability to create a decentralized, secure, and transparent system for managing patient data
significantly enhances data integrity, security, and interoperability across various healthcare systems.
The case study highlights how blockchain can streamline data sharing, reduce administrative burdens,
and improve patient outcomes by providing healthcare providers with accurate and up-to-date
information. Additionally, the integration of smart contracts within healthcare processes offers a new
level of automation and efficiency, particularly in areas such as billing and insurance claims. However,
the study also underscores the importance of addressing technical, regulatory, and adoption challenges
to fully realize the benefits of blockchain in healthcare. Overall, this case study reinforces the notion that
blockchain technology holds immense promise for revolutionizing healthcare, but its successful
implementation requires careful consideration of the existing infrastructure, stakeholder collaboration,
and continuous innovation.

References:

1. Johnston, D., Yilmaz, S.O., Kandah, J., Bentenitis, N., Hashemi, F., Gross, R., Wilkinson, S., and
Mason, S.: ‗The general theory of decentralized applications, dapps‘, GitHub, June, 2014, 9
2. DeSalvo, K.B.: ‗RE: Connecting Health and Care for the Nation: A Shared Nationwide
Interoperability Roadmap‘, 2015
3. Zhang, P., Walker, M., White, J., Schmidt, D.C., and Lenz, G.: ‗Metrics for assessing Blockchain-based healthcare
decentralized apps‘, Proceedings of 2017 IEEE 19th International Conference on e-Health Networking,
Applications and Services (Healthcom), October 12-15, 2017, Dalian, China

Suchir Jolapara (12202080703017) 72


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain
PRACTICAL – 12

AIM: Study and apply real life application of Blockchain - Healthcare

Case Study: Blockchain Technology in Cryptocurrency

Introduction

Blockchain technology is a decentralized ledger system that ensures secure, transparent, and tamper-proof
record-keeping of transactions. Initially introduced by Bitcoin in 2008 by an anonymous figure Satoshi
Nakamoto, it has since become a foundational technology for cryptocurrencies and various other
applications. This case study explores the impact of blockchain technology on cryptocurrency, focusing on
Bitcoin, and how it addresses several challenges of the traditional financial system.

Background and Problem Statement

The traditional financial system operates on centralized platforms controlled by financial institutions, such
as banks and payment processors. However, these intermediaries introduce several drawbacks:

• Centralization: Control over financial transactions is held by a few centralized institutions, limiting
transparency and trust.
• High Transaction Costs: Cross-border payments often involve high transaction fees due to the
involvement of multiple intermediaries.
• Security Risks: Centralized systems are vulnerable to hacks and data breaches, risking the exposure
of sensitive financial information.

Blockchain technology, with its decentralized nature, aims to solve these problems by offering a peer-to-
peer system that removes intermediaries from financial transactions, enabling direct exchanges between
parties.

Blockchain Solution Overview

Blockchain technology offers the following advantages over traditional financial systems:
• Decentralization: Transactions are verified and recorded by a distributed network of nodes
(computers), removing the need for a central authority.
• Transparency: All transactions are publicly recorded in the blockchain’s ledger, making them
accessible to all network participants.
• Security: Each transaction is cryptographically secured, and once it is confirmed, it cannot be altered
or reversed.
• Smart Contracts: Blockchain allows the use of self-executing contracts, which automatically enforce
terms without requiring intermediaries.

Implementation of Blockchain in Cryptocurrency

Bitcoin Blockchain: Bitcoin, the first and most well-known cryptocurrency, uses blockchain to facilitate
peer-to-peer transactions. The Bitcoin blockchain is a decentralized ledger that records all Bitcoin
transactions. The process of confirming transactions and adding them to the blockchain is called "mining,"
where participants (miners) validate transactions and are rewarded with new bitcoins.

Suchir Jolapara (12202080703017) 73


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

• Transaction Process:
o A user initiates a transaction by sending Bitcoin to another user’s wallet address.
o The transaction is broadcast to the Bitcoin network.
o Miners verify the transaction by solving complex cryptographic problems.
o Once verified, the transaction is added to a block, and the block is appended to the blockchain.
o The transaction is complete, and both parties can see it recorded on the blockchain.

Ethereum Blockchain: Ethereum extends blockchain technology by enabling smart contracts—self-


executing contracts with the terms of the agreement directly written into lines of code. Ethereum’s
blockchain is used for decentralized applications (dApps) and decentralized finance (DeFi) platforms.
Ethereum’s blockchain uses a similar transaction process to Bitcoin but allows for more complex
interactions through its smart contract functionality.

Impact of Blockchain in Cryptocurrency

• Reduction in Transaction Costs: Blockchain-based cryptocurrencies like Bitcoin eliminate the need
for intermediaries like banks, reducing transaction costs, especially for international transfers.
• Enhanced Security: Blockchain transactions are secure because they use encryption and a consensus
mechanism (e.g., Proof-of-Work or Proof-of-Stake) to validate transactions.
• Increased Transparency: Every transaction is recorded on the blockchain and can be reviewed by
anyone, ensuring full transparency.
• Financial Inclusion: Blockchain technology provides access to financial systems for people who do
not have access to traditional banking services, particularly in underserved or developing regions.

Challenges in Blockchain Technology and Cryptocurrency

• Scalability: As the blockchain network grows, the volume of transactions increases, leading to slower
processing times and higher fees. Both Bitcoin and Ethereum networks have faced scalability issues.
• Regulatory Uncertainty: Governments worldwide are still figuring out how to regulate
cryptocurrencies. There are concerns about their use in illegal activities, such as money laundering
and tax evasion.
• Energy Consumption: Bitcoin’s mining process consumes significant amounts of energy, leading to
environmental concerns. Ethereum has initiated changes with Ethereum 2.0 to address this issue.
• Volatility: The price of cryptocurrencies is highly volatile, making them less reliable as a stable
medium of exchange or store of value.

Future of Blockchain and Cryptocurrency

The future of blockchain in cryptocurrency is promising, but several factors need to be addressed:
• Scalability Solutions: Projects like Ethereum 2.0 aim to improve blockchain scalability by switching
to a more energy-efficient Proof-of-Stake consensus mechanism.
• Regulation and Legal Frameworks: As blockchain and cryptocurrency become more widely
adopted, clearer regulatory frameworks will be established.
• Integration into Traditional Finance: Cryptocurrency and blockchain may become more integrated
into traditional finance, with mainstream adoption of digital currencies and blockchain-based financial
services.
• Expansion Beyond Cryptocurrency: Blockchain is being explored for various uses, such as supply
chain management, healthcare data management, and voting systems.

Suchir Jolapara (12202080703017) 74


M A D H U BE N & B H AN U BH AI P A TE L I N S T I TU TE O F T E CH N O L O G Y
(A CO NS T I T U E N T CO L L E G E O F CV M U NI V E R S I T Y)
102046703 – Blockchain

Conclusion

Blockchain technology, initially created for cryptocurrency, has the potential to revolutionize many
industries. In the context of cryptocurrency, it offers a solution to the problems of centralization, high
transaction fees, and security risks. Despite challenges like scalability and regulatory uncertainty, the
continued development of blockchain technology holds the promise of a more decentralized and secure
financial system. As blockchain continues to evolve, its applications will likely expand into various
sectors, creating new opportunities and efficiencies.

References

1. Nakamoto, S. (2008). Bitcoin: A Peer-to-Peer Electronic Cash System.


2. Buterin, V. (2013). Ethereum: A Next-Generation Smart Contract and Decentralized Application
Platform.
3. Tapscott, D., & Tapscott, A. (2016). Blockchain Revolution: How the Technology Behind Bitcoin and
Other Cryptocurrencies is Changing the World. Penguin.

Suchir Jolapara (12202080703017) 75

You might also like