You are on page 1of 20

Shri Vaishnav Vidyapeeth Vishwavidyalaya, Indore

Shri Vaishnav Institute of Information Technology


Department of Computer Science & Engineering

PRACTICAL FILE
Submitted By: Submitted To:
Annanya Badarya Mr. Manish
Sharma Assistant Professor
(20100BTCSE07515) CSE Department

Semester / Year – VI/ III SVIIT – SVVV, Indore (M.P.)


Program / Section – B Tech CSE / A
Subject Name – Block Chain
Subject Code – BTCS – 618
Shri Vaishnav Vidyapeeth
Vishwavidyalaya, Indore

Shri Vaishnav Institute of Information Technology


Department: Computer Science & Engineering
Class: B Tech Section: A Semester: VI Session: Jan 2023 – June 2023
Name: Annanya Badarya Enrollment No.: 20100BTCSE07515
Subject Name: Block Chain Code: BTCS – 618
Table of Content
Sr. No. Name of Experiment Remarks
1. Study of Cryptographic Hashing.

2. Study of Block, Blockchain, Distributed Network


Working.

3. Case study of Bitcoin and its working.

4. Case study of Ethereum and its working.

5. Case study of Private and Public Key Cryptographic and


Digital Signature.

6. Case Study: How Tech Mahindra Deployed Hyperledger


Fabric for the Digital Transformation of Abu Dhabi’s
Land Registry.

7. Case Study taXchain provides a faster, better, cheaper


way to complete EU tax forms using Hyperledger Fabric.

8. Build blockchain using python.


Experiment 01
Aim: Study of Cryptographic Hashing.
1.1 Introduction:
Cryptographic Hashing function plays an important role in blockchain and any digital
currencies.
related with that. In this section, we will talk about how cryptographic hash works; however,
discussion about its properties is necessary. By analysing and understanding these properties,
we
will know how blocks are chained together and how Ethereum or other blockchain networks.
operate.
1.2 Properties of Cryptographic Hashing:
These properties are:
1) Deterministic
2) Quick to compute
3) Impossible to go back
4) Small change in input results in big change in output
5) Different messages generate different hash values
Output-
A block :-
A blockchain –
Experiment 02
Aim: Study of Block, Blockchain, Distributed Network Working
Introduction:
Each block in a blockchain has a block number and a timestamp according to the order in
which it is added to the blockchain. Also, every block is added to the previous block through
hashing. The hashing gives each block a unique number that acts as its digital signature.
Step 1 — Transaction data.
The data on the Bitcoin blockchain exclusively exists out of transaction data in regard
to Bitcoin transactions. It is a giant track record of all the Bitcoin transactions that have ever
occurred, all the way back to the very first Bitcoin transaction. In this article we will assume
that a blockchain stores transaction data, just like the Bitcoin blockchain.
Step 2 — Chaining the blocks (with a hash) .
Imagine a bunch of blocks of transaction data (image 1).

Three blocks, all containing some transaction data. Not quite special yet. You can compare it to
some stand-alone word documents that simply describe what transactions have occurred and
how these have impacted certain balances. Document 1 would then chronologically describe
the first transactions that have occurred up to 1 MB, whereafter the next transactions would be
described in document 2 up to another MB, and so on. These documents are the blocks of data.
These blocks are now being linked (aka chained) together. To do this, every block gets a unique
(digital) signature that corresponds to exactly the string of data in that block. If anything inside
a block changes, even just a single digit change, the block will get a new signature.
Step 3 — How the signature (hash) is created.
The cryptographic hash function is used to create the digital signature for each unique block.
There is a large variety of hash functions, but the hashing function that is used by the Bitcoin
blockchain is the SHA-256 hashing algorithm. But how do the signatures stop someone from
simply inserting a new signature for each block after altering one (a change goes undetected if
all blocks are properly linked, people won’t be able to tell there was a change)? The answer is
that only hashes (signatures) that meet certain requirements are accepted on the blockchain.
Step 4 — When does the signature qualify, and who signs a block?
A signature doesn’t always qualify. A block will only be accepted on the blockchain if its
digital signature starts with — for example — a consecutive number of zeroes. For example;
only blocks with a signature starting with at least ten consecutive zeroes qualify to be added to
the blockchain. However, as explained in chapter 3, every string of data has only one unique
hash bound to it. What if the signature (hash) of a block doesn’t start with ten zeroes? Well, in
order to find the block a signature that meets the requirements, the string of data of a block
needs to be changed repeatedly until that specific string of data leads to a signature starting
with ten zeroes. Because the transaction data and metadata (block number, timestamp, et
cetera) need to stay the way they are, a small specific piece of data is added to every block that
has no purpose except for being changed repeatedly in order to find an eligible signature. This
piece of data is called the nonce of a block. The nonce is a completely random string
of numbers (note: pictures show other digits as well, but a nonce can only be numbers). To
summarize what was just explained, a block now contains; 1) transaction data, 2) the signature
of the previous block, and 3) a nonce. The process of repeatedly changing the nonce and
hashing the block’s data to find an eligible signature is called mining and is what miners do.
Miners spend electricity in the form of computational power by constantly changing the block
composition (nonce) and hashing it until they find an eligible signature (output). The more
computational power they have, the faster they can hash different block compositions and the
more likely they are to find an eligible signature faster. It is a form of trial and error.

Step 5 — How does this make the blockchain immutable?


In order for an altered block to be accepted by the rest of the network, it needs to be chained to
the subsequent blocks again. See where this is going? It was previously explained that this
requires every block that comes after it to get a new signature. And that signature needs to meet
the requirements! Giving all of these blocks a new signature will be very costly and time-
consuming, although it doesn’t seem impossible. It is considered impossible anyway though,
and here is why:
Let’s say a corrupt miner has altered a block of transactions and is now trying to calculate new
signatures for the subsequent blocks in order to have the rest of the network accept his change.
The problem for him is, the rest of the network is also calculating new signatures for new
blocks. The corrupt miner will have to calculate new signatures for these blocks too as they are
being added to the end of the chain. After all, he needs to keep all of the blocks linked,
including the new ones constantly being added. Unless the miner has more computational
power than the rest of the network combined, he will never catch up with the rest of the
network finding signatures.

Step 6 — How is the blockchain governed? Who determines the rules?


The Bitcoin blockchain follows a governance model of democracy, and therefore updates its’
record of transactions (and thus the Bitcoin balances) according to what the majority of its’
users say is the truth. The blockchain protocol does this automatically by always following the
record of the longest blockchain that it has, because it assumes that this chain is represented by
the majority. After all, it requires the majority of the computational power to create the longest
version of the blockchain. This is also how an altered block is automatically rejected by the
majority of the network. The majority of the network rejects an altered block automatically
because it is no longer chained to the longest chain.
Experiment 03

Aim: Case study of Bitcoin and its working.

Introduction:
Bitcoin was created in 2009 by Satoshi Nakamoto, a pseudonymous developer. Bitcoin is
designed to be completely decentralized and not controlled by any single authority. With a
total supply of 21 million, its scarcity and decentralized nature make it almost impossible to
inflate or manipulate. For this reason, many consider bitcoin to be the ultimate store of
value or ‘Digital Gold’. Bitcoin is fully open-source and operates on a proof-of-work
blockchain, a shared public ledger and history of transactions organized into "blocks" that
are "chained" together to prevent tampering. This technology creates a permanent record of
each transaction. Users on the Bitcoin network verify transactions through a process known
as mining, which is designed to confirm new transactions are consistent with older
transactions that have been confirmed in the past, ensuring users cannot spend a Bitcoin
they don’t have or attempt to double-spend coins.

BTC in practice
New coins are created as part of the Bitcoin mining process. Bitcoins are rewarded to
miners who operate computer systems that help to secure the network and validate
incoming transactions. These Bitcoin miners run full nodes and use specialized hardware
otherwise known as Application Specific Integrated Circuit Chips (ASICs) to find and
generate new blocks. Once a series of computationally demanding problems have been
solved a completed "block" is added to the ever-growing "chain", this mining process can
fluctuate and become easier or harder depending on network demand and value, this is
known as the network difficulty. Besides block rewards, miners also collect transaction fees
which further incentivizes them to secure the network and verify transactions. This
independent network of miners also decreases the chance for fraud or false information to
be recorded, as the majority of miners need to confirm the authenticity of each block of
data before it's added to the blockchain, in a process known as "proof of work."

How does Bitcoin work?


Bitcoin was built with a distributed digital record in mind called a blockchain. Blockchain
is a type of public ledger -- a digital system for recording transactions and related data in
multiple places at one time. Blocks in a blockchain are units that contain data about every
transaction, including the date, time, value, buyer and seller, and an identifying code for
each exchange.
Blockchain is designed to make it extremely difficult to hack the system or forge the data
stored on it, thereby making it secure and immutable. Each computer in a blockchain
network has a copy of the ledger to prevent single points of failure. If one block is changed,
then all the other blocks in the distributed ledger must be changed. Blockchain is a
decentralized technology, meaning it is not controlled by any one organization. In addition,
identifying codes make it difficult to fraudulently produce blocks.
Bitcoin is stored in a digital wallet application on a computer or
smartphone. Cryptocurrency wallets are among one of the best ways to keep bitcoin secure.
There are also multiple types of wallets. Software wallets enable users to keep only a small
amount of bitcoin on a computer or mobile phone for everyday use, with the balance kept
in a separate offline wallet. This safeguards the majority of a user's bitcoin
from malware trying to intercept the password used to access a wallet.
Offline wallets are wallet software that is installed on a USB or a live CD rather than on the
internet, so it can be kept physically secure. Hardware wallets, another form of offline
wallet, are physical devices such as a flash drive that store a user's private keys. Even when
connected to another device, the private keys are never exposed, as signed transactions are
completed on the device. Multi signature wallets require two or more private keys to
authorize transactions. This greatly decreases the chances of a wallet being accessed if lost
or stolen. One key is stored in a secure location as a backup, another is stored on the user's
mobile device and a third key can be stored with a multi signature provider.
People can send bitcoin to others via bitcoin wallet-to-wallet transfer. Bitcoin can be sent
by initiating a transfer request from a bitcoin address in the customer's wallet to a bitcoin
address, or alphanumeric string, in the vendor's wallet. Senders can select the amount to
transfer either as bitcoin or in their local currency. Each bitcoin transaction is charged a
small fee, which is paid to a bitcoin miner. This fee can vary, depending on factors
including how quickly the bitcoin transaction needs to be confirmed.

What is bitcoin mining?


Bitcoin mining is the process of adding new transactions into circulation. Bitcoin miners
use software that accesses their processing capacity to solve transaction-related algorithms.
In return, they are awarded a certain number of bitcoin per block. This entices crypto
miners to keep solving the transaction-related algorithms, supporting the overall system.
The process is called proof of work.
Originally, bitcoin mining was conducted on the processors, or CPUs, of individual
computers, with more cores and greater speed resulting in more profit. After this, most
bitcoin miners began using multi-graphics card systems, then field-programmable gate
arrays and application-specific integrated circuits. These moves were made in an attempt to
find more hash codes below a given target and use less electrical power.
Experiment 04

Aim: Case study of Ethereum and its working.

Introduction:

The original Ethereum concept was introduced in 2013 by Vitalik Buterin with the release
of the Ethereum whitepaper and in 2015 the Ethereum platform was launched by Buterin
and Joseph Lubin along with several other co-founders. Ethereum is described as “the
world’s programmable blockchain,” positioning itself as an electronic, programmable
network that anyone can build on to launch cryptocurrencies and decentralized applications.
Unlike Bitcoin which has a maximum circulation of 21 million coins, the amount of ETH
that can be created is unlimited, although the time that it takes to process a block of ETH
limits how much ether can be minted each year. Another difference between Ethereum and
Bitcoin is how the networks treat transaction processing fees. These fees are known as
“gas” on the Ethereum network and are paid by the participants in Ethereum transactions.
The fees associated with Bitcoin transactions, however, are absorbed by the broader Bitcoin
network. Additionally, although both Bitcoin and Ethereum currently use Proof-of-Work
consensus mechanisms, Ethereum is in the process of gradually transitioning to a different
consensus algorithm known as Proof-of-Stake, which uses significantly less energy.

ETH in practice
Because ETH acts more as a utility token than a token of value, its supply is technically
infinite although this inflation curve slows dramatically over time. In theory, Ether will
always be in demand, meaning inflation should never devalue the asset beyond use, thus
Ether consistently enters circulation in the form of miner rewards. Miners get paid a
transaction fee called “gas.” Gas is paid by the user initiating the transaction to the miner
who validates the transaction- incentivizing future mining and network security. Because
there is so much use of the Ethereum network, gas fees can run quite high. This is because a
block can only hold so much gas which varies based on transaction types and amounts. As a
result, miners will choose transactions with the highest gas fees, meaning users are
competing to validate transactions first. When Ethereum transitions to a Proof-of-Stake
model, instead of miners verifying transactions, the network will use the owners of
significant stakes to validate transactions.

How does Ethereum work?


Like Bitcoin, the Ethereum network exists on thousands of computers worldwide, thanks to
users participating as “nodes,” rather than a centralized server. This makes the network
decentralized and highly immune to attacks, and essentially unable to go down as a result.
If one computer goes down, it doesn’t matter because thousands of others are holding the
network up.
Ethereum is essentially a single decentralized system that runs a computer called the
Ethereum Virtual Machine (EVM). Each node holds a copy of that computer, meaning that
any interactions must be verified so everyone can update their copy.
Network interactions are otherwise considered “transactions” and are stored within blocks
on the Ethereum blockchain. Miners validate these blocks before committing them to the
network and acting as transaction history or a digital ledger. Mining to verify transactions is
known as a proof-of-work (PoW) consensus method. Each block has a unique 64-digit code
identifying it. Miners commit their computer power to find that code, proving that it’s
unique. Their computer power is “proof” of that work, and miners are rewarded in ETH for
their efforts.
Also, like Bitcoin, all Ethereum transactions are entirely public. Miners broadcast
completed blocks to the rest of the network, confirming the change and adding the blocks to
everyone’s copy of the ledger. Confirmed blocks cannot be tampered with, serving as a
perfect history of all network transactions.
But, if miners are paid for their work, where does that ET H come from? Each transaction
comes with a fee, called “gas,” which is paid by the user initiating the said transaction. That
fee is paid to the miner who validates the transaction, incentivizing future mining and
ensuring network security. Gas essentially serves as a limit, restricting the number of
actions a user can make per transaction. It’s also in place to prevent network spam.
Because ETH is more of a utility token than a token of value, its supply is infinite. Ether
consistently enters circulation in the form of miner rewards, and it will with staking
rewards as well once the network moves to proof-of-stake (PoS). In theory, Ether will
always be in demand, meaning inflation should never devalue the asset beyond use.
Unfortunately for many, Ethereum gas fees can run quite high based on network activity.
This is because a block can only hold so much gas which varies based on transaction types
and amounts. As a result, miners will choose transactions with the highest gas fees,
meaning users are competing to validate transactions first. This competition pushes fees
higher and higher, congesting the network during busy times.
Network congestion is a significant problem, though it’s being addressed in Ethereum 2.0
— a complete overhaul that will be discussed as a separate section.
Interacting with Ethereum requires cryptocurrency, which is stored in a wallet. That wallet
connects to DApps, acting as a passport for the Ethereum ecosystem. From there, anyone
can purchase items, play games, lend money and do all sorts of activities just as they do on
the traditional internet. Only, the traditional web is free to users, as they’re giving away
personal information. Centralized entities running websites then sell that data to make
money.
Cryptocurrency takes the place of data here, meaning users are free to browse and interact
anonymously. This also means DApp use is non discriminatory. For example, no lending or
banking DApp can reject someone based on their race or financial status. An intermediary
can’t block what they consider a “suspicious transaction.” Users control what they do and
how they do it, which is why many consider Ethereum to be Web 3.0 — the future of web
interaction.
Experiment 05

Aim: Case study of Private and Public Key Cryptographic and Digital
Signature.

Introduction:

Private Keys and Public Keys terms are used in cryptography. These keys are used to
encrypt/decrypt sensitive data.

Private Key:

The private key is used in both encryption as well as decryption. This key is shared between
the sender and receiver of the encrypted sensitive information. The private key is also
called "symmetric" because it is shared by both parties. Private key cryptography is faster
than public-key cryptography mechanism.

A private key is generally a lengthy, non-guessable sequence of bits created randomly or


pseudo-randomly. The complexity and length of a private key define how easy it is for an
attacker to carry out a brute force attack, in which they test out several keys until they find
the appropriate one.

Public Key:

Asymmetric cryptography, often known as public-key cryptography, is a type of encryption


that employs pairs of keys. A public key (which may be known to others) and a private key
(which may not be known to anyone except the owner) make up each pair. Cryptographic
techniques based on mathematical problems known as one-way functions are used to
generate such key pairs.

A private key should be kept secret for effective security; a public key can be freely
circulated without jeopardizing security.

In such a system, anybody can encrypt a message using the intended receiver's public key,
but only the receiver's private key can decode the message. This allows a server application
to produce a cryptographic key for compatible symmetric-key cryptography, then encrypt
that freshly generated symmetric key using a client's freely disclosed public key.

A public-key encryption system's most apparent application is for encrypting


communication to guarantee secrecy – a message that a sender encrypts using the
recipient's public key and can only be decoded by the recipient's associated private key.

Digital Signature:
Digital signatures are the public-key primitives of message authentication. In the physical
world, it is common to use handwritten signatures on handwritten or typed messages. They
are used to bind signatory to the message.
Similarly, a digital signature is a technique that binds a person/entity to the digital data.
This binding can be independently verified by receiver as well as any third party.
Digital signature is a cryptographic value that is calculated from the data and a secret key
known only by the signer.
In real world, the receiver of message needs assurance that the message belongs to the
sender and he should not be able to repudiate the origination of that message. This
requirement is very crucial in business applications, since likelihood of a dispute over
exchanged data is very high.
Model of Digital Signature
As mentioned earlier, the digital signature scheme is based on public key cryptography. The
model of digital signature scheme is depicted in the following illustration −

The following points explain the entire process in detail −


• Each person adopting this scheme has a public-private key pair.
 Generally, the key pairs used for encryption/decryption and signing/verifying are different.
The private key used for signing is referred to as the signature key and the public key as the
verification key.
 Signer feeds data to the hash function and generates hash of data.
 Hash value and signature key are then fed to the signature algorithm which produces the
digital signature on given hash. Signature is appended to the data and then both are sent to
the verifier.
 Verifier feeds the digital signature and the verification key into the verification algorithm.
The verification algorithm gives some value as output.
 Verifier also runs same hash function on received data to generate hash value.
 For verification, this hash value and output of verification algorithm are compared. Based
on the comparison result, verifier decides whether the digital signature is valid.
 Since digital signature is created by ‘private’ key of signer and no one else can have this
key; the signer cannot repudiate signing the data in future.
Experiment – 6

Aim: Case study of How Tech Mahindra Deployed Hyperledger Fabric


for the Digital Transformation of Abu Dhabi’s Land Registry

Abu Dhabi is one of the richest cities in the world, boasting modern architectural wonders
from the first circular skyscraper to the dramatic Etihad towers to the world’s farthest
leaning tower. When it comes to managing the land deeds for the 375 sq. miles on which
the modern cityscape is built, there is a scope to digitize them and share these records with
the citizens and other stakeholders using cutting-edge technology.
Starting from selling a piece of land to constructing a building or residential complex to
selling the units to managing tenancy, there are a multitude of steps involved in creating a
land deed record and the process can span up to six years to complete.
“Unfortunately, all of this is not documented properly,” says Amey Rajput, General
Manager of the Blockchain Public Sector and Supply Chain Practice at Tech Mahindra1 ,
the leading provider of digital transformation consulting and business reengineering
services and solutions based in Pune, India. “The Department of Urban Planning &
Municipalities [DPM] had given the Abu Dhabi City Municipality2 [ADM] a road map of
what they wanted to adopt in the future to digitize their organization and one of the use
cases was a land registry.”

Secure, Safe, and Truthful


To create an end-to-end solution3 that utilizes automated transactions for sharing and
viewing deeds, the Tech Mahindra team knew blockchain technology would play a major
role in Abu Dhabi’s digital transformation. “We didn’t want to push blockchain just for the
sake of technology,” says Rajput. “Instead, we always try to understand where blockchain
can bring the maximum value.”
Stakeholders can trust that they are working with the most current and validated
information because of blockchain’s smart contracts and immutable records, which also
eliminate the susceptibility to lost or stolen documents or fraud.
Additionally, the possibility of human error is no longer a concern in this new paperless
solution because individuals and organizations don’t have to keep referring to hard copies
or rely on manual efforts to process each transaction related to a property.
In the pilot phase of the project, two entities were onboarded: the ADM and Aldar
Properties6 , the leading real estate developer in Abu Dhabi and one of the most well-
known names in the United Arab Emirates and wider Middle East region. Through Smart
Hub, Tech Mahindra developed the following three functions for users:

How Tech Mahindra Deployed Hyperledger Fabric for the Digital Transformation of Abu
Dhabi’s Land Registry
• View a land deed: Citizens can review information or completed documents related to
their land deed, and they can trust the data to be authentic. On Smart Hub, you cannot
manipulate, cheat, or use Photoshop in the document. In short, you cannot use those
documents for illegal purposes.
• Share a land deed: This function allows property owners to grant access to
documentation to an entity or individual for a limited time in order to complete certain jobs,
such as re-negotiating a loan or obtaining permission to work on site. The time sensitive
access can be given to multiple entities or government agencies, and once the designated
time frame expires, the app automatically revokes access.
• Review the audit trail: Under the Share With option on Smart Hub, owners can see how
many times a document was used and for what purposes, and subsequent owners will also
have complete transparency into the history of the property. You can also see if the
apartment is still under mortgage or if there is another loan which is taken against the deed.

Citizens First

“In the end, the number of smart contracts the land registry can produce was not a metric of
success for the ADM. The focus was more on the customer experience and less on the
technology,” says Malhotra.
“The municipality wanted to implement it so that citizens do not have to come to the
municipality and stand in queues for work they wanted to do, such as paying a bill or
document verification,” says Rajput. “Now everybody can accomplish all the activities for
which they would normally come to the ADM with just a click of a button.”
In the next phase, the future focus will be onboarding a wide variety of government and
non-government entities, such as banks. Another goal is to develop a personal identification
verification process that uses smart contracts versus physical ID cards.
Finally, the road map for the land registry includes capturing the land registration process.
There are a lot of 2D drawings which come from the developer, and multiple iterations and
approvals are needed to even construct a building. Tech Mahindra wants to capture that
end-to-end process on the blockchain.
Experiment – 7
Aim: Case Study taXchain provides a faster, better, cheaper way to
complete EU tax forms using Hyperledger Fabric

taXchain
• A blockchain network to exchange digitized tax forms
• Sponsored by Henkel and Siemens
• Developed by KrypC using Hyperledger Fabric 2.2
• One tax form is now in production, with more being implemented

Goals
• Prove that digitized tax forms save time and money
• Build an open, flexible platform that can support many partners
• Showcase the network to companies across the EU

Approach
1. Identify a nagging business problem
2. Build a working Proof of Concept with blockchain
3. Complete a production-ready network
4. Create an association to promote the network
5. Extend the network with more partners and further forms

Results
• Cost to complete one tax form slashed by 75% (from €120 to €30)
• Time to fill out one tax form cut from days to minutes
• Further gains to come from exploiting all free trade agreements

A breakthrough in handling paper forms


Better, faster, cheaper: Most experts say any new process can only achieve two out of three
of these goals. Now a new system to handle tax forms in the EU promises to deliver all
three benefits:
• Faster completion of required forms
• Better safeguards against error and fraud
• Huge cost savings over paper forms
This new blockchain-based network can help any company that must deal with EU
paperwork. And it can also help companies stop missing out on the benefits of free trade
agreements with other countries. Sponsored by Siemens and Henkel and developed by
KrypC, the award-winning taXchain network is based on the Hyperledger Fabric
framework for enterprise blockchains.

Identifying a nagging business problem


Everyone agrees that doing business in the EU creates a mountain of paperwork. Many
forms deal with customs, duties, and taxes among the 27 EU members and with trading
partners in other countries. Filling out all these forms demands a lot of resources. And
missed opportunities pile up when overloaded staff don’t claim the exemptions they’re
entitled to under various trade treaties.
Building a working Proof of Concept with blockchain
Teams from Henkel and Siemens drew up a list of 15 possible use cases for blockchain in
tax and customs. Then they selected the Long Term Supplier Declaration (LTSD) for a
Proof of Concept. “It’s not the sexiest use case, not something everyone was crying for,”
notes Rubbert. “We picked this form because the process is very simple. The only purpose
was to prove the technology.” The next decision was which blockchain platform would fit
the project best. “Deciding on which blockchain framework to use was quite easy,” says
Proshanta Sarkar, blockchain engineer and technical lead for the project at Henkel. “We
thought about Quorum and Ethereum, but for a permissioned blockchain, we found
Hyperledger Fabric is the best.” Everyone agreed on that choice.

Completing a production-ready network


To build out the full blockchain network, Microsoft recommended KrypC, an experienced
solution provider that was already operating several other networks built with Hyperledger
Fabric. The two sponsors asked for maximum flexibility to accommodate any company in
Europe, whatever its size, industry, IT environment, or technical skills. So KrpyC built a
very flexible network, where any member can run their own node or use a managed node;
write their own APIs or have those written for them; and process a small, medium, or large
number of tax forms.

Creating an association to promote the network


The next challenge is to persuade more companies to join the network. But when you’ve
done something the same way for many years, change is never easy. “To be honest, the tax
and customs authorities didn’t invest much in digitalization over the last few decades. They
still work mostly with paper forms or PDFs in the best case,” says Rubbert. “So to close the
gap, huge investments in networks and qualified people will be necessary.”

Extending the network with new partners and further forms


In a huge vote of confidence for its innovative design, taXchain recently won the
prestigious Taxcellence award from Handelsblatt, a renowned financial newspaper in
Germany. This gave the network a big boost in visibility. And the taXchain sponsors
continue to share their vision with colleagues, suppliers, and other companies. “The whole
idea was to build one platform where different companies can have different use cases
related to tax and customs, available to members through some sort of app store,” says
Chatelain. “That’s why we chose the name taXchain, a combination of ‘tax data exchange’
and ‘blockchain.’”
Since all businesses in the EU use the same forms, every member will benefit from a better,
faster, and cheaper way to handle each new form added to the network.
The next few goals for the taXchain network include:
• Implementing more tax and customs forms
• Engaging suppliers to use the network
• Signing up 10 or so large companies
Experiment – 8

Aim: Build blockchain using python.


A blockchain is an open-source application that is shared between thousands of computers.
These computers follow a set of rules in order to track money that has been sent from accounts
tied to the blockchain software. These qualities are mandatory in order to maintain the
Blockchain's integrity and the network security within which the transactions occur.
We have divided the process of building a blockchain into several steps for better
understanding. These steps are as follows:

Step 1: Creating a Blockchain class


Step 2: Writing a Function to build New Blocks
Step 3: Writing Functions to create New Transactions and get the Last Block Step 4:
Writing a Function to "Hash" the Blocks
Step 5: Creating a New Blockchain and Sending some money

Python Code:
# importing the required libraries
import hashlib
import json
from time import time
# creating the Block_chain class
class Block_chain(object):
def init (self):
self.chain = []
self.pendingTransactions = []
self.newBlock(previousHash = "The Times 03/Jan/2009 Chancellor on brink of
second bailout for banks.", the_proof = 100)

# Creating a new block listing key/value pairs of #


block information in a JSON object.
# Reset the list of pending transactions & #
append the newest block to the chain.

def newBlock(self, the_proof, previousHash = None):


the_block = {
'index': len(self.chain) + 1,
'timestamp': time(),
'transactions': self.pendingTransactions, 'proof':
the_proof,
'previous_hash': previousHash or self.hash(self.chain[-1]),
}

self.pendingTransactions = []
self.chain.append(the_block)
return the_block
#Searching the blockchain for the most recent block.
@property

def lastBlock(self):
return self.chain[-1]
# Adding a transaction with relevant info to the 'blockpool' - list of pending tx's. def
newTransaction(self, the_sender, the_recipient, the_amount): the_transaction = {
'sender': the_sender,
'recipient': the_recipient,
'amount': the_amount
}

self.pendingTransactions.append(the_transaction) return
self.lastBlock['index'] + 1
# receiving one block. Turning it into a string, turning that into # Unicode
(for hashing). Hashing with SHA256 encryption,
# then translating the Unicode into a hexidecimal string. def
hash(self, the_block):

stringObject = json.dumps(the_block, sort_keys = True)


blockString = stringObject.encode()
rawHash = hashlib.sha256(blockString)
hexHash = rawHash.hexdigest()
return hexHash
block_chain =
Block_chain()
transaction1 = block_chain.newTransaction("Satoshi", "Alex", '10 BTC')
transaction2 = block_chain.newTransaction("Alex", "Satoshi", '2 BTC') transaction3 =
block_chain.newTransaction("Satoshi", "James", '10 BTC') block_chain.newBlock(10123)
transaction4 = block_chain.newTransaction("Alex", "Lucy", '2 BTC')
transaction5 = block_chain.newTransaction("Lucy", "Justin", '1 BTC')
transaction6 = block_chain.newTransaction("Justin", "Alex", '1 BTC')
block_chain.newBlock(10384)
print("Genesis block: ", block_chain.chain)

You might also like