Oracle Blockchain Quick Start Guide - Vivek Acharya - E-Book

Oracle Blockchain Quick Start Guide E-Book

Vivek Acharya

0,0
36,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Get up and running with Oracle's premium cloud blockchain services and build distributed blockchain apps with ease




Key Features



  • Discover Hyperledger Fabric and its components, features, qualifiers, and architecture


  • Get familiar with the Oracle Blockchain Platform and its unique features


  • Build Hyperledger Fabric-based business networks with Oracle's premium blockchain cloud service



Book Description



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.




What you will learn



  • Model your blockchain-based business network by defining its components, transactions, integrations, and infrastructure through use cases


  • Develop, deploy, and test chaincode using shim and REST, and integrate it with client apps using SDK, REST, and events


  • Explore accounting, blockchain, hyperledger fabric, and its components, features, qualifiers, architecture and structure


  • Understand the importance of Blockchain-as-a-Service (BaaS)


  • Experiment Hyperledger Fabric and delve into the underlying technology


  • Set up a consortium network, nodes, channels, and privacy, and learn how to translate network topology on OBP



Who this book is for



If you are a blockchain developer, blockchain architect or just a cloud developer looking to get hands-on with Oracle Blockchain Cloud Service, then this book is for you. Some familiarity with the basic concepts of blockchain will be helpful to get the most out of this book

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Seitenzahl: 433

Veröffentlichungsjahr: 2019

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Oracle Blockchain Quick Start Guide

 

A practical approach to implementing blockchain in your enterprise

 

 

 

 

 

 

 

 

 

 

 

 

 

Vivek Acharya 
Anand Eswararao Yerrapati
Nimesh Prakash

 

 

 

 

 

 

 

 

 

 

BIRMINGHAM - MUMBAI

Oracle Blockchain Quick Start Guide

Copyright © 2019 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

 

Commissioning Editor: Amey VarangaonkarAcquisition Editor: Aditi GourContent Development Editor: Roshan KumarSenior Editor: Jack CummingsTechnical Editor: Manikandan KurupCopy Editor: Safis EditingProject Coordinator: Kirti PisatProofreader: Safis EditingIndexer: Pratik ShirodkarProduction Designer: Shraddha Falebhai

 

First published: September 2019

Production reference: 1050919

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-78980-416-4

www.packt.com

You know how it is: you pick up a book, flip to the dedication, and find that, once again, the author has dedicated a book to someone else and not to you. Not this time. This one's for you. It is dedicated to all Enthusiast Evangelists and when you read it, you'll probably know why.
Along with you, I dedicate this book to my father, Ramesh Chandra, with love (actually, dad does not read technical books; he will never know about it unless someone tells him). A huge thanks to my wife, Richa, and son, Noah. Thanks for being patient with me while I was out at lakes and coffee shops writing, and could not spend weekends with you. Thank you for your sacrifice of weekends and vacations, and I'm sorry about that.
I would like to express my gratitude to Bill Swenton and Teresa Short for their support. I'm honored to have had Mark Rakhmilevich offer his guidance on the book. I'm highly thankful to Nimesh Prakash and Anand Eswararao Yerrapati for joining me as coauthors of the book. You have enhanced the depth and value of the book multifold. I would like to express my deep gratitude for your generous support.
I'm deeply thankful to Navroop Sahdev, David Gadd, and Mary Hall for writing a foreword for the book. It certainly adds value to this edition. My deepest gratitude to you. I would like to thank the talented team at Packt, including Aditi Gour and Roshan Kumar, who provided guidance, feedback, and added value to the book. I'm extremely thankful to the reviewer, Srihari Rayavarapu, who provided constructive and very useful feedback that helped us to tremendously improve the content of the book.
 

Packt.com

Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Fully searchable for easy access to vital information

Copy and paste, print, and bookmark content

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. 

Foreword

Many of us who enjoy the benefits of internet technologies today don't possess a technical understanding of the software infrastructure layers of the internet. Indeed, understanding the architecture and technical layers of software has, until recently, been confined to software architects and engineers. This is partly due to the way the internet itself developed, in a patchy and almost "messy" manner. Ubiquitous interoperability was an afterthought. After all, there were no precedents to the internet and the technology hasn't proven its worth. Fast-forward to 2019 and we live in a very different era. Within the past 3 decades, the internet has transformed every conceivable industry in the world and human life, while accelerating the pace of growth and transformation of the global economy into something that would be unrecognizable – let alone imaginable – back in the 90s, when internet technologies were still in their infancy.

One more time, the new wave of emerging technologies, such as blockchain, artificial intelligence, big data, cloud computing, Internet of Things, 3D printing, augmented reality/virtual reality, and so on is going to transform human life and change the face of the global economy. Only this time, the internet infrastructure already exists for the new technologies to piggyback on. The future of technological growth and technology-led global economic transformation is abundant with opportunities. Five key pillars mark the characteristic features of the technologies of the future: decentralization, speed, scale, security, and usability. In this second inning, we have the opportunity to build a technology stack that is inherently interoperable from scratch. The timing couldn't be better as professionals from all fields are keen to understand and help build the infrastructure technologies of the future. The demand to understand the building blocks of technologies such as blockchain and the functional knowledge to work with them for future buildout is increasing at an accelerated rate. Vivek Acharya's Oracle Blockchain Quick Start Guide is a step forward in that direction, and is particularly focused on enterprise blockchain solutions. At the same time, the business models that emerged from the growth of the internet are also being replaced as emerging technologies transform business as we know it, bringing seamless interoperability, unprecedented speed, and breathtaking user experience to everyday life. However, Platform-as-a-Service continues to grow as the dominant business model, as businesses rush to deploy cutting edge technology to gain a first-mover advantage in their respective industries. This applies equally to large enterprises and start-ups. Oracle Blockchain Quick Start Guide marries this dominant business model with the most promising infrastructure technology of the future, blockchain, in the pages that follow.

What Vivek will show you in those pages will help you gain knowledge about blockchain technologies; key challenges and use cases; and Oracle blockchain platform's integrations into Hyperledger Fabric. In 2017, I had the opportunity to coauthor Hyperledger's Massive Open Online Course called Blockchain for Business: An Introduction to Hyperledger Technologies. 2 years on, Oracle's blockchain platform is an important step forward in making Hyperledger's open source technology infrastructure highly accessible to individuals and businesses.

Navroop Sahdev

CEO, Rethink Markets & Fellow, MIT Connection Science

 

Distributed ledger technologies (DLTs) such as Hyperledger are slowly taking over the world by offering solutions and applications that would otherwise not be possible with traditional enterprise IT systems. Hyperledger allows enterprises to reap the benefits of DLT in an unprecedented way that it is resulting in a different kind of marketplace. Blockchain-as-a-Service (BaaS) is slowly catalyzing the marketplace and this is evident with the existence of many big players in BaaS, such as Oracle, IBM, Microsoft, and so on. If you are a DLT, Hyperledger, and blockchain enthusiast who is exploring an effective BaaS option, then this book is for you.

David's involvement in the Blockchain ecosystem started in November 2017 when he was introduced to the technology and realized that its integration with existing systems and emerging technologies such as AI, IoT, and machine learning would change the way the general public, industries, and third parties do business going forward. 

I was delighted when Vivek approached me. Vivek Acharya has experience in business process management, analytics, B2B, blockchain, and Hyperledger. In addition, he is the author of many technical and non-technical books. This allows him to effectively justify his Hyperledger prowess.

I am excited to write the foreword for this book on blockchain, which also covers Hyperledger and BaaS in depth. It will help readers design and build a solution on a BaaS platform. There are not many books on Hyperledger that emphasize its concepts, evolution, qualifiers, and approaches, and offer a sample, which users can build. Vivek Acharya and his contributor team have met that need, representing many disciplines that Hyperledger and BaaS have contributed to in the rapid adoption of enterprise solutions such as Hyperledger on a cloud platform.

The book is designed to start with accounting concepts, blockchain fundamentals, and its challenges and opportunities. It then navigates to adoption, use cases, and a detailed analysis of the Hyperledger platform with sample. It ends with approaches, qualifiers, and topologies. It offers an excellent kickstart for anyone to read though blockchain, Hyperledger, and BaaS, and then quickly practice it using Oracle Blockchain Platform. It serves as a one-stop shop to learn the various "nuts and bolts" of a DLT such as Hyperledger. This book will create a foundation for designers, developers, and architects to learn and build enterprise-grade solutions. The challenges in enterprises are both difficult and interesting. Enterprises are working on them with enthusiasm, tenacity, and dedication to design and develop new methods of analysis and provide new solutions to keep up with the ever-changing needs. In this new world, knowledge on the frontiers of DLT, blockchain, Hyperledger, and BaaS is paramount. This book is a good step in that direction and offers readers a chance to gain blockchain prowess.

All the best to Vivek Acharya and it is my hope and expectation that this book will provide an effective learning experience and reference resource for all Hyperledger and BaaS professionals.

David Gadd

Blockchain & Emerging Technologies Director, Consultancy Service & Talent Acquisition UK & Canada

 

Blockchain technology offers greater transparency and a single source of truth for participants doing business together and sharing selected data. With blockchain, a list of unalterable records (called blocks) are linked together to form a chain that is securely distributed among participants. This allows organizations that might not fully trust each other to agree on a single, distributed source of truth without any centralized authority. Blockchains can be public (open to all) or permissioned (only open to those parties granted access privileges).

Today's business transactions produce multiple data points, typically resulting in millions of daily transactions that need to be validated and confirmed. While all this "big data" presents opportunities, it can also be incredibly difficult to manage, especially if that data isn't properly validated by all parties. A lack of validation can expose organizations to risk, especially if they are trying to track supply chain goods, insurance claims, or financial transactions that are regulated by law. The promise of blockchain technology is the secure sharing of data that is tamper-evident, meaning if any party in the chain alters the data, the other parties in the chain will know who took that action and who the bad actor is.

The most popular enterprise blockchain is Hyperledger Fabric, a Linux Foundation-sponsored open source project. Hyperledger Fabric empowers organizations to build and manage permissioned, consortium-based blockchain business networks using a plug and play infrastructure. Because it is highly performant, secure and open sourced, Blockchain use cases built with Hyperledger Fabric are leading examples of the benefits of using Blockchain to accelerate the speed of business transactions.

Oracle Blockchain Platform is built with Hyperledger Fabric and offers users the ability to easily set up and manage a permissioned blockchain hosted in the cloud with preassembled components and enterprise-grade security and performance.

I've had the pleasure of being involved with blockchain technology for the past 3 years at both IBM and Oracle and have seen firsthand how this technology can transform the pace of a business, from verifying goods to ensure food safety freshness to preventing fraud, tracing complex supply chains and ensuring digital identity; the possibilities are literally endless.

If you're interested in blockchain technology, this book explains the technology, Hyperledger Fabric, and explores the benefits of BaaS (such as Oracle Blockchain Platform), with concrete use cases and samples for Hyperledger Fabric and Oracle Blockchain Platform. After establishing a theoretical foundation for blockchain and Hyperledger Fabric, readers are given a deep dive into various use cases, design strategies, and Hyperledger Fabric's architecture. This book can be used as a quick start guide, allowing you to delve into Oracle Blockchain Platform and experience the ease of building blockchain solutions with it.

Mary Hall

Blockchain Product Marketing, Oracle

Contributors

About the authors

Vivek Acharya is an IT professional and has been in the world of design, consulting, and architecture for approximately 12 years. He is a certified expert on blockchain, Hyperledger Fabric, Software as a service (SaaS), and analytics. He loves all things associated with the cloud, permissioned decentralized autonomous organization (pDAO), blockchain, predictive analytics, and social business process management (BPM).

 

Anand Eswararao Yerrapati is an IT professional with about 12 years of experience in design, development, and the delivery of solutions for the various use cases of many customers. He works on Platform-as-a-Service (PaaS) primarily with mobile, chatbots, blockchain cloud service offerings, and their integrations. He loves to develop end-to-end solutions with the integration of multiple products and shares knowledge through blogs and sessions.

 

Nimesh Prakash is an IT solutions consultant with 13 years of experience. He has been part of multiple facets of enterprise IT solutions including development, design, solution consulting, and architecture. He works and evangelizes on PaaS cloud computing, involving blockchain, chatbots, cloud-native, and container technologies. He has been a regular at public technology events and likes to speak and to demonstrate his areas of interest.

 

About the reviewers

Srihari Rayavarapu (Sri) is a solution engineering manager at Oracle (Cloud Solution Engineering Hub), supporting customers across EMEA and JAPAC. He is currently leading a team of passionate solution engineers in modern application development. For the past 18 months, Srihari and his team have built expertise on Hyperledger Fabric and Oracle Blockchain Platform to deliver MVPs. He is passionate about emerging technologies (AI/ML, IoT, RPA, and AR/VR) and cloud-native/DevOps areas. He has over 18 years of industry experience in software development, presales, solution engineering, and technical leadership from various positions in IBM and Oracle. He holds a master's degree in software engineering from Dublin City University, Ireland.

Ankur Daharwal started his journey into blockchain with IBM Blockchain Garage in 2016. As a technology enthusiast and expert in both public and enterprise blockchains, he has been part of the decentralized world for around 3 years now. He has successfully developed and delivered numerous blockchain projects. He has devoted his career to devising real-life solutions for asset management and value exchange in a plethora of industry use cases worldwide. As an advisor to many blockchain start-ups, he focuses on providing expert guidance and solutions. Ankur strongly believes in fulfilling social responsibilities and supporting humanitarian causes with the use of his skills in technology.

 

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Oracle Blockchain Quick Start Guide

Dedication

About Packt

Why subscribe?

Foreword

Contributors

About the authors

About the reviewers

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Exploring Blockchain and BaaS

Accounting system – single and double–entry

Accounting system – single–entry

Accounting system – double–entry

Centralized versus distributed ledgers

Centralized ledgers

Distributed ledgers

DLT and blockchain

Comparing blockchain and DAG:

Accounting system – triple–entry or distributed double–entry

Blockchain definition and analogy

Analogy

Blockchain components

P2P network

Network of equity or the peer-to-peer network

Layered structure of the blockchain architecture

Hardware and infrastructure layer

Ethereum - Infrastructure layer

Hyperledger Fabric – Infrastructure Layer

Data layer

Network layer

Transaction flow

Consensus layer

Application layer

Structure of the blockchain

Transaction state machine

Types of accounts

Delving into Block Structure

Transactions

Adding transactions to a block

Appending blocks to blockchain

Consensus algorithm

Types of blockchain networks

Blockchain platform

Blockchain actors

BaaS 

BaaS qualifiers

BaaS use cases

Key advantages of BaaS

Oracle's BaaS – OBP

Pre–built blockchain applications

Summary

Construing Distributed Ledger Tech and Blockchain

Challenges and opportunities of DLT

Challenges associated with DLT

Perception

Consensus

Facts

The unknowns 

Opportunities offered by DLT and blockchain

Gain in efficiency and novel revenue streams

Business models and enhanced resilience 

Inheritance of trust

Immutability and a smarter world

Challenges of traditional technologies and solutions

Design strategy

Explore

Identifying and justifying use cases

What is the algorithm to quantify the need for blockchain?

Building the equation

Types of blockchain

Structure of the business network

pDAOs

Business network goals and governance

Dispute resolution and arbitrators

Engage, experiment, experience, and influence

Blockchain properties and use cases

Blockchain properties

Properties and use cases

Types of use cases

Digital assets

Digital analytics

Digital platform

Exploring use cases

Government – real property registry and transfer of ownership

Challenges with the current process

Blockchain, the savior

Advantages of blockchain solutions

Social factor

Crowd funding of real estate properties

FinTech – know your customer

Present

Future

KYC/on–boarding processes on blockchain

Process on the blockchain

FinTech – invoice factoring

Consortium–based solutions

Marketplace solution

Tokenized marketplace

Engaging with a use case

Defining the flow

As-is flow

To-be flow

Identifying and defining business network components

Defining assets

Defining participants

Detailed flow with transactions and events

Integration architecture

Infrastructure of the business network

Summary

Delving into Hyperledger Fabric

A glance at the Hyperledger project

Frameworks hosted by Hyperledger

Tools hosted by Hyperledger

HLF – features and qualifiers

Why Hyperledger?

Go/No–Go for a blockchain solution

Architecture – conceptual view

Building the blockchain network

Chaincode and its stages

Types of peers

Evolving the network

Physical realization of network configuration and channel configuration

Ordering service

Ordering nodes maintaining a consistent copy of network configuration

A node's behavior when part of multiple channels

Hyperledger architecture (layered view) and components

Identity, security, and privacy

Public key infrastructure

Digital certificate

Keys

CAs

CRL

The membership service

MSP

Types of MSP

Channel (privacy provider)

PDC

PDC – more privacy in channels

Distributed ledger

Nodes

Peers

Orderers and transaction process flow

Ledger

The world state database

Chaincode

Consensus everywhere

Transaction flow

Large object storage – on-chain or off-chain

Rationale for on-chain/off-chain architecture

Key design principles

Integrated blockchain – an anchored document storage solution

Storage option selection for blockchain applications

Summary

Engage in Business Case on Blockchain Platform

Understanding the business scenario

Introduction to the use case

Criteria for use case qualification

Blockchain solution benefits

Designing the solution

Business network topology

Channel association

Network artifacts

Asset model

Chaincode transactions

Solution operational flow

Solution architecture

High–level architecture

Deployment architecture

Document storage – recommended approach with OBP

Exploring OBP

Overview of OBP's architecture

Blockchain instance

Setting up the OBP SDK

Prerequisites

Prepare the Docker environment

Provisioning 

Creating blockchain instance using the SDK

Creating a founder instance in the OBP SDK

Creating a participant instance in the OBP SDK

Provisioning OBP on Oracle Cloud

Creating a founder instance on Oracle Cloud

Creating a participant instance on Oracle Cloud

Features and components of OBP

Dashboard

Network topology

Nodes topology

Channels

Chaincodes

Developer tools

Rich history database with OBP

Create the ODCS connection string

Fetching ODCS information

Enabling port 1521 to access the database

Creating a connection string

Configuring the rich history database in OBP

Enabling channels that write data to the rich history database

Rich history database tables and columns

History table

State table

Latest height table

Summary

Managing Solutions on Oracle Blockchain Platform

Translating the network topology onto OBP 

Creating network stakeholders with OBP instances

Configuring the OBP network infrastructure

Exporting/importing participant certificates

Orderer configuration

Configuring the OBP transaction infrastructure

Channel setup

Joining participant peers to a channel

Founder node summary

Participant (ors) node summary

Participant (cvs) node summary

Founder network summary

Participant (ors) network summary

Participant (cvs) network summary

Adding smartness to the OBP network

Developing chaincode to add smartness to the OBP network

Exposing chaincode via REST proxy configuration

REST Interface for OBP

Summary

Developing Solutions on Oracle Blockchain Platform

Setting up chaincode development

Choosing the language for development (GO, Node.js, or Java)

Tools for OBP solution development

Development environment

Development tools

Mapping the asset model

Mapping operations

Demystifying the craft of chaincode development

Chaincode interfaces

ChaincodeStubInterface

Chaincode functions

Developing chaincode

Chaincode in Go

Chaincode in Node.js

Adding events to chaincode

Publishing events

Subscribing to events

Unsubscribe from events

Chaincode deployment

Deploying chaincode

Updating chaincode

Endorsement policy

Private data collection

Testing chaincode

Testing chaincode using the shim

Testing chaincode from REST endpoints

Chaincode logs

Channel ledger

Integrating client applications with blockchain

Running an end-to-end flow

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

Preface

This book was created in the belief that, together, we will positively contribute to the evolution of blockchain technologies and continually inspire others to share their experiences and further influence others to do so. In this book, we will do the following:

Explore

distributed ledger technology; blockchain, its components, features, qualifiers, and architecture; and demystify the prominence of

Blockchain-as-a-Service

(

BaaS

)

Engage

in modeling a blockchain-based business network and gain exposure to developing 

business networks based on

 

Hyperledger Fabric

 (

HLF

), and appraise blockchain and HLF use cases and their potential effects and integration

Experiment

with

Oracle Blockchain Platform

(

OBP

) to utilize the practicality of translating network topology to OBP

Experience

the ease and richness of assimilating smartness in a business network by learning the full life cycle of chaincode, from development to updates; from installing, initiating, and testing to versioning; and finally, from integration to insight

Who this book is for

This book aims to address a diverse audience, from business stakeholders, to business leaders; from blockchain enthusiast evangelists to designers, architects, and developers; and to anyone and everyone who wants to benefit from the experience offered in this book. This book is intended to become a quick reference guide to learn blockchain, HLF, design strategies, and build chaincode on a blockchain platform. This book adopts a model that will allow readers to refer to this book as a reference for blockchain, its use cases, Hyperledger, design strategy, and quick development on the blockchain platform. 

What this book covers

Chapter 1, Exploring Blockchain and BaaS, offers an in-depth exploration of blockchain and distributed ledger technology. It also takes you through blockchain-layered architecture, types of networks, actors, and structure. This chapter offers a prelude to blockchain, shows its relationship with distributed ledger technology, and demonstrates its pertinence to it. This chapter will demystify the prominence of the BaaS platform, its architecture, features, qualifiers, and the ease of use of prebuilt applications while exploring the eminence of OBP.

Chapter 2, Construing Distributed Ledger Tech and Blockchain, demonstrates the world of HLF design and implementation strategy, while diving into the comprehensive five-step design strategy—explore, engage, experiment, experience, and influence. In this chapter, we will build equations, coined by the author, to justify blockchain as the qualified solution for a given use case. We will look at various structures of permissioned business networks, such as joint venture, consortium, and founder initiated, and glance at a permissioned distributed autonomous organization (pDAO). We will also look at different types of use cases, ascertain the properties of blockchain, and witness them as the driving force behind various use cases and their adoption. The book includes a use case on FinTech; helping you to learn the art of modeling a blockchain business network (KonsensusChain) by defining its assets, participants, ledgers, consensus, transactions, events, permissions, and access controls. It also explores how to integrate a permissioned Hyperledger-based business network with BPM, SaaS, and other applications, while creating an infrastructure for the sample business network.

Chapter 3, Delving into Hyperledger Fabric, demonstrates Hyperledger's architecture and allows you to assemble a sample Hyperledger-based business network. You will look at a founder-based and a consortium-based business network. You will learn about business network components, adding peers to channels, working with chaincode, and smart contracts. It will guide you in enabling a dApp or application to transact with the business network. You will also take a deep dive into identity, security, privacy, membership services, and channels, as well as walking through ledger state and transaction flow via a PiggyBank example. These details will allow you to learn transaction flow and its steps, such as proposals, endorsement, packaging responses, verification, ordering, distribution, validation, committing, and notifications. Furthermore you'll see on-chain and off-chain architecture as an extension to a private data collection. 

Chapter 4, Engage in Business Case on Blockchain Platform, allows you to engage with OBP. You'll learn how to design a solution inline with the constructs of OBP. You'll also see the sample business network topology, network artifacts, and solution and deployment architecture. Furthermore, you'll explore OBP in detail, its features, and components. You'll also delve into defining and creating an instance of a founder-based business network. In the chapter, you will see a rich history database working with channels.

Chapter 5, Managing Solutions Using Oracle Blockchain Platform, gets you into the practicality of translating network topology on OBP, creating network stakeholders, and configuring OBP instances. This ledger of knowledge illustrates a transaction infrastructure setup, joining participants to a business network, access control, adding smartness (chaincode) to a business network, and REST proxy configuration to expose chaincode to a dApp.

Chapter 6, Developing Solutions on Oracle Blockchain Platform, concludes the book with details on chaincode development, such as the programming languages required, development tools, and a development environment setup. This chapter teaches you about mapping asset models, operations, and developing chaincode functions and interfaces. It highlights the full life cycle of chaincode from development to updates; which includes installing, initiating, testing, and versioning. It demonstrates the full chaincode with a code base built on Go and Node.js. The chapter also illustrates endorsement policies, private data collections, and their functioning in concert with chaincode. It covers chaincode testing via shim and REST endpoints and integrating client apps with business networks using SDK, REST, and events. Finally, it concludes with insights into chaincode, transactions, and channels by experimenting with the monitoring of a business via chaincode logs and channel logs.

To get the most out of this book

The code samples were tested in a cloud environment as well as in a local environment, which can be created using a virtual machine in VirtualBox using an Oracle Linux ISO image. Download Oracle VirtualBox 6.x and install it on a machine (Windows/macOS/Linux) with 16 GB RAM and a minimum of 100 GB HDD. Visit Chapter 4, Engage in Business Case on Blockchain Platform, in the Setting up OBP SDK section, for more details on installation steps.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packt.com

.

Select the

Support

tab.

Click on

Code Downloads

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR/7-Zip for Windows

Zipeg/iZip/UnRarX for Mac

7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Oracle-Blockchain-Quick-Start-Guide. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781789804164_ColorImages.pdf

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Then, from your local web browser, just enter http://localhost:3000 and you should see the console's UI."

A block of code is set as follows:

#Create user Oracle

sudo useradd oracle

sudo passwd oracle

<newPassword>

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Click Sign In in the top-right corner."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

Exploring Blockchain and BaaS

Blockchain is perceived to be a disruptive game-changing technology that will have an impact as huge as the internet in the next two decades. This programmable economy has use cases and applications in almost every industry. Blockchain has grown from being a buzzword to something of great interest to enthusiasts and real implementers. Evangelists are not confined to proof of concepts (PoCs), but have started real implementations and have started demonstrating concrete achievements. Although the adoption is slow, Gartner projects (at https://www.gartner.com/ on June 3, 2019) that adoption will be $3.1 trillion by 2030.

Blockchain is a world where users are in full control of transactions and the information around them. The information flowing around is true, trusted, accurate, consistent, accepted, complete, timely available, widely available, transparent, and immutable. Blockchain, a type of distributed ledger technology (DLT), removes the risk of a central point of failure, while the underlying cryptography and algorithms will ensure the security in this immutable world. As the trust is in the blockchain network itself, there is no need for a trusted central third party. Welcome to the blockchain world, a world of distributed double-entry systems.

This chapter starts with accounting systems, centralized and decentralized ledgers, and coins the term distributed double-entry system. This chapter gradually moves toward the definition and analogy of blockchain and demonstrates the power of equity offered by peer-to-peer (P2P) networks. Here, you will also walk through various types of blockchain networks, such as permissioned and permissionless or public and private. This chapter then graduates toward the layered structure of the blockchain architecture and structure of transaction, as well as the blocks and the transaction flow. Finally, it covers how you can approach a blockchain solution and defines the cloud approach to ease blockchain adoption—from PoC to production using a Blockchain-as-a-Service (BaaS) platform such as the Oracle Blockchain Platform (OBP).

 

Accounting system – single and double–entry

Before we jump into blockchain and delve into Hyperledger Fabric and the Oracle Cloud solution, we need to start with two core principles—ledger and accounting. In an accounting system, business transactions are recorded in journals and ledgers. Fine-grained details of every transaction are entered into various journals. Summarized information from the journals is then transferred (also known as posted) to a ledger. It is the information from the ledger that becomes the source for trail balances and various financial statements. Every transaction is recorded in journals and then posted to a ledger that records this information in various accounts, such as asset accounts, liability accounts, equity accounts, revenue accounts, and expense accounts.

For any organization's accounting system, the ledger is the backbone. Anything that has financial value is posted to the organization's ledger. However, these ledgers are centralized ledgers and the organization has full control over them. We will talk about centralized and decentralized ledgers later in this chapter.

Accounting system – single–entry

Accounting systems address the purpose of producing an operating document to display ownership of assets, to protect assets, and various other tasks. Essentially, an accounting system is a powerful means to check the loss of assets due to malicious human activity, software, and so on, and to keep track of activities and transactions around those assets. Historically, as activities around assets were minimum, single-entry accounting was good enough to prove the ownership of assets. It is a form of accounting system where each transaction is a single-entry in the journal.

A single-entry account system resembles the check register that individuals use to track their checks, deposits, and balances. The information recorded is minimal and is owned by that individual. It's an efficient system for very small businesses that work on a cash basis of accounting, which have fairly low transactions each day. There are no credit-based transactions and the assets that are owned are very few and far between. Most importantly, there is no need to publish income, financial, and balance statements. Historically, it would have worked very well and, even today, it might work fine for very small firms that meet the aforementioned attributes.

There are various challenges with single-entry accounting systems—there are no scientific or systematic rules to record, post, and report on the transactions. It appears as an incomplete system as it does not have both the aspects of the accounts being recorded; hence, it fails to reflect the truth about the profit or loss and will miss reflecting the true financial position of the organization. With all of these shortcomings, a single-entry is vulnerable to frauds and various errors in the ledger. Hence, to check on vulnerability, you need to trust a centralized authority; therefore, historically, there was the need for a king to check for vulnerabilities and maintain trust around the ledger. However, since trade has expanded its boundaries, you need a mechanism to allow one ledger owner to trade with another ledger owner. This immediately led to a double-entry accounting system.

Centralized versus distributed ledgers

This section highlights centralized and decentralized ledgers and distributed ledgers, and outlines the differences between them.

The following diagram shows different types of systems:

Types of systems and ledgers

Throughout this section, we will refer to the preceding diagram to understand the layout of various types of ledgers. Before we drill into the differences between centralized and distributed ledgers, let's understand the different types of system.

From the perspective of control, there are two types of systems—centralization and decentralization systems:

Centralized system

: One entity controls the entire system, where an entity can be a person or an enterprise.

Decentralized system

: In a decentralized system, there could be multiple entities controlling the system. There is no single point of control, and the control is shared between various independent entities.

From the perspective of location, there are two types of systems—centralized and distributed systems:

Centralized system

: All the constituting parts of the system, such as servers, ledgers, and so on, are co-located and exist at the same location

Distributed system

: All the constituting parts of the system

, such as

servers, ledgers, and so on, are NOT co-located and exist at different locations

These categories of the system lead to the following variants of the system:

Distributed yet centralized system

: Distributed yet centralized system is the category of system wherein the system is distributed, from the location's perspective, yet the system is controlled by a central authority or central entity. For example, cloud service providers offer various services such as compute, storage, SaaS, PaaS, IaaS, and so on. These services are offered via servers and databases that are distributed. However, the entire system is controlled by the cloud service provider. Such a system can be termed a distributed yet centralized system.

Distributed system

: Distributed systems, from the control's perspective, are decentralized, whereas from the location's perspective, they are distributed. This means that no single entity is the owner or authority of the system and the system doesn't have just one location—it is widely distributed. DLT and its type, such as blockchain, are such distributed systems, where control is not with one entity. Hence, no single entity can alter or modify the system (decentralized). Also, DLT and blockchain are based on the P2P network, where nodes (peers or participants) are independent and globally spread (distributed).

A distributed system is a superset of a decentralized system, and is based on a P2P network.

Centralized ledgers

The double-entry accounting system we've discussed so far highlights an accounting system that has a centralized ledger. Anything with a financial value is recorded in journals and posted to ledgers. These ledgers are just like the central repository of the posted transactions, and they are the backbone of any organization.

However, centralized ledger systems have various drawbacks as well. For example, banks control the transactions that are posted into the bank's ledgers and they maintain total control over bank statements. In this case, they can penalize you at any given time and can transact money from your account at any given time. If such a centralized institute has malicious intent, then the consequences could be manifold; they could close down their business without prior notification, which prohibits any further transactions. These examples are used mostly by the blockchain evangelists who lean more toward complete decentralization of trust authorities.

Let's look at a more viable challenge, pertaining to banks. Double-entry mandates the need for each bank to maintain its own ledger to reflect their perspective of truth, and as more banks are transacting with each other, they need to reconcile their version of the truth to derive a single version of the truth. Banks today spend time, money, and resources to ensure a consensus over the single truth.

Obviously, they have their ledger and hence their own system, which allows the financial industry to avoid any chance of a single point of control and single point of failure. In addition, it becomes more interesting as a customer opens an account with a bank and puts his/her money with a level of trust in that banking institute. Now, the onus is on the banking institution to safeguard your money and information. On the other hand, the bank will invest a lot of time, money, resources, and effort into building and maintaining a system and then spend even more time, money, resources, and effort on integrating and checking with other banking institutes to ensure that their mastered system is in consensus with the other banking institutes' system to reach a common truth. 

If you analyze this closely, you will see that each bank's ledger is actually replicating the functionality of the other banking institutions. Now, what if one of the banking institute's systems fail? Is this going to lead to a situation where reconciliation is not possible? Doesn't this sound more like a single point of failure? The answers lie in the distributed ledger discussed in the following section and throughout the book.

Distributed ledgers

Across the world, in the economical, legal, political, and institutional systems, the key elements are transactions, contracts, and documents. They dictate the relationship between countries, enterprises, organizations, communities, and individuals and, most importantly, they are perceived to offer trust. Interestingly, these have not joined the digital transformation to a greater extent and for the greater cause. So, what is the solution? Distributed ledgers and DLT, along with blockchain, offer the solution to such critical challenges. In this section, we will explore more about distributed ledgers and DLTs.

In a distributed ledger, there is no central authority or a central administrator. It is an asset database that is shared over the network, where each party on the network has an identical copy of the ledger. These assets can be financial, legal, and electronic assets. Changes to the value of these assets are reflected throughout the network, and each copy of the ledger is appended.

Many organizations, governments, and institutes use a central database of the ledger, which we discussed in the Centralized ledgers section. A centralized ledger needs a central authority to be trusted by transacting parties; however, in a distributed ledger, the need for a third party is omitted, which is one of the gravitational forces behind the attraction to DLT. Here, I have quietly used the term DLT because a distributed ledger can be pronounced as a shared ledger or a DLT, and they are one and the same.

What's disruptive about a DLT is that the ledger database is distributed, spread on all of the nodes or computing devices across the network, and each node has an identical copy of the ledger, where nodes update themselves independently. All of the participating nodes reach an agreement to establish a single truth (true copy) for the ledger through a process called consensus. Once a consensus is reached, the distributed ledger is updated automatically and the latest truth (true agreed copy) of the ledger is appended on each node separately. While reading this paragraph, you might think about the reconciliation process of banks to establish trust and an agreement on the ledger. With DLT, trust (reconciliation) and consensus (agreement) happen seamlessly and automatically.

What we just found out is that there is no central authority in the previous story to maintain the distributed ledger. DLT empowers systems to reduce the dependencies on various central authorities such as banks, lawyers, governments, regulatory offices, and third-party authorities. Distributed ledgers omit the need for a central authority to validate, authenticate, and process transactions. Transitions on DLT are timestamped and have a cryptographic unique identity, where all records in question are available for the participants to view, and this ensures that the verifiable and auditable history of the transaction is stored immutably.

In the decentralized distributed ledger, the transaction is replicated to the distributed ledger, which means all the participating nodes' copies of the ledger are appended; however, there is no central single database. It is the network that is decentralized. Such a system needs a decentralized consensus as there is no single point of contract, or single authority or party. Hence, to ensure trustlessness, consensus is a must. In a traditional database system, a single party acts on behalf of the transacting clients to modify the state of the system. However, in a distributed ledger, any party can record, and the protocols and algorithms govern the posting of transactions on the network's ledger.

The following table lists some of the differences between a centralized ledger and a distributed ledger:

Centralized ledger

Distributed ledger

Reconciliation is required (both internal and external).

Reconciliation is not required; however, a consensus is required to reach an agreement.

There's no restriction on DB operations.

It's append-only.

There's a single point of failure.

It's distributed; hence, there's no single point of failure.

There's a single point of contact.

It's decentralized; hence, there's no single authority.

There are third parties, middlemen, and gatekeepers.

It's P2P. There's no central party, and appending to the ledger is governed by the consensus.

Backup and disaster recovery are required.

Resilience and availability increases as more and more participating nodes get to the network.

Actions can be performed on behalf of someone.

There's cryptographic authentication and authorization.

NA

It's immutable as the data added to the ledger stays immutable.

NA

There's direct interaction of the nodes, allowing initiation of direct transactions of assets such as currency, real assets such as land titles or documents, and so on.