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)

Blockchain platform

Until now, we have explored different types of blockchain network. In this section, we will quickly look at two major blockchain platforms—Ethereum and Hyperledger Fabric.

Following is the overview of these two platforms:

  • Ethereum: It's an open source, public blockchain network. It is an extension of the core blockchain concept and now supports applications beyond currencies. Developers can build decentralized applications (via smart contracts) and can even build decentralized autonomous organizations (DAOs). It is a generic platform, and transactions are validated by PoW consensus. Ethereum is used as an idea for business-to-consumer (B2C) use cases and applications. It's a public blockchain; hence, all of the participants can access the ledger. It supports Solidity and has built-in currency (Ether).
  • Hyperledger Fabric: It is a platform for enterprise applications. This platform is open source and modular and runs the BFT consensus algorithm. Hyperledger does not truly have a consensus mechanism. Due to its pluggable architecture, consensus can be plugged to it, based on the use case. Ledger is not public and it's mostly suited for business-to-business (B2B) use cases or applications. Chaincode (also known as smart contracts) can be written in standard languages such as Java, Go, and Node.js. It does not have a built-in currency.

Operations include the following:

  • Ethereum: It is a public blockchain, where participants (nodes) can participate any time
  • Hyperledger Fabric: It is a private blockchain, where participants (nodes) are given permission to participate

Consensus is as follows:

  • Ethereum: Roles played by each participating node are similar. All of the nodes need to reach consensus for a transaction to commit. Every node needs to participate in consensus, even if that node is participating in a transaction. Ethereum consensus is based on PoW algorithms or a hybrid of PoW/PoS (called Casper).
  • Hyperledger Fabric: Roles played by each participating node can be different. Some nodes are validating nodes, some are endorsing nodes, some are ordering nodes, and so on. Hence, during the process of establishing a consensus, different nodes will be performing different tasks. Nodes can opt for No consensus (No-op) or an agreement protocol such as PBFT. There is no third party that is forcing the choice of consensus mechanism. In addition to consensus, Hyperledger Fabric also offers identity verification during the life cycle of the transaction. It also supports channels and private data collection for a more private transaction between parties. Transactions are ordered and then added to blocks, which are then distributed across the channel. Channels further control the visibility of transactions to the business network participants.

Choice: Depending on the use case and application, you can opt for Ethereum versus Hyperledger. The following are a few points to note:

  • Ethereum: Ethereum is public and permissionless and offers transparency. Its various advantages listed in the previous section. However, privacy and scalability are low in Ethereum.
  • Hyperledger Fabric: It solves privacy and scalability issues and offers access control, high transaction speed, and resilience. On top of that, it is modular and pluggable, which can suit various B2B enterprise use cases.

Code execution is as follows:

  • Ethereum: Code, also known as smart contracts, is executed on the EVM. Ethereum networks offer services to execute smart contracts and allow them to reach consensus. They also offer services to invoke external oracles. The scope of a smart contract is until the lifetime of the business network concludes. Hence, it's good development practice to write smart contracts with KILL methods.
  • Hyperledger Fabric: Code, also known as chaincode, can be written in a standard programming language such as Java, Node.js, and Go. Chaincode is executed on the business network and validated and endorsed by business network nodes. Unlike Ethereum, Hyperledger Fabric supports chaincode versioning and upgrading. Following are some highlights of Hyperledger fabric from chaincode perspective -
    • Chaincode can be upgraded to a new version, as long as you maintain the same name of the chaincode; otherwise, it will be considered a different chaincode. Update is a transaction on the blockchain network and results in the binding of the new version of the chaincode to the channel. Before you update the chaincode, install a new version of the chaincode on the endorsers.
    • What happens to the old version? All the other channels that are binding to the previous (old) version of the chaincode can continue to execute the older version. You submit the chaincode upgrade transaction to a channel. Hence, only one channel is affected, to which you have executed the upgrade transaction. All other channels, on which the upgrade transaction is not executed, will continue to run the older version.
    • Chaincode can even be stopped. However, the start and stop life cycle transactions are not implemented in v1.4. These are future enhancements. Stop transactions will be a logical way to stop chaincode transactions before upgrading it.
    • Optionally, you can STOP a chaincode by removing the chaincode container from the endorsers. Practically, you can delete the chaincode's container from each host (VM) on which the endorsing peers are running.
Hyperledger Fabric supports Ethereum. With Hyperledger Fabric version 1.3 onward, smart contracts written in Solidity and Vyper can now be executed on Hyperledger Fabric as it supports the EVM. It's a new smart contract runtime and supports web3.js for enhancing the development of dApps (decentralized applications). This further boosts the development of dApps on permissioned blockchain. Visit for more details on this feature.