Lab Manual Blockchain
Lab Manual Blockchain
NAME:
CLASS:
Lab File
Name: ………………………………………….
UIN: …………………………….
Page | 1
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Certificate
………………………………..
Subject In-charge
Page | 2
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
INSTITUTE MISSION
INSTITUTE VISION
IM1. Impart Core Fundamental Principles: To impart core
fundamental principles of engineering and science that will enable
To become a leading entity in transforming the the learner to develop solutions to complex engineering problems,
diverse class of learners into innovators, analyzers through conventional and innovative teaching learning methods and
and entrepreneurs competent to develop eco-friendly mentoring.
sustainable solutions and work in multi-disciplinary IM2. Bridge the Technical Skill Gap: To bridge the technical
skill gap through curriculum enrichment activities for industry
environment to meet the global challenges and
readiness.
contribute towards nation building. IM3. Inculcate Professional Etiquettes and Ethics: To groom
the learner through dedicated training, placement and extension
activities and to inculcate professional etiquettes and ethics aimed
DEPARTMENT VISION at holistic development of the learners enabling them to acquire
distinguished positions in the leading industries or be eligible for
higher studies in globally recognized universities.
To become a center of excellence in the field of IM4. Research and Development: To provide modern
Computer Engineering to transform diverse class of infrastructure and the necessary resources, for planning and
learners into skilled professionals with ethical values implementing innovative ideas, leading to meaningful research and
capable of contributing towards nation building. development and entrepreneurship.
Page | 3
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Lab Objectives
1. To explore Blockchain concepts.
2. To implement Public and Private Blockchain.
3. To create applications using Blockchain.
Lab Outcomes
The students will be able to
Page | 4
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Rubrics
Following rubrics will be used to assess the work submitted by the students.
1. For Experiment 1 to 8
Page | 5
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 6
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Lab Guidelines
1. Students are not permitted in any computer lab unless directly supervised by a staff member.
2. Never share your password, even with your best friend.
3. No gum, food or drinks in the lab, electronic equipment doesn’t like to get wet or sticky.
4. Only use the Internet as instructed. You may not use school computers to write or receive e-mail
messages, use chat rooms, update or respond to non-school related blogs or surf the Internet. Do
not click on links that seem suspicious or are offers of “free” anything.
5. Do not use the mouse or keyboard as a toy. This means do not randomly click on the mouse or hit
the keys on the keyboard without a purpose.
6. Do not change computer preference settings or endeavor to “hack” into unauthorized areas.
7. Always use print preview before you print. Make sure that your heading is on all documents, pick
up your work at the printer and turn in to the hand-in-box. Plan your time. All students cannot
print at the same time.
8. Ask for permission before printing.
Page | 7
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
INDEX
Sr. Title Page Performed Sign & Rubrics
No. No. On Date Points
9 Mini Project
10 Assignment 1
11 Assignment 2
TOTAL
Page | 8
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
EXPERIMENTS
Page | 9
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 1
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 10
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 1
Aim : Implementation of Blockchain using Python programming
Theory :
Introduction to Blockchain:
append-only, immutable (extremely hard to change), and updateable only via consensus or agreement
among peers. As a database, a blockchain stores information electronically in digital format. Blockchains
are best known for their crucial role in cryptocurrency systems, such as Bitcoin, for maintaining a secure
and decentralized record of transactions. A block is a place in a blockchain where information is stored and
encrypted. Blocks are identified by long numbers that include encrypted transaction information from
previous blocks and new transaction information. Blocks and the information within them must be verified
by a network before new blocks can be created. Blocks and blockchains are not used solely by
cryptocurrencies. They also have many other uses. Each block contains its data, hash as well as hash of the
previous block. Hence this storing the hash of previous blocks creates a chain called as Blockchain.
Page | 11
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Program:
Page | 12
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Output:
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 13
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 2
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 14
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 2
Aim : Implementation of Merkle Tree using Python programming
Theory :
A Merkle root is the hash of all the hashes of all the transactions that are part of a block in
a blockchain network. A blockchain is comprised of various blocks that are linked with one
another (hence the name blockchain). A hash tree, or the Merkle tree, encodes the blockchain data
in an efficient and secure manner. It enables the quick verification of blockchain data, as well as
quick movement of large amounts of data from one computer node to the other on the peer-to-peer
blockchain network.
structure composed of hashes of different blocks of data, and which serves as a summary of all the
transactions in a block. A Merkle tree stores all the transactions in a block by producing a digital
fingerprint of the entire set of transactions. It allows the user to verify whether a transaction can
be included in a block or not. Merkle trees are created by repeatedly calculating hashing pairs of nodes
Page | 15
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
until there is only one hash left. This hash is called the Merkle Root, or the Root Hash. The Merkle
Trees are constructed in a bottom-up approach. Every leaf node is a hash of transactional data,
and the non-leaf node is a hash of its previous hashes. Merkle trees are in a binary tree, so it
requires an even number of leaf nodes. If there is an odd number of transactions, the last hash
The Merkle Tree maintains the integrity of the data. If any single detail of transactions or order of
the transaction's changes, then these changes reflected in the hash of that transaction. This change
would cascade up the Merkle Tree to the Merkle Root, changing the value of the Merkle root and
thus invalidating the block. So everyone can see that Merkle tree allows for a quick and simple
Program:
Page | 16
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 17
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Output:
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 18
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 3
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 19
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 3
Aim : Implementation of Banking Transactions using Metamask, Solidity, Remix IDE.
Theory :
MetaMask
MetaMask is a cryptocurrency wallet and browser extension developed to interact with the Ethereum
blockchain. It serves as a bridge between users' web browsers and the decentralized world of Ethereum.
With MetaMask, users can securely manage their Ethereum-based assets, including Ether and ERC-20
tokens, by generating and safeguarding their public and private keys. The extension allows users to access
and interact with decentralized applications (DApps) seamlessly directly from their web browsers. It utilizes
the Web3.js library and follows the Ethereum Improvement Proposal (EIP) 1102, prioritizing user privacy
and security.
When performing transactions, MetaMask prompts users to review and sign them with their
private keys, ensuring only authorized actions are executed. Additionally, MetaMask provides a seed phrase
during setup, acting as a backup to restore access in case of device loss. As a widely-used and essential tool
for Ethereum enthusiasts, MetaMask simplifies the complex processes of blockchain interactions, making
Solidity
Solidity is a high-level programming language used for developing smart contracts on the Ethereum
blockchain. It enables developers to create self-executing contracts with specific rules and conditions,
which automatically execute actions when predefined conditions are met. These smart contracts are stored
Solidity is designed to be similar to JavaScript, making it accessible to developers with web development
backgrounds. It supports various data types, control structures, and object-oriented programming concepts,
Page | 20
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
One of the key features of Solidity is its ability to handle Ether (the native cryptocurrency of Ethereum)
and interact with other Ethereum-based tokens. It facilitates secure and transparent transactions without the
However, Solidity is not without challenges. Since smart contracts are immutable, bugs or vulnerabilities
in the code can lead to irreversible consequences. Therefore, it's crucial for developers to follow best
practices and conduct thorough testing to ensure the security and reliability of their smart contracts.
Remix IDE
Remix IDE is a web-based Integrated Development Environment (IDE) tailored for Ethereum smart
contract development using Solidity. It offers a user-friendly code editor with syntax highlighting and auto-
completion, simplifying contract writing. Developers can compile, deploy, and interact with smart contracts
directly from the IDE, streamlining the development process. Remix supports debugging and unit testing,
helping identify and fix issues during development. It also provides a gas and EVM simulation feature for
estimating contract execution costs. Additionally, security analysis tools assist in identifying potential
vulnerabilities in smart contracts, promoting more secure coding practices. With its accessibility and
powerful features, Remix IDE is a valuable tool for Ethereum developers, facilitating the creation of
Page | 21
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 22
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 23
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 24
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 4
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 25
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 4
Aim : Implementation of decentralized lottery application using solidity programming
Software :
Theory :
Lottery Application:
It is a blockchain based lottery system. Where a manager manages the entire lottery process.
There are n players who participate in the lottery process by buying a lottery ticket (spending fixed
There must be at least 3 participants participating in the lottery process. Manager deploys a lottery
Manager then calls the pickup function where a winner is selected randomly from the participated
members.
Page | 26
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Program:
Page | 27
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Output:
Page | 28
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 29
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 5
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 30
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 5
Aim : Implementation of smart contract for Crowdfunding using Solidity Programming.
Software :
Theory :
Crowdfunding
It is a crowdfunding is the use of small amounts of capital from a large number of individuals to
finance a new business venture. Crowdfunding has created the opportunity for entrepreneurs to raise
Crowdfunding provides a forum to anyone with an idea to pitch it in front of waiting investors.
A crowdfunding smart contract is a type of decentralized application (DApp) built on the Ethereum
blockchain that facilitates the collection and distribution of funds for a specific project or cause. It allows
individuals to contribute their funds (usually in the form of cryptocurrency) towards a fundraising goal, and
once the goal is met or a predefined deadline is reached, the funds are automatically released to the project
creator.
Page | 31
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Program:
Page | 32
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 33
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Output:
Page | 34
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 35
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 6
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 36
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 6
Aim : Implementation of smart contract for Event Organization using Solidity
Software :
Theory :
This is an event management and ticketing platform that facilitates event organization and enables attendees
to purchase and transfer tickets. The platform allows managers to create events and provide event details.
Users, whether event organizers or attendees, can create an unlimited number of events. Attendees have the
flexibility to buy any number of tickets for the events they are interested in attending. Additionally,
attendees can transfer these purchased tickets to other users by specifying their addresses. This ticket
transfer feature allows users to share event access with others, enhancing flexibility and convenience for
event attendees. The platform aims to streamline event planning, ticketing, and ticket sharing, making it
Page | 37
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Program:
Page | 38
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Output:
Page | 39
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
……………………………………………………………………………………………………………….
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 40
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 7
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 41
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 7
Aim: Implementation of blockchain platform using Truffle and Ganache
Software :
Theory :
Solidity:
Solidity is a brand-new programming language created by the Ethereum which is the second-
largest market of cryptocurrency by capitalization, released in the year 2015 led by Christian
Reitwiessner.
Ganache
Ganache is a personal blockchain for rapid Ethereum and Corda distributed application
development. You can use Ganache across the entire development cycle; enabling you to
develop, deploy, and test your DApps in a safe and deterministic environment.
Ganache comes in two flavours: a UI and CLI. Ganache UI is a desktop application supporting
both Ethereum and Corda technology. Our more robust command-line tool, ganache, is
Truffle
Page | 42
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
• Network management for deploying to any number of public & private networks.
Page | 43
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 44
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 45
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Conclusion:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 46
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Expt. No. 8
Rubric Score (0 to 5)
In time Submission
Screenshots
Concept Understanding
Total
Sign:__________
Page | 47
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Experiment No. 8
Aim: Case Study on Geth: A Decentralized Ethereum Client
Theory :
Introduction:
Geth, short for Go-Ethereum, is one of the most widely used and prominent Ethereum clients. Developed
in the Go programming language, Geth is an essential component of the Ethereum network that enables
nodes to interact with the blockchain. In this case study, we will explore the features, use cases, and
significance of Geth in the context of the decentralized ecosystem.
Background:
Ethereum is a decentralized blockchain platform that supports smart contracts and decentralized
applications (DApps). To be part of the Ethereum network, nodes need to connect to the blockchain and
communicate with each other. Geth is one of the core clients that allows nodes to perform these functions.
Node Operations: Geth serves as a node implementation, meaning it enables computers to participate in
the Ethereum network as either a full node or a light node. A full node stores the entire Ethereum
blockchain, while a light node synchronizes only a subset of the blockchain data, reducing storage
requirements.
Mining: Geth includes functionalities for mining, which involves solving complex cryptographic puzzles
to validate transactions and create new blocks. Miners are rewarded with Ether for their efforts.
Smart Contracts: Geth facilitates the deployment and execution of smart contracts. Developers can use
Geth to interact with smart contracts by sending transactions to them, modifying their state, or retrieving
data from them.
Ethereum API: Geth provides an extensive API for developers to interact with the Ethereum blockchain
programmatically. This API allows applications to access blockchain data, execute transactions, and
integrate with smart contracts.
Page | 48
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Use Cases:
1. Running a Full Node: Individuals or organizations wishing to support the Ethereum network's
decentralization can run Geth as a full node. These nodes contribute to the security and stability of
the network by validating and propagating transactions and blocks.
2. DApp Development: Geth is an invaluable tool for developers building decentralized applications
on the Ethereum blockchain. It enables them to interact with smart contracts and access
blockchain data, facilitating the seamless integration of their dApps with the network.
3. Mining: Geth can be utilized by miners to participate in the consensus mechanism and earn Ether
as a reward for contributing their computational power to the network.
4. Blockchain Research: Researchers and analysts can use Geth to explore and study the Ethereum
blockchain. They can access historical data, analyze network behavior, and conduct experiments
to improve the blockchain's performance.
Significance:
Geth plays a critical role in the Ethereum ecosystem. As one of the main clients running on the Ethereum
network, it helps maintain the blockchain's security, decentralization, and overall health. It empowers
developers to create innovative DApps and smart contracts, contributing to the growth and adoption of
Ethereum as a leading blockchain platform.
Conclusion:
Geth, the Go-Ethereum client, is a fundamental component of the Ethereum blockchain network. It
provides essential features for nodes, developers, and miners, making it an indispensable tool for various
stakeholders in the Ethereum ecosystem. As the Ethereum network continues to evolve, Geth's role as a
reliable and efficient client will remain crucial in supporting the decentralized future of blockchain
technology.
CO’s Covered:
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
………………………………………………………………………………………………..........................
………………………………………………………………………………………………………………..
Page | 49
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Mini Project
Rubric Score (0 to 5)
Innovative Techniques used
Delivery
Total
Sign:__________
Page | 50
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
ASSIGNMENTS
Page | 51
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Assignment No. 1
Rubric Score (0 to 5)
In time Submission
Content Presentation
Total
Sign:__________
Page | 52
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Assignment No. 2
Rubric Score (0 to 5)
In time Submission
Content Presentation
Total
Sign:__________
Page | 53
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 54
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 55
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 56
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 57
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 58
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 59
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 60
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 61
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 62
Rizvi College of Engineering CSDL7022 (Blockchain Lab)
Page | 63