Book Image

Oracle Blockchain Quick Start Guide

By : Vivek Acharya, Anand Eswararao Yerrapati, Nimesh Prakash
Book Image

Oracle Blockchain Quick Start Guide

By: Vivek Acharya, Anand Eswararao Yerrapati, Nimesh Prakash

Overview of this book

Hyperledger Fabric empowers enterprises to scale out in an unprecedented way, allowing organizations to build and manage blockchain business networks. This quick start guide systematically takes you through distributed ledger technology, blockchain, and Hyperledger Fabric while also helping you understand the significance of Blockchain-as-a-Service (BaaS). The book starts by explaining the blockchain and Hyperledger Fabric architectures. You'll then get to grips with the comprehensive five-step design strategy - explore, engage, experiment, experience, and in?uence. Next, you'll cover permissioned distributed autonomous organizations (pDAOs), along with the equation to quantify a blockchain solution for a given use case. As you progress, you'll learn how to model your blockchain business network by defining its assets, participants, transactions, and permissions with the help of examples. In the concluding chapters, you'll build on your knowledge as you explore Oracle Blockchain Platform (OBP) in depth and learn how to translate network topology on OBP. By the end of this book, you will be well-versed with OBP and have developed the skills required for infrastructure setup, access control, adding chaincode to a business network, and exposing chaincode to a DApp using REST configuration.
Table of Contents (8 chapters)

Types of blockchain networks

Broadly, there are two kinds of blockchain network—public and private. Both are P2P networks, where the ledger is distributed among those that can participate in the transaction. The ledger copy is replicated among participants, and those parties that can execute append-only transactions to the ledger will hold a copy of the ledger and will participate to reach a consensus to add a block to the blockchain. Along with being public or private, a blockchain can be both permissionless (such as Bitcoin or Ethereum) and permissioned (such as the Hyperledger blockchain framework).

A permissionless blockchain is also known as a public blockchain because anyone can join the network. Permissionless P2P systems do not require a set amount of peers to be online and are generally slower. Parties communicate on a permissionless blockchain without verifying the transacting parties' identities. Anyone can join a permissionless blockchain such as Ethereum and can perform read and write transactions. As the actors are not known, there are chances of malicious actors being in a network.

Permissioned networks are the blockchain networks where only pre-authorized users or organizations can perform write transactions. By virtue of the limited nodes, they are faster and inexpensive, can comply with regulations, and can easily be maintained. Pre-verification of the participating parties is mandatory for a permissioned blockchain and, hence, transacting parties are made. Permissioned P2P networks have to guarantee uptime and require a high level of quality of service on communication links. Permissioned blockchains such as Hyperledger Fabric ensure that only transacting parties are part of the transaction and that records of the transaction are displayed to only those participants and not to the whole network. Hence, capabilities such as data privacy, immutability, and security are the primary capabilities that Hyperledger offers to enterprises.

Although there are two kinds of blockchain network—public and private – on permissions, they can be classified as PUBLIC AND PERMISSIONLESS, PUBLIC AND PERMISSIONED, PRIVATE AND PERMISSIONLESS, and PRIVATE AND PERMISSIONED, as shown in the following diagram:

Types of blockchain

Blockchain networks based on permissions can be classified as follows:

  • Public and permissionless blockchain: These are open and transparent and offer disintermediation and anonymity. They are trustless and offer immutability. This means they are open for anybody to join the blockchain network. The user (on a node) can enable his/her system with the required software and join the blockchain network. Public blockchain removes intermediaries, which reduces the cost, reduces the time it takes for reconciliation, and offers transparency in the network. Public blockchains are trustless, and trust is in the consensus. Transactions are replicated to each participating node, and consensus takes care of validation and synchronizes the transactions to be added to the blockchain. This allows trustless parties to execute transactions with confidence. The more nodes there are, the more impossible it becomes to undo a transaction; hence, public blockchain is immutable. Although transactions can be read by anyone, the identities of users are protected, hence offering anonymity.
  • Public and permissioned blockchain: These are scalable, cost-effective, transparent, and offer disintermediation and anonymity. Public and permissioned blockchain allows anyone to read transactions, but only a few permissioned users can write transactions (for example, government employees' salaries and real-estate registries). Alternatively, it can allow a few to read transactions and everyone to write transactions (for example, voting). Public and permissioned blockchain is designated for such use cases where people or authorities (such as a designated employee or institution) sanction a transaction with data that's viewable by the public. If a public and permissioned blockchain is of the type where it allows anyone to read it and only a few permissioned participants to write on it, then such a system does not need to be based on expensive consensus algorithms such as PoW. Such blockchain networks can be scalable. Not everyone will participate for validation, and a validator is chosen. Hence, it is not slow and costly compared to a public and permissionless network. Although there are no intermediaries, only a few institutes can read or write.
  • Private and permissionless blockchain: Only individual or selected members can run a full node to transact, validate, and read transactions. A few can execute write transactions and validate transactions, while everyone can read. It can be applied to use cases that include audits and are mostly adopted by enterprises that want to explore blockchain within the enterprise. All of the permissions are central to an enterprise; hence, they are not decentralized, and they can just be distributed. On the positive side, it allows the enterprise to be compliant and meet privacy needs to implement blockchain. Moreover, it allows cryptographic auditing. However, the whole idea of a decentralized network is lost.
  • Private and permissioned blockchain: Public blockchain leads to scenarios where we run one full node, which means the node is performing computation for all of the applications for that network. This slows down the performance of the blockchain network. This can be a fit for some use cases; however, for enterprise requirements, public blockchain is not the answer. Enterprises are looking for a blockchain network where a node performs only those computations that are required for given applications. In addition, they need a blockchain network where parties are identifiable (not necessarily trusted) and permissions can be granted. In addition, the privacy of data can be guaranteed between a certain set of participants, even if all of the participants are on the same blockchain network. Furthermore, consensus is controlled by a predefined set of nodes, which leads to a faster and low-cost business network.

The answer to enterprise needs is a private and permissioned blockchain network. Private and permissioned blockchain can also be termed a consortium blockchain. A consortia (a consortium of members) controls them. Nodes are predefined and access rights are defined. Examples of such blockchain networks are R3 and Hyperledger Fabric.

Private and permissioned blockchain/consortia offer the following:

  • Better governance than public blockchain: Public blockchain networks lack the governance to ensure an effective evolution of the blockchain network (for example, updates, changes to operational mechanisms, and consensus). As a result, it's slow to rectify defects and hinders innovation. On the other hand, consortiums can move fast as like-minded enterprises can quickly decide on innovations and evolve the business network to meet the dynamic needs of businesses.
  • Cost-effective: The upfront cost for public blockchain is low; however, it gets expensive for nodes that are initiating transactions. Initial infrastructure costs might be low, but the operational cost increases over time, which is reflected in the increased cost of transactions. As public networks are trustless, trust lies in the consensus mechanism. Expensive consensus mechanisms such as PoW and PoS are not applicable. In a consortium, like-minded trusted parties are involved. Hence, costly consensus mechanisms are not required. In addition, a consortium does not include transaction fees. In many ways, a consortium is not only cost-effective, but also faster.
  • Privacy and security: A consortium or private and permissioned blockchain network is highly secure. The access control layer is a first-class citizen for consortiums and ensures that a defined set of people get access to the network. Access is defined for reading, writing, and deploying code (smart contract/chaincode) and validating transactions. Public blockchain are secured by miners—also called validators. They solve complex problems (mining) to validate the transaction and, in return, receive incentives and rewards. In a private and permissioned network, security is ensured by the predictive distribution of control over the creation of blocks among identifiable nodes that are highly unlikely to collude. Malicious colluding and 51% attacks are not applicable as such malicious activities can be easily detected and the parties involved will be penalized based on consortium governing rules. Transactions are not visible to everyone. This offers enterprises and businesses the ability to transact with confidence, with trust in privacy offered by the business network.

The following table highlights the similarities and differences between different types of blockchain from the permissions perspective:

Public and Permissionless

Public and Permissioned

Private and Permissionless

Private and Permissioned

Open and transparent.

Open and restricted.

Restricted yet read transparent.

Restricted (hybrid approach).

Write all and read all.

Write all and read restricted.

Write restricted and read all.

Write restricted and read restricted.

Everyone can join, transact, read, and audit.

Everyone can join and transact, but only permissioned users can read and audit.

Everyone can join, nobody can transact, and everyone can read and audit.

Nobody can join, transact, read, and audit.

Anyone can download the protocol and participate with validate transactions.

Anyone who meets the predefined criteria can download the protocol and participate with validate transactions.

Anyone in the network can participate and validate transactions. However, this is only within the enterprise.

Only consortium members can validate the transaction.

The following table highlights the similarities and differences between different types of blockchain from a transaction and anonymity perspective:

Public and Permissionless

Public and Permissioned

Private and Permissionless

Private and Permissioned

Transactions are anonymous and transparent.

Transactions are anonymous and not read transparent.

Transactions are not anonymous and are read transparent.

Transactions are not anonymous and not transparent.

Write transactions can be authored or initiated by anyone; for example, I'm sending 10 Bitcoin to Bill. Everyone will know that 10 bitcoins were transacted.

Write transactions can be authored or initiated by anyone; for example, I'm casting my vote. However, whom I have cast my vote for can be counted by the authorized institution only. Another example is that a write can be performed by few and it can be read by all.

A write transaction is performed by few and it can be read by anyone. For example, an authorized party writes about the source of the inventory, and subsequent writes are performed by a few other intermediary parties or devices; however, it can be read by anyone.

A write transaction can be authored or initiated by authorized users; for example, I'm sending 10 USD to Bill. Authorized institutions will know that 10 USD was transacted.

Everyone will participate in transaction validation, and the validators are not the chosen ones.

Nobody can participate in transaction validation, and the validators are the chosen ones.

Nobody can participate in transaction validation, and the validators are the chosen ones.

Nobody can participate in transaction validation, and the validators are the chosen ones.

Truly democratic: full equity.

Full write equity.

Full read equity.

Restricted.

Transaction approval is long. It usually takes minutes.

Transaction approval is long. It usually takes minutes.

Transaction approval is short.

Transaction approval is short.

The following table shows the consensus and use case for different types of blockchain:

Public and Permissionless

Public and Permissioned

Private and Permissionless

Private and Permissioned

Open and decentralized.

Open and controlled.

Restricted.

Closed and restricted.

Anyone can run a full node to transact, validate, and read transactions.

Not just anyone can run a full node to transact, validate, and read transactions. Everyone can execute write transactions, while few can validate and read transactions.

Only individual or selected members can run a full node to transact, validate, and read transactions. A few can execute write transactions and validate transactions, while everyone can read.

Only members of the consortium can run a full node to transact, validate, and read transactions. In addition, only permissioned users can read.

For example, Bitcoin, Ethereum, and Litecoin.

For example, Ethereum.

For example, Hyperledger Fabric.

For example, Hyperledger Fabric, R3, and Corda.

Consensus - PoW.

PoS, PoA.

PBFT.

PBFT and FBA.

Use case—cryptocurrency, video games.

Use case—voting, poll records.

Use case—supply chain provenance, government record keeping, and assessor records.

Use case—tax returns, consortium, federations.

The advantages of public and permissionless blockchain are as follows:

  • There's no infrastructure costs for creating and running decentralized applications (dApps)
  • There's no need for a trusted party or intermediary; there is no intermediary
  • The network is open and transparent and offers anonymity
  • The network offers trustlessness and immutability

The advantages of public and permissioned blockchain are as follows:

  • No infrastructure costs for creating and running dApps
  • No need for a trusted party or intermediary; there is no intermediary
  • Scalable, fast, and lower cost

The advantages of private and permissionless blockchain are as follows:

  • Cost of transaction is reduced
  • No need for reconciliations
  • Simplified document handling
  • Reduced data redundancy
  • Scales better
  • Better compliance with regulations
  • Automated compliance functionalities
  • Enables finality

The advantages of private and permissioned blockchain are as follows:

  • There's better governance than public blockchain
  • The cost of transactions is reduced. There is no need for reconciliations.
  • Document handling is simplified and data redundancy is reduced
  • As participants are preapproved and identities are known, there is better privacy and security
  • Consortia is into decision-making and not using a single party
  • There are no single points of failure
  • It scales better and adheres to compliance with regulations
  • It enables finality

The disadvantages of public and permissionless blockchain are as follows:

  • Scalability: There is a limitation on the number of transactions that can be created, which can often reach to minutes at the peak period. Hence, such decentralized systems are not scalable.
  • Slowness and higher cost: This includes the following:
    • Everyone will participate in validation, and a validator is not chosen. Consensus can be reached when every node executes the same task, such as executing the code (smart contract) or validating the transaction. This replication is slow, time-consuming, and costly from many perspectives, such as storage, electricity, and processing power.
    • As the number of transactions increases, so does the cost of executing those transactions, which leads to the clogging of miners to execute high-value transactions, and so, the system becomes slow and costly.
  • Identity is anonymous: Anonymous participants could be malicious.
  • Immutability is a challenge: Although immutability of transactions and blocks is the major feature of public blockchain, immutability of code (smart contract) is a challenge for the blockchain network. Blockchain considers smart contract deployment as a transaction and as they are transactions, they are immutable. Hence, any bug or issue or a code loop cannot be corrected. This means that, smart contracts need to be meticulously built and tested before being deployed and should have operations to KILL (also known as shutdown) the invocation to stop further damages.
  • Finality : There's no finality and 51% attack (theory).
  • Can lead to centralization: To realize the tokenized benefits of public blockchain, nodes operate as full nodes. A full node means the nodes carry a full copy of the blockchain. As the blockchain network grows in size, it becomes costly for smaller players and individual nodes to operate as full nodes. Only bigger players will then be able to operate as full nodes, and such scenarios can lead to centralization, which can influence the blockchain network.

The disadvantages of public and permissioned blockchain are as follows:

  • Identity is anonymous—participants, being anonymous, can be malicious
  • Immutability is a challenge
  • There's no finality and 51% attack (theory)
  • It can lead to centralization

The disadvantages of private and permissionless blockchain are as follows:

  • It still has an intermediary and hence it is not decentralized.
  • It is centralized and hence it is not decentralized. However, it can be distributed.
  • As participants are not preapproved, identities are not known, although malicious users cannot perform write transactions and can only read information.

The disadvantages of private and permissioned blockchain are as follows:

  • Not fully distributed: It still has an intermediary and hence it is not fully distributed.
  • Consortium formation is a challenge: Formation of a consortium needs like-minded enterprises to collaborate over common business problems. Along with defining the structure and operation and governance model of the consortium, there are various questions that need to be answered for a formal setup of a consortium:
    • How to ensure that the consortia does not lead to concentration of power?
    • Who controls the consortium?
    • Do primary consortium members benefit more than late joiners?
    • Who benefits from the already existing infrastructure? Does this create confusion and infrastructure dependency or locking for new joiners or late joiners?
    • Who decides on new member inclusion or any member exclusion?
    • Who decides on the inclusion/exclusion of non-core members to the consortium?
    • How will the operational decisions be executed?
    • How will the consortium be financed?
    • How are disputes realized?
  • Dispute resolution and arbitrators: This includes the following:
    • As a consortium includes various enterprises and discrete parties, it has its own business complexities. These complexities can lead to disputes. Hence, a consortium must have arbitrators to settle disputes. This means there is a need for an arbitration function for a consortium, which takes care of participation contracts (via a legal document) between members of the consortia.
    • A consortium can also need smart contract (chaincode) auditors to verify the smart contracts and verify the interface and integration of the smart contract with external applications and data sources. Such independent auditors will offer assurance to the consortium and help in surfacing vulnerabilities.

In this section, we compared different types of blockchain and learned about their advantages, disadvantages, and so on. In the next section, the emphasis will be on the layered structure of the blockchain architecture.