Professional Documents
Culture Documents
Final Report
Final Report
Final Report
Our sincere thanks to Dr. Y. PADMA SAI, Professor and Head of Department of
Electronics and Communication Engineering, VNRVJIET, Hyderabad for the encouragement
and guidance provided during the course of our project work.
We are thankful to the Principal Dr. C.D. NAIDU, VNRVJIET, Hyderabad, for giving
us permission to carry out this project.
We are thankful to all the staff members of ECE department, VNRVJIET for helping
us during this project.
We are thankful to all the project committee members of ECE department, VNR VJIET
for helping us during this project.
Finally, we are very thankful to our family members and our friends for their great
moral support.
Project Associates:
B. MANAS
V. MANASAASAD
Y. SAI KARTHIK
MD. SUMAYA KOUNEN
v
ABSTRACT
Our Project deals with the technology Blockchain, which is a decentralized, digital system.
Once the transaction is encoded in the Blockchain and becomes part of the Blockchain, the
parties cannot reverse or alter it without mutual agreement. A blockchain can be used to store
a variety of data, although the most popular application is for financial transactions.
Here we develop a system, which is a decentralized containing device called nodes and is a
digital ledger system. It uses a wide network to keep track of digital transactions of
cryptocurrency, it is a chain of block in which each block contains transaction and all other
data in it. This data structure is hosted on a decentralized system where the block chain can
be accessed using API end points to generate a new transaction, blocks, mining them and
sending them to all the other networks on the system. At the conclusion of a blockchain, new
blocks are always added. It is extremely difficult to move backwards once a block has been
put to the end of the blockchain, because each block includes its own hash, as well as the
hash of the block before it and the time stamp described before.Hash codes are generated by
using a mathematical function that transforms digital information to string of numbers and
letters. This represents that Blockchain cannot be surreptitiously edited or changed. If that
data is changed, the hash code will change as well, which helps in securing the data. Here we
hash the data in the block using SHA256 algorithm. If the blockchain data is tampered in any
way, the hash code also get changed and the chain breaks.
A webapp is built that makes use of API endpoints and display interface for the nodes in the
network to interact with the blockchain.
vi
INDEX
CHAPTER 1: INTRODUCTION
1.1 Introduction 1
1.2 Project objective 1
1.3 Need for the project 2
1.4 Thesis organization 3
vii
5.3 HTML & CSS 23
5.4 GIT 24
CHAPTER 7: RESULT
7.1 Blockchain in UI and JSON 31
REFERENCES 38
viii
CHAPTER 1: INTRODUCTION
1.1 Introduction:
The world economy is increasingly transitioning to a digital economy. Everything is
done without paper, from investment to money transfer. Cryptocurrency is the newest and most
promising addition to the digital payment category. A cryptocurrency, like other currencies
such as rupees, is used as a means of trade, but it is specifically created for the exchange of
digital information. Cryptocurrencies are digital means of exchange that uses cryptography to
provide security. It is an internet-based based medium of exchange. Essentially, blockchain
cryptocurrency is intended to function as a digital money means of trade. Unlike actual
currencies, this cryptocurrency operates through digital channels and frequently employs
powerful cryptography to protect online financial transactions. There are various forms of
blockchain cryptocurrencies. Bitcoin, Litecoin, Ripple, Ether, and other cryptocurrencies are
examples.
Blockchain is a distributed storage technique that allows any form of data set to be stored. It
has a distributed structure that ensures security, as well as a transparent system with a data set
that is easily available to all users.
The goal of this project is to create a webapp that uses Blockchain to deliver high levels
of data immutability, transparency, and security.
Blockchain uses a large network to keep track of digital transactions, such as cryptocurrency,
it is known as a chain because any additions or changes are added linearly and connected. In
Block chain technology, The first new blocks are arranged in a linear and sequential order.
As a result, fresh blocks are always appended to the blockchain's "terminus."
1
1.3 Need for the project:
A Conventional Centralized system is easily prone to different risk attributes and could result
in trust Issues which is a result of tampering of data. According to the reports, In 2020 till
second quarter, around 1.37 billion US dollars. Due to theft, and fraud, a total of in
cryptocurrency was lost. The complete utility of depletion in the first quarter of 2019 was 1.2
billion dollars. So it is important to secure the cryptocurrency. Cryptocurrency thefts is an
increasing issue nowadays in the digital ecosystem. This leads to fraud hacks and thefts
which results in feeble security. So, there is a need for technology that is for a stable, better
and secured transactions in a digital ecosystem.
In order to improve the security, this project aims to develop a app with the help of a
security algorithm SHA256 which is better in a one-way, deterministic function that meets
cryptographic hash requirements. and this is algorithm is fast to compute. Unlike some older
hashing algorithms, even if there is a very minor change to the original information then it
totally changes the hash value Hence in this way this project provides more security.
2
1.4 Thesis Organization:
Chapter 1: Deals with Introduction and objectives of the project, organization of thesis.
Chapter 5: Explains about the tools and technologies used in the project
REFERENCES
3
CHAPTER 2: LITERATURE SURVEY
4) A bitcoin blockchain decentralized system over named data networking by Tong Jin
Xiang Zhang
In this paper the proposed system, uses Proof-Of-Work (POW) and the demonstrates how a
bitcoin blockchain system works. Where transactions are generated and broadcasted, then
mined and new block is generated and broadcasted to all nodes and then validity is verified at
all nodes.
This paper illustrates the pros and cons of consensus algorithms like proof of work(POW),
proof of stake (POS), proof of weight(PoWeight) etc are analysed and compared.
4
Their evaluation criteria like Algorithm Throughput, Security & Vulnerability, Profitability
for mining were analysed.
6) A Peer to Peer Money Transfer Using SHA256 and Merkle Tree by Saurabh Dhumwad
Mandar Sukhadeve
This paper focusses on the proposed system which uses Merkle tree and Secure Hashing
Algorithm(SHA) for hashing. Merkel tree is a tree where parent node value is hashes of the
child node. The large data set can be validated very efficiently.
This paper describes the innovations that took place with the help of Blockchain Technology
In the various domains like Digital Currency and by tight integration with technologies such
as cloud computing, and IoT. In producing a cloud-based application called Health Chain.
5
CHAPTER 3: BLOCK CHAIN TECHNOLOGY
The blockchain, dubbed the best invention since the Internet, has attracted attention due to its
widespread use in a variety of fields. This has risen in popularity due to its blockchain-based,
dependable structure, which distinguishes itself by providing breakthroughs in a variety of
industries, including health, banking, government, and industry. Furthermore, unlike
conventional systems, it has a revolutionary element, as it does not have a central authority.
The blockchain operates in a simple manner. One of the key components that make
blockchain immutable is cryptographic hashes, which is the reason blockchain is changeless.
The fundamental benefit of hash is that it cannot be figured out. That is the motivation behind
why it is so well known. The most mainstream hash work is SHA-256.
The greatest benefit of blockchain is that the information cannot be adjusted, though, as found
in the conventional data sets, the information can be changed and erased without any
problem. What is more, if any occurrence happens where the information is altered, the
blockchain breaks. Making changes in both disengaged and live blockchain headways is
irksome.
The blockchain is an open ledger that provides customers with decentralisation. It has several
characteristics, including being open, distributed, ledger-based, peer-to-peer, and permanent.
Satoshi Nakamoto originally used the word blockchain in the Bitcoin white paper in 2009. It
has come a long way since then, with more and more organisations becoming interested in it.
Bitcoin is currently working on adding a lightning network and other advanced features.
Blockchain is now covering every field because it is more secure. We listed some domains
were blockchain is used
1) Financial Services:
Concerning the business perspective, blockchain has a solid effect and utilized for settlement
of extremely monetary resources. Blockchain as a help is liked by numerous organizations like
Microsoft guarantee, IBM, and so forth.
2) Internet of things:
The new moving innovation is utilized all over and can nearly be carried out in numerous
gadgets. Everything from watches to make urban areas brilliant goes under this classification.
6
Presently blockchain is moreover incorporated with IoT. As the idea, which is, trailed by
blockchain is safer than the IoT. Blockchain is utilized in each field where IoT is utilized for
exchange the board. Blockchain essentially utilized the idea of decentralization which is safer.
3) Biomedical space:
There are numerous biomedical issues that are treated with blockchain innovation. There are
numerous papers that show how blockchain is gainful in biomedical. By monitoring individual
wellbeing record and offer with the outsiders. It more than once checks the record and offers
advantage to patients for getting to their own records.
4) Shipping Domain:
Blockchain innovation gets brought into the shopping space for exchange rehearses. As
dispatching space depends on the exchange rehearses between ports, transporting lines,
transporters, cargo forwarders. This exchange rehearses are advanced over the long haul.
6) Voting:
Before blockchain elector needs to present their citizen id, then, at that point citizen id should
be confirmed and after confirmation, the elector could present their vote to the Electronic Voter.
7
3.1.1 Types of Blockchain:
Blockchain networks are classified into four types, namely: Public blockchain, Private
blockchain, consortium block chain and hybrid blockchain.
Public Blockchain A public blockchain is one that is used by the whole public and is not
restricted in any way. This block chain can be accessed by anyone who has a URL or a link.
Public block chain has an advantage of decentralization as a main feature but has a
disadvantage of security issues as it is accessible to everyone ,it can’t be more private.
Private Blockchain :A block chain that is restricted to a small group of people and works on
small scale and used by single organization .this block chain provides advantage of security
,it has accessibility security ,restriction to certain group of people.
This block chain has a disadvantage of main feature of block chain ,it is not completely
decentralized as it is restricted to a small amount of people which is low in trust related issues
and has centralization in it.
Hybrid Blockchain: Hybrid blockchain is a combination of both public and private block
chains ,utilizing best of it and showcasing specific data to public and accessing more of it in
private, which gains advantage of public trust and hiding confidential information. This has
an advantage of less data being tampered but has a downside of less data being transparent to
public.
Consortium Blockchain :This blockchain is likely to hybrid but it is restricted within a
particular group and it is more secure, and two or more entities can restrict, share and work.
This vanishes the risk accessed and worked by single organisation.
Blockchain has wide variety of features that makes it unique, they are:
1) Immutability
2) Decentralization
3) Enhanced Security
4) Consensus
5) Distributed Ledgers
6) Faster settlement
8
Immutability:
Immutability is a network that can’t be modified which can’t be tampered ,so it will be a
unmodified and persistent network .This is a highlighting feature of blockchain .This is done
by validation of nodes and storing information on digital ledgers.
Enhanced Security: As the system is decentralized it no longer has a single authority and
one cannot tamper data for his personal use, and one cannot change the validated data for
their personal use. The main reason for enhanced security is hash cannot be tampered, as we
use a complex and secure hashing algorithm, we can’t tamper hash, which is of high security,
once hash can’t be known there is no possibility of data being tampered.
Consensus: Consensus is an important feature for block validation and is a mutual agreement
between all the nodes in a network for validation and this process is quicker and it has a
nonce value for regenerative hash .There are 2 main types of consensus proof of work and
proof of stake. There are even other types of consensus which will be discussed further.
Distributed Ledgers: Ledgers are important feature in blockchain for the information to
appear quickly, information related to transactions and other which gives a faster response.
These ledgers are important as no special powers or superiority is given to any block and so is
fair to all nodes. As ledgers are fixed and cannot be changed by anyone it has chances of less
data being tampered or more security.
9
Faster Settlement: Block chain has this special feature which ensures faster transfer of
transactions and quicker payments which saves a lot of time and money, which is more
accurate compared to other method.
Blockchain metrics are used to evaluate the quality, performance, and scalability of
blockchain applications, as well as to establish benchmarks against which various blockchain
versions can be compared.
1. Active Nodes:
This metric, also known as Active Addresses, is calculated by counting and recording
how many distinct nodes are active throughout a given time, such as a day, week, or
month. The bigger the number in permissionless blockchains, the more nodes are
using and trusting the blockchain application. All participating nodes have access to
the active nodes value in most cases.
2. Transaction Throughput:
This metric is used to determine how long it takes to append valid data to blocks. The
entire number of committed and validated records is divided by the total amount of
time it takes to commit (validate, and store) those records (in seconds).
A timestamp is attached to each block that is formed (as per the timestamp header
covered earlier in the Understanding Blocks and Chains section). The blockchain
system uses timestamps to track how many blocks are created and appended over
specific time intervals, such as an hour or a day. The results of these tests are used to
evaluate the blockchain system's performance and scalability.
10
4. Transaction Latency:
This metric is used to calculate the time it takes for a transaction to go from being sent
to the network to being written to the ledger (or rejected). This metric is calculated by
comparing the time transactions were submitted to the time they were validated and
stored using their timestamps. This measure can also reveal how quickly consensus
algorithms are being implemented.
5. Transactions Per Second:
This metric is used to determine how many records or transaction records are sent and
saved every second. It is 0used to figure out how much processing a blockchain
network is doing and how much scalability it needs. In most cases, the number of
records sent to the network and the amount of data saved in the ledger are measured
separately.
11
3.2.1 Types of Hashing algorithms:
Various types of hashing algorithms exist, some of important and most used hashing
techniques are:
1)Message Digest-MD, MD2, MD4, MD5, MD6
2)RIPEMD-RIPEND, RIPEMD128, RIPEMD160
3)Secure Hash Function-SHA-0, SHA-1, SHA-2, SHA-3
4)Merkel tree root
Message Digest: Message digest algorithm is a way of converting arbitrary to fixed output
length usually less than input. Message Digest have various types like
MD,MD2,MD4,MD5,MD6. Out of these Md5 is popularly used, but it also has
vulnerabilities and caused attacked, so not commonly used in blockchain. In this message
digest these do not have keys.
RIPEMD: Ripe message digest is a hashing algorithm where it is efficient than message
digest but less securable .RIPEMD 160 is quite famous and its 128 bit encryption, it is used
for less complexity but has a disadvantage of less security.
SHA: Secure hashing algorithm is widely used now a days in Blockchain for its lss
vulnerabilities and it has many types out of which SHA2 has 2 types-SHA256 and SHA512.
SHA256 converts arbitrary length to fixed 256 bits hash and it has many twists and
complexities involved in this algorithm.SHA512 is like SHA256 but it is of 512 bits.
Merkel tree root algorithm: This uses binary search tree algorithm which combines hash
of different blocks, which is complex and uses much of CPU storage unlike sha2, these are
commonly used in bitcoins and blockchains for accurate results.
3.3 SHA256:
SHA-256 (Secure Hash Algorithm) There are 2256 different combinations to choose from.
The greater the number of possible hashes, the less likely it is that two different values will
produce the same hash. SHA256 is a secure algorithm used for security purpose and for
speed. The Hash in SHA256 and is 256 bits long. Messages up to 2⁶⁴ bit (2.3 billion
gigabytes) can be transformed into hash of size 256 bits.
12
The operations involved in SHA256 which can be divided into 3 types. They are
Basic Operations
Compound Operations
Other Operations
σ1(x)
Σ0(x)
Σ1(x)
1. σ0 Operation:
14
2. σ1 Operation:
3. Σ0 Operation:
This operation takes data as input and performs 3 operation
a. Rotate Right by 2 bits
b. Rotate Right by 13 bits
c. Rotate Right by 22 bits
then XOR of corresponding result at every stage of operation produces output.
15
Fig 3.3.2.3 3rd Compound Operation
4. Σ0 Operation:
This operation takes data as input and performs 3 operation
a. Rotate Right by 2 bits
b. Rotate Right by 13 bits
c. Rotate Right by 22 bits
d. then XOR of corresponding result at every stage of operation produces output.
16
3.3.3 Other Operations:
These operations are special type of operations. These take 3 inputs x, y, z .
17
3.3.4 Hash Computation Flow:
The hash computatition flow in SHA256 contains 4 stages.They are
In this state the Input is converted to 8 binary bits each using their ascii values. Convert
that message into 512 or multiple of 512 bits by padding 0’s. Add a set bit (1) at the end of
message as differentiator and last 64 bits in that 512 indicate the length of the message bits.
Convert that large block of message into multiple blocks of 512 bits.
There are 64 constants which are cube roots of first 64 prime numbers multiplied by 2 ^ 3.
For generation of tth word in Message Schedule = σ1(t-2) + (t-7) + σ0(t-15) + (t-16)
where σ1, σ0 are the compound operations performed on t-2, t-15 for calculating tth word
whose results are added with modular addition to t-7 and t-16th words and the output of this
addition is always calculated as mod of 232.
18
3.3.4.3 Compression Stage:
In this stage eight state registers (a, b, c, d, e, f, g, h) are initialized with fractions of square
root of first 8 prime numbers multiplied by 2 ^ 32 which are then converted to binary values.
Then 2 temporary words T1, T2 of 8 bits each and initialize with
T1 = Σ1(e) + Ch (e, f, g) + h + K0 + W0
Where Σ0, Σ1, are compound operations, Ch, Maj are Choice and Majority Operations and
K0 is first constant and W0 is the first element is message schedule. Move state registers
down i.e. a to b, b to c and so on and then assign
a = T1 +T2 and
e = e+ T1.
19
CHAPTER-4 Consensus Algorithm:
A consensus algorithm is a mechanism for all peers in a Blockchain network to agree on the
state of the distributed ledger at any given time. The Blockchain consensus protocol has
various specific objectives, consist of reaching a treaty, collaboration, co-operation, equality
to all nodes, and each node's mandatory participation in the consensus process.
Proof of Stake: POW necessitates a large amount of energy. Unlike POW, POS is
dependent on the coin stake of the players. The stake with the most coins is more likely to
add a new block of the transaction to the blockchain. In POS, there is no block reward. The
transaction fee is the only incentive for the stake. The POS mechanism is well suited for
static coin supply because it uses less energy than POW.
Practical Byzantine Fault Tolerance : Because PBFT relies on the number of nodes to
confirm trust, a high hash rate is not necessary in this procedure. The transaction is validated
to be legitimate once enough responses have been received.
20
Directed acyclic graph: Due to its POW mechanism, Bitcoin has been experiencing a
bottleneck of inefficiency. It takes 10 minutes to make a single block, and blocks cannot be
made at the same time. DAG allows transactions to run on several chains at the same time.
This could be the way instant transactions are done in the future, with a low transaction fee.
21
CHAPTER-5 -STUDY OF TOOLS USED
5.1 VS CODE: Visual Studio Code is a code editor that handles a number of languages
like JavaScript, Java,Go, C++.Blink-based Node.js web programmes are constructed which is
based on Electron framework. Instead of a project management system, it lets users to
access one or more folders, which may then be stored as workspaces for later use.
As a result, it may be used as a code editor for any language, regardless of the language. It
supports a variety of programming languages, each of which has its own features. The
arguments can be used to remove files and directories from the project tree that aren't needed.
Many elements of Visual Studio Code are not obtainable through the user interface or menus,
but available through the command palette. It is ideal for everyday use. Bracket matching,
Syntax highlighting, box selection, auto-indentation, snippets, and more are all available right
away with VS Code.
Visual Studio Code comes with rudimentary support for the majority of programming
languages out of the box. Bracket matching, Syntax highlighting, customisable snippets
and code folding, are all included in this basic package. IntelliSense for JSON, JavaScript,
CSS, TypeScript and HTML is included in Visual Studio Code, as well as debugging support
for Node.js. Other languages can be supported using extensions available for free on VS
Code Marketplace.
5.2 Node.js:
Node.js is an open source, cross platform runtime environment for JavaScript which is built
on chrome browsers V8 JavaScript engine. It is the first tool that enables to runs JavaScript
outside of the browser. As a result, Node.js is can now be used not only inside browser but
for also developing server’s, hybrid cross platform apps.
A Node.js runs in a single process i.e., it does not follow multi-threaded Request/Response
Stateless Model. Blocking behaviour is the exception rather than the rule in Node.js, because
the standard library offers a set of asynchronous I/O primitives that avoid JavaScript code
from blocking, and libraries in Node.js are usually written using non-blocking paradigms.
22
Instead of halting the thread and wasting CPU cycles waiting for a response, when Node.js
conducts an I/O action, such as reading from database, network, or accessing the filesystem,
as soon as the answer is received, Node.js will restart the activities.
This allows Node.js to handle hundreds of concurrent connections without incurring the
overhead of thread concurrency control, which may be a major source of mistakes.
Node.js comes with NPM is a package manager for node.js which helps us to install modules
from the NPM directory and use them inside our code. Packages like Express.js, Gulp,
Lodash can be install using NPM.
5.2.2 Express.js:
Express is a Node.js framework for developing backend applications. Express is quick,
simple, aggressive, and modest framework. Express.js acts as layer built on top of Node.js
which helps in the management of a business logic at server and routes to various endpoints.
It also comes with vivid range of tools for creating web and mobile applications.
Some of the most important features of the Express.js framework is:
•It supports creation of single-page, multi-page, and hybrid web applications.
•It allows middleware’s to reply to HTTP requests to be configured.
•It supports various templating engines out of the box like Pug, Ejs, Eta etc.
•It creates a routing table for carrying out different activities based on the HTTP method and
URL. It allows you to dynamically render HTML pages by providing variables to templates.
5.3 HTML & CSS:
The structure and content of a website are created using HTML, while the content is styled
using CSS. This code is generated by Web flow as you design. HTML is commonly used for
content as it notifies the browser what's on the page. Everything you see, including headlines,
paragraphs, links, and photos, is part of this. Inline styles were used to style all of the material
in HTML line by line. Simple adjustments to font family, colour, and size would entail
modifying the HTML item by item. It was cumbersome to upgrade a site element by element,
and it's unable to change a single site-wide style, such as the font family or font size for a
simple body element.
23
All the styling information that was previously written inline — colours, borders, size,
positioning, typography, and more — is now moved to a separate style document with
classes.
HTML and CSS are the basic building blocks of web design, providing structure as well as
appearance. Understanding these concepts is beneficial, but thanks to Web flow, we no need
to hand-code CSS and HTML. With what we are creating we can build websites which are of
more speed and efficient. We can directly engage our CSS, HTML and anything on screen.
by visually generating and altering information on a canvas. You receive a direct link to the
medium you are editing with Web flow. Rather than sketching and producing prototypes, as
well as going through the time-consuming design iteration to development handoff process,
we are delivering code that's ready for production. So, you can make even the wildest design
concepts a reality - without having to write a single line of code.
5.4 GIT:
Git is a rapidly distributed source code management and revision control system. Git was
designed by Linus Torvalds for the building of the Linux kernel. Git is a free software
distributed under the terms of the GNU General Public License, version 2. This article will
teach you how to utilise Git in a distributed context to manage project versions when creating
web and non-web apps.
Version control system is a basic concept in GITVCS is a piece of software that allows
software developers to collaborate and keep track of their progress.
The functions of a VCS are listed below.
Allows multiple developers to work at the same time.
It is not possible to overwrite each other's changes.
Every version's history is kept.
24
Fig-5.1 Git
25
CHAPTER 6: METHODOLOGY AND WORKFLOW
The First value in the architecture is the Timestamp it the time in milliseconds from 1st
January 1970 to the time of creation of that block. The next value is Transactions it an array
of transactions each containing sender, receiver, and the Transaction amount. The Hash is the
SHA256 unique identifier of the block generated using timestamp, transactions, nonce,
previous Hash value. Previous Hash is the hash Value of the previous Block. This value
creates a chain between the blocks and connects them together. Nonce stands for number
used only once. It is a field created to recalculate hash during consensus Algorithm to create a
new block in the blockchain.
26
6.1Blockdiagram:
The block chain initially contains a single block as soon as it is created it is called “genesis
block” the timestamp in genesis indicates the time at which the blockchain is created. It has a
hash value set to default value as 0 and the previous hash is also 0 and the nonce value is set
to 100.
Whenever a new Transaction is created by the user through the node which is hosted
over a decentralized network. That new transaction is added to the list of pending
transactions. Once they are mined using any consensus algorithm in this case it is Proof of
work (POW) a New Block is created and is transmitted to all the nodes in the network .All
these requests and response happens over the internet. Now that every node has their own
copy of that block in their block chain hosted over a decentralized network, the node that
mined the block receives a reward for mining a new block out of those pending transactions.
And then the transaction is completed.
27
6.3 Creation of New Block:
To create a new block the mining is done using consensus algorithm here roof of
work is used where in the hash is recomputed by adjusting the nonce value until the first 4
characters of the hash of that block becomes equal to zeros. This consumes a lot of
computing resource and time consuming. Once a new block is created it can’t be undone. The
newly created block contains all the pending transactions prior to the creation/mining of
block
28
6.4 Adding node to Network:
A new node cannot be added to the decentralized network all by itself. Firstly, it needs
to have an instance of server on one of its port and is accessible over the internet. A network
node which is already present in the decentralized network sends a request to the new node
which is to be added to the network as soon as it responds the request the old node sends the
request intimating all the other nodes present the network about the new node added to network
and all nodes in network add the new node to their network in their own copy of blockchain.
And then that node sends another request to new node informing it about all the other nodes in
the server. Now all the nodes are fully connected.
Fig 6.4.3. Request from existing node in network to new node about other nodes in
network
29
6.5 Checking Validity of blockchain across the network:
Whenever a check validity request is made the entire blockchain is searched for smallest
and largest chain of copies of blockchain at every node in the network. Once they are found out
their lengths, their pending transactions, and every block in blockchain are compared and if they
are same the validity is true. If the copies are different then the block chain is different across the
network.
To find a block in the block chain linearly traverse the array of blockchains and check if the
hash of that block is the required hash or not if it is the required hash then return that
particular or else return that block has not been found.
30
CHAPTER 7: RESULTS
Genesis block is the first block in blockchain fig 7.1 represents block architecture where
time stamp is the duration of milliseconds from 1970, jan1. As this is the first block hash
and previous hash are 0.
31
The above Fig-7.2 represents view of blockchain with genesis block in the JSON format
and the pending transactions are empty and as represented in webpage view Hash and
previous block hash are 0 as they are default values genesis block in blockchain.
Fig 7.3 represents UI of adding transactions. Addition of transactions have 3 fields namely
amount, sender, receiver. We can enter the details of the transactions in these fields, and we
can add transaction which then goes into the pending transaction array of the blockchain.
32
Fig-7.4 shows how transactions are added to the blockchain using postman tool where we can
send and receive details to and from API of server. Here the transaction details like amount,
sender, receiver are sent to the ‘/transaction’ endpoint using POST method so that the server
receives the data and then broadcasts it and adds it to the blockchain throughout the network.
Fig-7.5 represents the pending transactions on UI after addition of transactions. The details
are displayed in the form of a table so that it is easy for a layman to understand it.
Fig-7.6 represents updated pending transactions shown in the form of JSON format after
addition of a new transaction to the blockchain.
33
Fig-7.7 UI of mining of block
Fig-7.7 represents the field where the option to show option to mine block and results after
mining a new block on UI through proof of work. The miner receives rewards for mining,
there arises 2 cases where new block is mined successfully from pending transactions then
the notification is in green colour. Another case arises where block cannot be mined as the
pending transaction is empty then the notification is displayed in red colour.
The figure Fig-7.11 shows how the add node block looks on UI. When a new node is added
to the network the count of no of nodes is incremented and new nodes can be added to the
network by entering the URL with port number in the input field.
The Fig-7.12 shows how the nodes is handled inside the network at low data level. When
ever a new node is added to network it gets added to the network node URL Array on all
nodes in the network.
36
CHAPTER 8: CONCLUSION AND FUTURE SCOPE
8.1 Conclusion:
Blockchain provides a decentralised network, which secure the transaction that is made
between various nodes. As hashing is a key element that provides a level of security to the
network. SHA-256, is a hashing algorithm used to change over text of any length into a fixed-
size string. It cannot be reverse engineered hence more secure. SHA-256 Algorithm is
computationally fast and efficient.
A web application is developed by implementing Consensus and SHA-256 Algorithm. This
hashing provides more security than centralized system. On new transaction request. That
Transaction is added to pending Transaction array and is broadcasted to all nodes across the
Network and is mined and checked for validity. Once the validation is done, this block is
added to the Blockchain network. These blocks are encrypted with strong hashing algorithms
Hence accessing the network becomes much more difficult.
The efficiency of different algorithms is calculated and compared for choosing the best
algorithm. Out of this algorithm’s POW and SHA-256 algorithms are used in this project. So,
this algorithm is implemented to secure the network. The web application performs the
necessary operations and computations using algorithms to secure the transactions and
displays the status of each process in the transfer.
The application can be further improved by providing unique identities and passwords
to each user node.
37
REFERENCES
Research papers:
38