Unit Iii BCT
Unit Iii BCT
Unit Iii BCT
:1
BLOCKCHAIN TECHNOLOGY
UNIT III:
Bitcoin Basics:Bitcoin Blockchain, Challenges and solutions, proof of work, proof of stake, alternatives to Bitcoin
consensus, Bitcoin scripting language and their use. Blockchain Network, Life of Blockchain application, Soft & Hard
Fork, Private and Public Blockchain.
BITCOIN
There are a number of currencies in this world used for trading amenities. Rupee, Dollar, Pound Euro, and Yen are
some of them. These are printed currencies and coins and you might be having one of these in your wallet. But
bitcoin is a currency you can not touch, you can not see but you can efficiently use it to trade amenities.
It is an electronically stored currency. It can be stored in your mobiles, computers, or any storage media as a virtual
currency.
Bitcoin is an innovative digital payment system. It is an example of a cryptocurrency and the next big thing in
finance.
It is a virtual currency designed to act as money and outside the control of any person or group thus eliminating
the need for third-party in financial transactions.
It is used as a reward for the miners in bitcoin mining.
It can be purchased on several exchanges.
There are 3 ways you can get a bitcoin in your electronic storage:
1. Trade Money For Bitcoin: Say that the value of a bitcoin is 1 lakh rupees, so if you want a bitcoin, you can
trade a bitcoin in place of 1 lakh rupees. This Bitcoin will further be stored in your electronic storage media
which you can further use.
2. Trade Goods For Bitcoin: Say that the value of a bitcoin is 1 lakh rupees and you have a commodity that has
its value as 1 lakh rupees, so you can trade that commodity in place of a bitcoin, and the bitcoin will be stored
in your electronic storage media.
3. Mine Bitcoins: Other than trading, you can also mine bitcoins. Since it is a decentralized currency, there is no
authority that brings bitcoins into the market. Bitcoins only come into the market by mining them.
Brief History:
“Satoshi Nakamoto” is presumed to be the pen name for the person or people who designed the original bitcoin.
Bitcoin was first introduced in the year 2009 as a medium of exchange. Bitcoin then started as a peer-to-peer
network to generate a system for electronic transactions. Since then, there has been a rapid growth in the usage as
well as the value of bitcoin which is a popular system of digital currency.
Features:
Distributed: All bitcoin transactions are recorded in a public ledger known as the blockchain. There are nodes
in the network that maintain copies of the ledger and contribute to the correct propagation of the transactions
following the rules of the protocols making it impossible for the network to suffer downtime.
Decentralized: There is no third party or no CEO who controls the bitcoin network. The network consists of
willing participants who agree to the rules of a protocol and changes to the protocol are done by
the consensus of its users. This makes bitcoin a quasi-political system.
Transparent: The addition of new transactions to the blockchain ledger and the state of the bitcoin network is
arrived upon by consensus in a transparent manner according to the rules of the protocol.
Peer-to-peer: In Bitcoin transactions, the payments go straight from one party to another party so there is no
need for any third party to act as an intermediary.
Censorship resistant: As bitcoin transactions are pseudo-anonymous and users possess the keys to their bitcoin
holdings, so it is difficult for the authorities to ban users from using their assets. This provides economic
freedom to the users.
Public: All bitcoin transactions are available publicly for everyone to see. All the transactions are recorded,
which eliminates the possibility of fraudulent transactions.
Permissionless: Bitcoin is completely open access and ready to use for everyone, there are no complicated
rules of entry. Any transaction that follows the set algorithm will be processed with certainty.
Pseudo-anonymous: Bitcoin transactions are tied to addresses that take the form of randomly generated
alphanumeric strings.
Value of Bitcoin
A normal piece of paper and a currency note is physically the same but the value of the note is decided by an
authority or a centralized government. But Bitcoin is a currency that does not have any centralized government or
authority to control and decide its value. It is a decentralized digital currency.
As of now, the value of 1 bitcoin is 23,54,953.68 Indian Rupees but this value fluctuates as there is no
centralized authority to control it.
In December 2011, the value of a Bitcoin was estimated to be 2 US dollars, in December 2013, it went up to
about 1000 US dollars.
How Do Bitcoin Transactions Work?
Bitcoin transactions are digitally signed for security. Everyone on the network gets to know about a transaction.
Anyone can create a bitcoin wallet by downloading the bitcoin program. Each bitcoin wallet has two things:
Public key: It is like an address or an account number via which any user or account can receive bitcoins.
Private key: It is like a digital signature via which anyone can send bitcoins.
The public key can be shared with anyone but the private key must be held by the owner. If the private key gets
hacked or stolen then bitcoin gets lost.
A bitcoin transaction contains three pieces of information:
Private key: The first part contains the bitcoin wallet address of the sender i.e. the private key.
Amount of bitcoin to be transferred: The second part contains the amount that has been sent.
Public key: The third part contains the bitcoin wallet address of the recipient i.e. the public key.
Bitcoin transactions are verified by the nodes on the network. Once the transaction is verified and executed
successfully, the transaction is recorded in a distributed public ledger called a blockchain. A bitcoin can also be
considered as an invisible currency with only the transaction records between different addresses.
How Do Bitcoins Come Into Market?
Bitcoins are a decentralized currency, they aren’t printed, like rupees, they’re produced by people, and big
companies, running computers all around the world, using software that solves mathematical problems.
Bitcoins are mined using the computing power of the distributed network. This network also processes
transactions made using Bitcoin.
Bitcoins are mined on the basis of computing power, so they take time to be generated.
To keep it valuable, it has been stated that only 21 million bitcoins can be created by miners. By the year 2140,
all the bitcoins will be created.
Around the world, thousands of computers with very high computing power are processing transactions and
securing the network by solving complex mathematical calculations and collecting new bitcoins in exchange.
How Does Bitcoin Mining Work?
In the Bitcoin network, there are nodes that use the computing power of their CPU to process the transactions. The
following are the steps followed while mining a bitcoin:
The user initiates the bitcoin transaction by listing the details like the number of bitcoins to be sent, and the
public address, and affixing the private key to generate a digital signature. The encrypted information to the
miners present on the network.
The miners will verify the transaction to check whether there is sufficient balance to carry out the transaction.
The faster the CPU of a miner, the greater the chances for the miner to get rewarded for verifying the
transaction. The miner’s job is only to provide the CPU, there is no manual intervention from the miner. The
bitcoin program will run automatically on the system.
Once the transaction is verified, the number of transactions is broadcasted to the network of miners who can
copy or download the block.
These blocks through timestamps are stored in sequential order to form a blockchain.
Each miner in the network must have an updated copy of the blockchain ledger in order to earn bitcoins.
How Do You Buy Bitcoin?
There are three ways to get a bitcoin:
1. Buying: Many marketplaces like Bitcoin exchanges allow users to buy or sell bitcoins using different currencies.
If one does not want to mine a bitcoin, it can be bought using a cryptocurrency exchange. Most people will not be
able to purchase the entire BTC due to its price, so it is possible to buy portions of BTC on these exchanges in fiat
currency like U.S. Dollars. The following steps can be followed to buy bitcoin outside the online exchanges:
Each person who joins the bitcoin network is issued a public key and a private key.
When a person buys a bitcoin or sends/receives it, the person will receive a public key.
The person can only access the bitcoin using the private key (it has) with the public key (it received).
2. Complexity of Usage: The process of buying, storing, and using cryptocurrencies can be complex for many
people, leading to a barrier to adoption. Possible solutions include the development of simplified, user-friendly
wallets and exchanges, increased integration with traditional financial systems, and partnerships with existing
institutions to provide accessible entry points for new users.
3. Regulatory Uncertainty: The regulatory landscape for cryptocurrencies remains uncertain in many countries,
creating uncertainty for potential adopters and businesses considering incorporating cryptocurrencies into their
operations. Possible solutions include clear and consistent regulation and guidance, collaboration between
regulators and the crypto industry, and advocacy for the technology at a governmental level.
4. Interoperability and Scalability: Cryptocurrencies must be able to seamlessly interact with existing financial
systems and scale to handle increased usage if they are to reach mass adoption. Possible solutions include
development of standardized protocols and API, integration with existing financial infrastructure, and investment
in research and development to improve scalability.
Addressing these challenges and limitations is crucial for the widespread adoption of cryptocurrencies. For this to
happen, the crypto industry, governments, and regulators need to work together, and the technology needs to keep
getting better and more advanced.
Bitcoin and other prominent cryptocurrencies have gained much attention over the last several years. Globally
known as digital coin and virtual currency, this cryptocurrency is gained and traded within the blockchain system.
The blockchain technology adopted in using cryptocurrency has raised eyebrows within the banking sector,
government, stakeholders, and individual investors. The rise of the cryptocurrency within this decade since the
inception of Bitcoin in 2009 has taken the market by storm. Cryptocurrency is anticipated as the future currency
that might replace the current paper currency worldwide. Even though the interest has caught the attention of
users, many are not aware of its opportunities, drawbacks, and challenges for the future. Research on
cryptocurrencies is still lacking and still at its infancy stage.
Bitcoin is the oldest and currently the highest valued cryptocurrency in the market. According to
Coinmarketcap.com, BTC’s present market capitalization is US$825.61 billion. However, bitcoin and many other
cryptocurrencies are faced with several challenges and hurdles. Some of these issues are well-known and are
spoken of quite often, but some have an ethical, social, technological, and political impact, and BTC is currently
facing these issues. This article provides a list of the 10 most prominent challenges faced by bitcoin is presently
facing.
Volatility
Bitcoin has been incredibly volatile since it was created. Experts predict that the price of BTC coins might reach as
high as a million in a few years, and some say that it might even go down to zero. This environment has made bitcoin
extremely popular among investors who believe that the price may rise even more, but it some fall significantly.
Cybertheft
Several guidelines exist to make BTC almost impossible to steal, but taking advantage of this system requires intricate
knowledge about bitcoin’s working system and significantly more effort on the part of the user. In fact, many reports
suggest that buyers lose their investments on exchanges and mining losses. Also, exchanges can be hacked despite the
presence of a smart wallet.
Inability to self-regulate
Due to the lack of accountability on bitcoin, it is difficult to regulate its market behavior solely depending on the
financial incentives. This causes several problems like smart contracts and other hacks plaguing the market, scammers
can create fake investment crowdfunding and then run off with the money, and other related consequences. If bitcoin
cannot be regulated internally, buyers will easily lose confidence to invest.
Tax issues
Presently, under the law, BTC is considered as intangible property, which means they are subjected to capital gains
taxes. If the investors buy bitcoin and sell it at a higher price, they will be required to show the difference in their taxes.
Every time the investors buy something with BTC, it will be a taxable event.
Scalability
The underlying technology behind Bitcoin is blockchain, which limits the amount of information that can be contained
in each block to 1 megabyte of data. This limitation allows the network capacity of three transactions per second. As
more and more transactions are executed, the more difficulty the network will face to keep up the records, resulting in
serious processing delays.
Very less mainstream adoption
Over the years, it has become easier to buy, sell, and use bitcoin, but still there are not many user-friendly investors to
encourage mainstream adoption. If an average person would want to buy BTC, he or she would have to open an
Proof Of Work
Proof of work (PoW) is a form of adding new blocks of transactions to a cryptocurrency's blockchain. The work, in
this case, is generating a hash (a long string of characters) that matches the target hash for the current block.
The crypto miner who does this wins the right to add that block to the blockchain and receive rewards.
Cryptocurrency started with proof of work since it's the consensus mechanism used by the first
cryptocurrency, Bitcoin (BTC 6.14%). It's well-known for its security but also for inefficiency and a heavy
environmental impact.
Example of proof of work
Here's an example of how Bitcoin uses proof of work to maintain the integrity of its blockchain.
When Bitcoin transactions occur, they go through a security verification and are grouped into a block to be mined.
Bitcoin's proof-of-work algorithm then generates a hash for the block. The algorithm Bitcoin uses is called SHA-256,
and it always generates hashes with 64 characters.
Miners race to be the first to generate a target hash that's below the block hash. The winner gets to add the latest block
of transactions to Bitcoin's blockchain. They also receive Bitcoin rewards in the form of newly minted coins and
transaction fees. Bitcoin has a fixed maximum supply of 21 million coins, but, after that, miners will continue
receiving transaction fees for their service.
The proof-of-work algorithm used by Bitcoin aims to add a new block every 10 minutes. To do that, it adjusts the
difficulty of mining Bitcoin depending on how quickly miners are adding blocks. If mining is happening too quickly,
the hash computations get harder. If it's going too slowly, they get easier.
Proof Of Stake
Proof of stake (PoS) is an approach used in the cryptocurrency industry to help validate transactions.
When a transaction occurs with a cryptocurrency, a corresponding change on the blockchain on which the
cryptocurrency is based needs to occur. All cryptocurrencies use blockchain technology at the foundation, providing a
RAJESWARI COLLEGE OF ARTS AND SCIENCE FOR WOMEN,BOMMAYAPALAYAM-MS.K.RATHI DEVI-DEPT. OF CS
III UNIT-III – BLOCKCHAIN TECHNOLOGY Page No.:6
distributed ledger of transactions. Blockchain provides a set of distributed nodes in a decentralized approach and
validating that a transaction has occurred requires some form of consensus to ensure integrity.
Validating transactions to the cryptocurrency's blockchain ledger can occur in many different distributed approaches
known as consensus algorithms, including PoS and proof of work (PoW). Both methods achieve the same result of
validating a transaction by adding a new block to the underlying blockchain of the cryptocurrency.
Benefits of proof of stake
The PoS consensus mechanism offers several benefits to the cryptocurrency platforms that support the approach,
including the following:
Smaller resource requirements. The ability to add a node to the blockchain, requires less computing power.
Lower energy utilization. With the need for less computing power comes a corresponding decline in the amount
of energy consumed in order to validate a transaction.
Speed. A node can be added quicker with PoS, enabling faster transaction throughput.
Scalability. The PoS-based approach has the potential to be more scalable than PoW as the requirements and
resources to have a stake may be lower than the hardware and energy costs of PoW.
Challenges of proof of stake
While there are numerous benefits to using PoS, there are some challenges, including the following:
Potential for undue influence. A key promise of cryptocurrencies is that they are decentralized. With the need to
stake coins, it is possible that a large stakeholder could exert significant influence on the validation of transactions
on a blockchain network.
Staking conditions. With PoS, it is possible that the stake will be tied up in a smart contract for a longer period.
Security concerns. There are concerns that PoS is less secure as there is less effort required for validation and the
potential for influence from large stakeholders. PoS also does not have the same volume of transactions or history
as PoW, and as such has not yet been tested at the same scale.
Proof of stake cryptocurrencies
In the ever-growing world of cryptocurrencies, there is an expanding list of those that use PoS as a consensus
mechanism, including the following:
Avalanche (AVAX). Avalanche aims to help enable the development of dApps (decentralized applications) and
was created in September 2020.
Cardano (ADA). Cardano provides smart contract capabilities and was founded in 2015 by the co-founder of
Ethereum, Charles Hoskinson.
Cosmos (ATOM). Cosmos was created by the Interchain Foundation (ICF) in 2014 to build an open source
blockchain technology.
EOS (EOS). EOS has its own blockchain that was first publicly released in January 2018 with the aim of
accelerating smart contracts.
Ethereum (ETH). Ethereum is one of the most widely owned and used cryptocurrencies and moved to PoS in
September 2022.
Peercoin (PPC). Peercoin claims to have been the first to implement the PoS approach and got its start in 2012.
Solana (SOL). Solana launched in 2017 and aims to be an efficient platform for transaction processing.
3. Escrow transactions - Escrow transactions are another common use case for Bitcoin Script. An escrow
transaction allows two parties to send Bitcoin to a third party, who will hold the Bitcoin until certain conditions
are met. For example, the Bitcoin might be released to one party once a product has been delivered.
4. Bitcoin wallets - Bitcoin wallets like Electrum, Bitcoin Core, and Trezor all use Bitcoin Script to create and
verify transactions.
5. Bitcoin exchanges - Bitcoin exchanges like Coinbase, Binance, and Kraken all use Bitcoin Script to process
transactions on their platforms.
6. Decentralized applications (dApps) - Many decentralized applications built on top of the Bitcoin network use
Bitcoin Script to create smart contracts. For example, the Lightning Network, which is a layer-2 scaling solution
for Bitcoin, uses Bitcoin Script to enable instant micropayments.
7. Bitcoin payment processors - Bitcoin payment processors like BitPay and CoinPayments use Bitcoin Script to
process payments and verify transactions.
8. Gambling sites - Some online gambling sites use Bitcoin Script to create provably fair games. These games use
cryptographic algorithms to ensure that the outcome of each game is fair and random.
9. Blockchain explorers - Blockchain explorers like Blockchair and Blockchain.info use Bitcoin Script to parse and
analyze transactions on the Bitcoin network.
BLOCKCHAIN NETWORK
Blockchain network
This topic will describe, at a conceptual level, how Hyperledger Fabric allows organizations to collaborate in
the formation of blockchain networks. If you’re an architect, administrator or developer, you can use this topic
to get a solid understanding of the major structure and process components in a Hyperledger Fabric blockchain
network. This topic will use a manageable worked example that introduces all of the major components in a
blockchain network.
After reading this topic and understanding the concept of policies, you will have a solid understanding of the
decisions that organizations need to make to establish the policies that control a deployed Hyperledger Fabric
network. You’ll also understand how organizations manage network evolution using declarative policies – a key
feature of Hyperledger Fabric. In a nutshell, you’ll understand the major technical components of Hyperledger
Fabric and the decisions organizations need to make about them.
A blockchain network is a technical infrastructure that provides ledger and smart contract (chaincode) services
to applications. Primarily, smart contracts are used to generate transactions which are subsequently distributed
to every peer node in the network where they are immutably recorded on their copy of the ledger. The users of
applications might be end users using client applications or blockchain network administrators.
In most cases, multiple organizations come together as a consortium to form the network and their permissions
are determined by a set of policies that are agreed by the consortium when the network is originally configured.
Moreover, network policies can change over time subject to the agreement of the organizations in the
consortium, as we’ll discover when we discuss the concept of modification policy.
Before we start, let’s show you what we’re aiming at! Here’s a diagram representing the final state of our
sample network.
Don’t worry that this might look complicated! As we go through this topic, we will build up the network piece
by piece, so that you see how the organizations R1, R2, R3 and R4 contribute infrastructure to the network to
help form it. This infrastructure implements the blockchain network, and it is governed by policies agreed by
the organizations who form the network – for example, who can add new organizations. You’ll discover how
applications consume the ledger and smart contract services provided by the blockchain network.
Four organizations, R1, R2, R3 and R4 have jointly decided, and written into an agreement, that they will set up
and exploit a Hyperledger Fabric network.
R4 has been assigned to be the network initiator – it has been given the power to set up the initial version of the
network. R4 has no intention to perform business transactions on the network. R1 and R2 have a need for a
private communications within the overall network, as do R2 and R3.
Organization R1 has a client application that can perform business transactions within channel C1. Organization
R2 has a client application that can do similar work both in channel C1 and C2. Organization R3 has a client
application that can do this on channel C2. Peer node P1 maintains a copy of the ledger L1 associated with C1.
Peer node P2 maintains a copy of the ledger L1 associated with C1 and a copy of ledger L2 associated with C2.
Peer node P3 maintains a copy of the ledger L2 associated with C2.
The network is governed according to policy rules specified in network configuration NC4, the network is under
the control of organizations R1 and R4. Channel C1 is governed according to the policy rules specified in
channel configuration CC1; the channel is under the control of organizations R1 and R2. Channel C2 is
governed according to the policy rules specified in channel configuration CC2; the channel is under the control
of organizations R2 and R3.
There is an ordering service O4 that services as a network administration point for N, and uses the system
channel. The ordering service also supports application channels C1 and C2, for the purposes of transaction
ordering into blocks for distribution. Each of the four organizations has a preferred Certificate Authority.
Creating the Network
Let’s start at the beginning by creating the basis for the network:
The network is formed when an orderer is started. In our example network, N, the ordering service comprising a
single node, O4, is configured according to a network configuration NC4, which gives administrative rights to
organization R4. At the network level, Certificate Authority CA4 is used to dispense identities to the
administrators and network nodes of the R4 organization.
Certificate Authorities
We can also see a Certificate Authority, CA4, which is used to issue certificates to administrators and network
nodes. CA4 plays a key role in our network because it dispenses X.509 certificates that can be used to identify
components as belonging to organization R4. Certificates issued by CAs can also be used to sign transactions to
indicate that an organization endorses the transaction result – a precondition of it being accepted onto the ledger.
Let’s examine these two aspects of a CA in a little more detail.
Firstly, different components of the blockchain network use certificates to identify themselves to each other as
being from a particular organization. That’s why there is usually more than one CA supporting a blockchain
network – different organizations often use different CAs. We’re going to use four CAs in our network; one for
each organization. Indeed, CAs are so important that Hyperledger Fabric provides you with a built-in one
(called Fabric-CA) to help you get going, though in practice, organizations will choose to use their own CA.
The mapping of certificates to member organizations is achieved by via a structure called a Membership
Services Provider (MSP). Network configuration NC4 uses a named MSP to identify the properties of
certificates dispensed by CA4 which associate certificate holders with organization R4. NC4 can then use this
MSP name in policies to grant actors from R4 particular rights over network resources. An example of such a
policy is to identify the administrators in R4 who can add new member organizations to the network. We don’t
show MSPs on these diagrams, as they would just clutter them up, but they are very important.
Secondly, we’ll see later how certificates issued by CAs are at the heart of the transaction generation and
validation process. Specifically, X.509 certificates are used in client application transaction proposals and smart
contract transaction responses to digitally sign transactions. Subsequently the network nodes who host copies of
the ledger verify that transaction signatures are valid before accepting transactions onto the ledger.
Let’s recap the basic structure of our example blockchain network. There’s a resource, the network N, accessed
by a set of users defined by a Certificate Authority CA4, who have a set of rights over the resources in the
network N as described by policies contained inside a network configuration NC4. All of this is made real when
we configure and start the ordering service node O4.
Organization R4 updates the network configuration to make organization R1 an administrator too. After this
point R1 and R4 have equal rights over the network configuration.
RAJESWARI COLLEGE OF ARTS AND SCIENCE FOR WOMEN,BOMMAYAPALAYAM-MS.K.RATHI DEVI-DEPT. OF CS
III UNIT-III – BLOCKCHAIN TECHNOLOGY Page No.:11
We see the addition of a new organization R1 as an administrator – R1 and R4 now have equal rights over the
network. We can also see that certificate authority CA1 has been added – it can be used to identify users from
the R1 organization. After this point, users from both R1 and R4 can administer the network.
Although the orderer node, O4, is running on R4’s infrastructure, R1 has shared administrative rights over it, as
long as it can gain network access. It means that R1 or R4 could update the network configuration NC4 to allow
the R2 organization a subset of network operations. In this way, even though R4 is running the ordering service,
and R1 has full administrative rights over it, R2 has limited rights to create new consortia.
In its simplest form, the ordering service is a single node in the network, and that’s what you can see in the
example. Ordering services are usually multi-node, and can be configured to have different nodes in different
organizations. For example, we might run O4 in R4 and connect it to O1, a separate orderer node in
organization R1. In this way, we would have a multi-site, multi-organization administration structure.
We’ll discuss the ordering service a little later in this topic, but for now just think of the ordering service as an
administration point which provides different organizations controlled access to the network.
Defining a Consortium
Although the network can now be administered by R1 and R4, there is very little that can be done. The first
thing we need to do is define a consortium. This word literally means “a group with a shared destiny”, so it’s an
appropriate choice for a set of organizations in a blockchain network.
Let’s see how a consortium is defined:
A network administrator defines a consortium X1 that contains two members, the organizations R1 and R2. This
consortium definition is stored in the network configuration NC4, and will be used at the next stage of network
development. CA1 and CA2 are the respective Certificate Authorities for these organizations.
Because of the way NC4 is configured, only R1 or R4 can create new consortia. This diagram shows the
addition of a new consortium, X1, which defines R1 and R2 as its constituting organizations. We can also see
that CA2 has been added to identify users from R2. Note that a consortium can have any number of
organizational members – we have just shown two as it is the simplest configuration.
Why are consortia important? We can see that a consortium defines the set of organizations in the network who
share a need to transact with one another – in this case R1 and R2. It really makes sense to group organizations
together if they have a common goal, and that’s exactly what’s happening.
The network, although started by a single organization, is now controlled by a larger set of organizations. We
could have started it this way, with R1, R2 and R4 having shared control, but this build up makes it easier to
understand.
We’re now going to use consortium X1 to create a really important part of a Hyperledger Fabric blockchain – a
channel.
A channel C1 has been created for R1 and R2 using the consortium definition X1. The channel is governed
by a channel configuration CC1, completely separate to the network configuration NC4. CC1 is managed
by R1 and R2 who have equal rights over C1. R4 has no rights in CC1 whatsoever.
The channel C1 provides a private communications mechanism for the consortium X1. We can see channel
C1 has been connected to the ordering service O4 but that nothing else is attached to it. In the next stage of
network development, we’re going to connect components such as client applications and peer nodes. But
at this point, a channel represents the potential for future connectivity.
Even though channel C1 is a part of the network N, it is quite distinguishable from it. Also notice that
organizations R3 and R4 are not in this channel – it is for transaction processing between R1 and R2. In the
previous step, we saw how R4 could grant R1 permission to create new consortia. It’s helpful to mention
that R4 also allowed R1 to create channels! In this diagram, it could have been organization R1 or R4 who
created a channel C1. Again, note that a channel can have any number of organizations connected to it –
we’ve shown two as it’s the simplest configuration.
Again, notice how channel C1 has a completely separate configuration, CC1, to the network configuration
NC4. CC1 contains the policies that govern the rights that R1 and R2 have over the channel C1. An
example of these policies is defining who can add a new organization to the channel. In our example,
organizations other than R1 and R2 have no permissions over the channel C1 and can only interact with it if
they are added by R1 or R2 to the appropriate policy in the channel configuration CC1. Specifically, note
that R4 cannot add itself to the channel C1. It must, and can only, be authorized by R1 or R2.
Why are channels so important? Channels are useful because they provide a mechanism for private
communications and private data between the members of a consortium. Channels provide privacy from
other channels, and from the network. Hyperledger Fabric is powerful in this regard, as it allows
organizations to share infrastructure and keep it private at the same time. There’s no contradiction here –
different consortia within the network will have a need for different information and processes to be
appropriately shared, and channels provide an efficient mechanism to do this. Channels provide an efficient
sharing of infrastructure while maintaining data and communications privacy.
We can also see that once a channel has been created, it is in a very real sense “free from the network”. It is
only organizations that are explicitly specified in a channel configuration that have any control over it,
from this time forward into the future. Likewise, any updates to network configuration NC4 from this time
onwards will have no direct effect on channel configuration CC1; for example if consortia definition X1 is
changed, it will not affect the members of channel C1. Channels are therefore useful because they allow
private communications between the organizations constituting the channel. Moreover, the data in a
channel is completely isolated from the rest of the network, including other channels.
As an aside, there is also a special system channel defined for use by the ordering service. It behaves in
exactly the same way as a regular channel, which are sometimes called application channels for this
reason. We don’t normally need to worry about this channel, but we’ll discuss a little bit more about it later
in this topic.
A peer node P1 has joined the channel C1. P1 physically hosts a copy of the ledger L1. P1 and O4 can
communicate with each other using channel C1.
Peer nodes are the network components where copies of the blockchain ledger are hosted! At last, we’re
starting to see some recognizable blockchain components! P1’s purpose in the network is purely to host a
copy of the ledger L1 for others to access. We can think of L1 as being physically hosted on P1,
but logically hosted on the channel C1. We’ll see this idea more clearly when we add more peers to the
channel.
A key part of a P1’s configuration is an X.509 identity issued by CA1 which associates P1 with
organization R1. When R1 administrator takes the action of joining peer P1 to channel C1, and the peer
starts pulling blocks from the orderer O4, the orderer uses the channel configuration CC1 to determine P1’s
permissions on this channel. For example, policy in CC1 determines whether P1 (or the organization R1)
can read and/or write on the channel C1.
Notice how peers are joined to channels by the organizations that own them, and though we’ve only added
one peer, we’ll see how there can be multiple peer nodes on multiple channels within the network. We’ll
see the different roles that peers can take on a little later.
Now that the channel C1 has a ledger on it, we can start connecting client applications to consume some of the
services provided by workhorse of the ledger, the peer. Notice how the network has grown:
A smart contract S5 has been installed onto P1. Client application A1 in organization R1 can use S5 to access
the ledger via peer node P1. A1, P1 and O4 are all joined to channel C1, i.e. they can all make use of the
communication facilities provided by that channel.
In the next stage of network development, we can see that client application A1 can use channel C1 to connect
to specific network resources – in this case A1 can connect to both peer node P1 and order-er node O4. Again,
see how channels are central to the communication between network and organization components. Just like
RAJESWARI COLLEGE OF ARTS AND SCIENCE FOR WOMEN,BOMMAYAPALAYAM-MS.K.RATHI DEVI-DEPT. OF CS
III UNIT-III – BLOCKCHAIN TECHNOLOGY Page No.:14
peers and orderers, a client application will have an identity that associates it with an organization. In our
example, client application A1 is associated with organization R1; and although it is outside the Fabric
blockchain network, it is connected to it via the channel C1.
It might now appear that A1 can access the ledger L1 directly via P1, but in fact, all access is managed via a
special program called a smart contract chain code, S5. Think of S5 as defining all the common access patterns
to the ledger; S5 provides a well-defined set of ways by which the ledger L1 can be queried or updated. In short,
client application A1 has to go through smart contract S5 to get to ledger L1!
Smart contracts can be created by application developers in each organization to implement a business process
shared by the consortium members. Smart contracts are used to help generate transactions which can be
subsequently distributed to every node in the network. We’ll discuss this idea a little later; it’ll be easier to
understand when the network is bigger. For now, the important thing to understand is that to get to this point
two operations must have been performed on the smart contract; it must have been installed on peers, and
then defined on a channel.
Hyperledger Fabric users often use the terms smart contract and chaincode interchangeably. In general, a
smart contract defines the transaction logic that controls the lifecycle of a business object contained in the
world state. It is then packaged into a chaincode which is then deployed to a blockchain network. Think of
smart contracts as governing transactions, whereas chaincode governs how smart contracts are packaged for
deployment.
Installing a chaincode package
After a smart contract S5 has been developed, an administrator in organization R1 must create a chaincode
package and install it onto peer node P1. This is a straightforward operation; once completed, P1 has full
knowledge of S5. Specifically, P1 can see the implementation logic of S5 – the program code that it uses to
access the ledger L1. We contrast this to the S5 interface which merely describes the inputs and outputs of S5,
without regard to its implementation.
When an organization has multiple peers in a channel, it can choose the peers upon which it installs smart
contracts; it does not need to install a smart contract on every peer.
Defining a chaincode
Although a chaincode is installed on the peers of individual organizations, it is governed and operated in the
scope of a channel. Each organization needs to approve a chaincode definition, a set of parameters that
establish how a chaincode will be used on a channel. An organization must approve a chaincode definition in
order to use the installed smart contract to query the ledger and endorse transactions. In our example, which
only has a single peer node P1, an administrator in organization R1 must approve a chaincode definition for S5.
A sufficient number of organizations need to approve a chaincode definition (A majority, by default) before the
chaincode definition can be committed to the channel and used to interact with the channel ledger. Because the
channel only has one member, the administrator of R1 can commit the chaincode definition of S5 to the channel
C1. Once the definition has been committed, S5 can now be invoked by client application A1!
Note that although every component on the channel can now access S5, they are not able to see its program
logic. This remains private to those nodes who have installed it; in our example that means P1. Conceptually
this means that it’s the smart contract interface that is defined and committed to a channel, in contrast to the
smart contract implementation that is installed. To reinforce this idea; installing a smart contract shows how
we think of it being physically hosted on a peer, whereas a smart contract that has been defined on a channel
shows how we consider it logically hosted by the channel.
Endorsement policy
The most important piece of information supplied within the chaincode definition is the endorsement policy. It
describes which organizations must approve transactions before they will be accepted by other organizations
onto their copy of the ledger. In our sample network, transactions can only be accepted onto ledger L1 if R1 or
R2 endorse them.
Committing the chaincode definition to the channel places the endorsement policy on the channel ledger; it
enables it to be accessed by any member of the channel. You can read more about endorsement policies in
the transaction flow topic.
Invoking a smart contract
Once a smart contract has been committed to a channel, it can be invoked by a client application. Client
applications do this by sending transaction proposals to peers owned by the organizations specified by the smart
contract endorsement policy. The transaction proposal serves as input to the smart contract, which uses it to
generate an endorsed transaction response, which is returned by the peer node to the client application.
The network has grown through the addition of infrastructure from organization R2. Specifically, R2 has added
peer node P2, which hosts a copy of ledger L1, and chaincode S5. R2 approves the same chaincode definition as
R1. P2 has also joined channel C1, as has application A2. A2 and P2 are identified using certificates from CA2.
All of this means that both applications A1 and A2 can invoke S5 on C1 either using peer node P1 or P2.
We can see that organization R2 has added a peer node, P2, on channel C1. P2 also hosts a copy of the ledger
L1 and smart contract S5. We can see that R2 has also added client application A2 which can connect to the
network via channel C1. To achieve this, an administrator in organization R2 has created peer node P2 and
joined it to channel C1, in the same way as an administrator in R1. The administrator also has to approve the
same chaincode definition as R1.
We have created our first operational network! At this stage in network development, we have a channel in
which organizations R1 and R2 can fully transact with each other. Specifically, this means that applications A1
and A2 can generate transactions using smart contract S5 and ledger L1 on channel C1.
Generating and accepting transactions
In contrast to peer nodes, which always host a copy of the ledger, we see that there are two different kinds of
peer nodes; those which host smart contracts and those which do not. In our network, every peer hosts a copy of
the smart contract, but in larger networks, there will be many more peer nodes that do not host a copy of the
smart contract. A peer can only run a smart contract if it is installed on it, but it can know about the interface of
a smart contract by being connected to a channel.
You should not think of peer nodes which do not have smart contracts installed as being somehow inferior. It’s
more the case that peer nodes with smart contracts have a special power – to help generate transactions. Note
that all peer nodes can validate and subsequently accept or reject transactions onto their copy of the ledger L1.
However, only peer nodes with a smart contract installed can take part in the process of
transaction endorsement which is central to the generation of valid transactions.
We don’t need to worry about the exact details of how transactions are generated, distributed and accepted in
this topic – it is sufficient to understand that we have a blockchain network where organizations R1 and R2 can
share information and processes as ledger-captured transactions. We’ll learn a lot more about transactions,
ledgers, smart contracts in other topics.
Types of peers
In Hyperledger Fabric, while all peers are the same, they can assume multiple roles depending on how the
network is configured. We now have enough understanding of a typical network topology to describe these
roles.
The diagram shows the facts relating to channel C1 in the network N as follows: Client applications A1 and A2
can use channel C1 for communication with peers P1 and P2, and orderer O4. Peer nodes P1 and P2 can use the
communication services of channel C1. Ordering service O4 can make use of the communication services of
channel C1. Channel configuration CC1 applies to channel C1.
Note that the network diagram has been simplified by replacing channel lines with connection points, shown as
blue circles which include the channel number. No information has been lost. This representation is more
scalable because it eliminates crossing lines. This allows us to more clearly represent larger networks. We’ve
achieved this simplification by focusing on the connection points between components and a channel, rather
than the channel itself.
Adding another consortium definition
In this next phase of network development, we introduce organization R3. We’re going to give organizations R2
and R3 a separate application channel which allows them to transact with each other. This application channel
will be completely separate to that previously defined, so that R2 and R3 transactions can be kept private to
them.
Let’s return to the network level and define a new consortium, X2, for R2 and R3:
A network administrator from organization R1 or R4 has added a new consortium definition, X2, which
includes organizations R2 and R3. This will be used to define a new channel for X2.
A new channel C2 has been created for R2 and R3 using consortium definition X2. The channel has a
channel configuration CC2, completely separate to the network configuration NC4, and the channel
configuration CC1. Channel C2 is managed by R2 and R3 who have equal rights over C2 as defined by a
policy in CC2. R1 and R4 have no rights defined in CC2 whatsoever.
The channel C2 provides a private communications mechanism for the consortium X2. Again, notice how
organizations united in a consortium are what form channels. The channel configuration CC2 now contains
the policies that govern channel resources, assigning management rights to organizations R2 and R3 over
channel C2. It is managed exclusively by R2 and R3; R1 and R4 have no power in channel C2. For example,
channel configuration CC2 can subsequently be updated to add organizations to support network growth,
but this can only be done by R2 or R3.
Note how the channel configurations CC1 and CC2 remain completely separate from each other, and
completely separate from the network configuration, NC4. Again we’re seeing the de-centralized nature of
a Hyperledger Fabric network; once channel C2 has been created, it is managed by organizations R2 and
R3 independently to other network elements. Channel policies always remain separate from each other and
can only be changed by the organizations authorized to do so in the channel.
As the network and channels evolve, so will the network and channel configurations. There is a process by
which this is accomplished in a controlled manner – involving configuration transactions which capture the
change to these configurations. Every configuration change results in a new configuration block transaction
being generated, and later in this topic, we’ll see how these blocks are validated and accepted to create
updated network and channel configurations respectively.
Network and channel configurations
Throughout our sample network, we see the importance of network and channel configurations. These
configurations are important because they encapsulate the policies agreed by the network members, which
provide a shared reference for controlling access to network resources. Network and channel configurations
also contain facts about the network and channel composition, such as the name of consortia and its
organizations.
The diagram shows the facts relating to channels C1 and C2 in the network N as follows: Client applications A1
and A2 can use channel C1 for communication with peers P1 and P2, and ordering service O4; client
applications A3 can use channel C2 for communication with peer P3 and ordering service O4. Ordering service
O4 can make use of the communication services of channels C1 and C2. Channel configuration CC1 applies to
channel C1, CC2 applies to channel C2.
First of all, notice that because peer node P3 is connected to channel C2, it has a different ledger – L2 – to
those peer nodes using channel C1. The ledger L2 is effectively scoped to channel C2. The ledger L1 is
completely separate; it is scoped to channel C1. This makes sense – the purpose of the channel C2 is to provide
private communications between the members of the consortium X2, and the ledger L2 is the private store for
their transactions.
In a similar way, the smart contract S6, installed on peer node P3, and committed to channel C2, is used to
provide controlled access to ledger L2. Application A3 can now use channel C2 to invoke the services provided
by smart contract S6 to generate transactions that can be accepted onto every copy of the ledger L2 in the
network.
At this point in time, we have a single network that has two completely separate channels defined within it.
These channels provide independently managed facilities for organizations to transact with each other. Again,
this is de-centralization at work; we have a balance between control and autonomy. This is achieved through
policies which are applied to channels which are controlled by, and affect, different organizations.
Joining a peer to multiple channels
In this final stage of network development, let’s return our focus to organization R2. We can exploit the fact
that R2 is a member of both consortia X1 and X2 by joining it to multiple channels:
The diagram shows the facts relating to channels C1 and C2 in the network N as follows: Client applications A1
can use channel C1 for communication with peers P1 and P2, and ordering service O4; client application A2 can
use channel C1 for communication with peers P1 and P2 and channel C2 for communication with peers P2 and
A multi-organization ordering service. The ordering service comprises ordering service nodes O1 and O4. O1 is
provided by organization R1 and node O4 is provided by organization R4. The network configuration NC4
defines network resource permissions for actors from both organizations R1 and R4.
We can see that this ordering service completely de-centralized – it runs in organization R1 and it runs in
organization R4. The network configuration policy, NC4, permits R1 and R4 equal rights over network
resources. Client applications and peer nodes from organizations R1 and R4 can manage network resources by
connecting to either node O1 or node O4, because both nodes behave the same way, as defined by the policies
in network configuration NC4. In practice, actors from a particular organization tend to use infrastructure
provided by their home organization, but that’s certainly not always the case.
In this diagram we see that the Fabric blockchain network consists of two application channels and one ordering
channel. The organizations R1 and R4 are responsible for the ordering channel, R1 and R2 are responsible for
the blue application channel while R2 and R3 are responsible for the red application channel. Client
applications A1 is an element of organization R1, and CA1 is it’s certificate authority. Note that peer P2 of
organization R2 can use the communication facilities of the blue and the red application channel. Each
application channel has its own channel configuration, in this case CC1 and CC2. The channel configuration of
the system channel is part of the network configuration, NC4.
We’re at the end of our conceptual journey to build a sample Hyperledger Fabric blockchain network. We’ve
created a four organization network with two channels and three peer nodes, with two smart contracts and an
ordering service. It is supported by four certificate authorities. It provides ledger and smart contract services to
three client applications, who can interact with it via the two channels. Take a moment to look through the
details of the network in the diagram, and feel free to read back through the topic to reinforce your knowledge,
or go to a more detailed topic.
NETWORK COMPONENTS
Here’s a quick summary of the network components we’ve discussed:
Ledger. One per channel. Comprised of the Blockchain and the World state
Smart contract (aka chaincode)
Peer nodes
Ordering service
Channel
Certificate Authority
LIFE OF BLOCKCHAIN APPLICATION
Blockchain technology is mostly about the transactions that we make digitally for ourselves. Eventually, these
transactions make their way to the various blocks that become part of the Blockchain later on. So, it is important to
understand the transaction life cycle in Blockchain technology.
This lifecycle follows the journey of a single transaction as it makes its way through each stage in the process of
joining the blockchain. Transaction in simple words is the process of sending money by the sender and the receiver
receiving it. The Blockchain transaction is also quite similar, but it is made digitally.
Let us understand the various stages in a blockchain transaction life cycle with the help of an example.
Sourav and Suraj are two Bitcoin users. Sourav wants to send 1 bitcoin to Suraj.
1. First, Sourav gets Suraj’s wallet address (a wallet in the blockchain is a digital wallet that allows users to
manage their transactions). Using this information, he creates a new transaction for 1 bitcoins from his wallet
and includes a transaction fee of 0.003 bitcoin.
2. Next, he verifies the information and sends the transaction. Each transaction that is initiated is signed by a
digital signature of the sender that is basically the private key of the sender. This is done in order to make the
transaction more secure and to prevent any fraud.
RAJESWARI COLLEGE OF ARTS AND SCIENCE FOR WOMEN,BOMMAYAPALAYAM-MS.K.RATHI DEVI-DEPT. OF CS
III UNIT-III – BLOCKCHAIN TECHNOLOGY Page No.:24
3. Sourav’s wallet then starts the transaction signing algorithm which signs his transaction using his private key.
4. The transaction is now broadcasted to the memory pool within the network.
5. This transaction is eventually accepted by the miners. These miners, group this transaction into a block, find
the Proof of Work, and assign this block a hash value to be mapped into the blockchain.
6. This block is now placed on the Blockchain.
7. As this block gains confirmation, it is accepted as a valid transaction in the network.
8. Once this transaction is accepted, Suraj finally gets his bitcoin.
The below diagram is a pictorial representation of the various stages in a transaction life cycle as discussed above.
Moving Ahead:
Lets us see the different types of FORKS one by one:
TYPES OF FORKS
Basically forks are divided into two categories i.e. Codebase Fork and Live Blockchain Fork. And then Live
Blockchain Fork is divided into further two parts i.e. Intentional Fork and Accidental Fork, as you can see in the
above mentioned figure the Intentional fork is then further divided into two parts i.e. Soft Fork and Hard Fork.
TYPES OF FORKS:
CODEBASE FORK: In codebase blockchain fork you can copy the entire code of a particular software. Let
us take BITCOIN as an example, so suppose you copied the whole blockchain code and modified it according
to your need, say that you decreased the block creation time, made some crucial changes and created a faster
software than BITCOIN and publish / launch it has a new whole software named against you, by completing
the whole white paper work process. So in these way a new BLOCKCHAIN will be created from an empty
blank ledger. It’s a fact that many of these ALT COINS which are now running on the blockchain are been
made in these way only by using the codebase fork i.e. they have made little up and down changes in the code
of BITCOIN and created their whole new ALT COIN.
LIVE BLOCKCHAIN FORK: Live Blockchain fork means a running blockchain is been divided further into
two parts or two ways. So in live blockchain at a specific page the software is same and from that specific
point the chain is divided into two parts. So in context to this fork the Live Blockchain Fork can occur because
of two reasons :
ACCIDENTAL FORK / TEMPORARY FORK: When multiple miners mine a new block at nearly the same
time, the entire network may not agree on the choice of the new block. Some can accept the block mined by one
party, leading to a different chain of blocks from that point onward while others can agree on the other
alternatives (of blocks) available. Such a situation arises because it takes some finite time for the information to
propagate in the entire blockchain network and hence conflicted opinions can exist regarding the chronological
The future of blockchain forks is an area of great interest to many blockchain enthusiasts and experts. While it is
difficult to predict with certainty what will happen in the future, there are some trends and developments that may
give us an idea of what to expect.
One possibility is that we may see more soft forks in the future, as they are generally less disruptive to the
network and require less consensus to implement. Soft forks can be used to add new features to the blockchain
or to improve its efficiency, without creating a new cryptocurrency.
Another possibility is that we may see more contentious hard forks in the future, as different groups within the
community have different opinions on the direction of the blockchain. This could lead to more splits in the
community, as some users choose to continue using the old version of the blockchain while others switch to the
new version.
1. Access In this type of blockchain anyone can read, In this type of blockchain read and write is
write and participate in a blockchain. Hence, done upon invitation, hence it is a
it is permissionless blockchain. It is public to permissioned blockchain.
everyone.
7. Transactions pre Transactions per second are lesser in a public Transaction per second is more as
second blockchain. compared to public blockchain.
8. Security A public network is more secure due to A private blockchain is more prone to
decentralization and active participation. Due hacks, risks, and data breaches/
to the higher number of nodes in the network, manipulation. It is easy for bad actors to
it is nearly impossible for ‘bad actors’ to endanger the entire network. Hence, it is
attack the system and gain control over the less secure.
consensus network.
9. Energy A public blockchain consumes more energy Private blockchains consume a lot less
Consumption than a private blockchain as it requires a energy and power.
significant amount of electrical resources to
function and achieve network consensus.
10. Consensus Some are proof of work, proof of stake, proof Proof of Elapsed Time (PoET), Raft, and
algorithms of burn, proof of space etc. Istanbul BFT can be used only in case of
private blockchains.
11. Attacks In a public blockchain, no one knows who In a private blockchain, there is no chance
each validator is and this increases the risk of of minor collision. Each validator is known
potential collision or a 51% attack (a group of and they have the suitable credentials to be
miners which control more than 50% of the a part of the network.
network’s computing power.).
12. Effects Potential to disrupt current business models Reduces transaction cost and data
through disintermediation. There is lower redundancies and replace legacy systems,
infrastructure cost. No need to maintain simplifying documents handling and
servers or system admins radically. Hence getting rid of semi manual compliance
reducing the cost of creating and running mechanisms.
decentralized application (dApps).
13. Examples Bitcoin, Ethereum, Monero, Zcash, Dash, R3 (Banks), EWF (Energy), B3i
Litecoin, Stellar, Steemit etc. (Insurance), Corda.
----------------UNIT-III----------------