Book Image

Blockchain across Oracle

By : Robert van Molken
Book Image

Blockchain across Oracle

By: Robert van Molken

Overview of this book

Blockchain across Oracle gives you the professional orientation to Blockchain that you need as an Oracle developer in today’s changing world. Written and prepared for you by Oracle Developer Champion Robert van Mölken, this book gets you up to speed with the details of the Blockchain - core concepts, how to implement Oracle’s Blockchain Cloud Service, industry implications for the Blockchain, and how the Blockchain will affect your Oracle customers. Robert van Mölken introduces you to the history and concepts of the Blockchain. You’ll really get to understand the Blockchain inside and out, as an Oracle developer or solution architect. You’ll understand the Blockchain flow, and how the hashes and chains create a new decentralised paradigm for you as an Oracle developer. You’ll gain insights into how the Blockchain affects Oracle developers and customers in this modern and disruptive era. You’ll see how the Blockchain concepts work in this new world where Assets, Transactions, Security, and Privacy, can all be sustained across a decentralized system for your customers. Then you'll find a detailed look at the cutting-edge Oracle middleware solutions. You’ll learn about Hyperledger Fabric, the opensource Blockchain framework used by Oracle as its core, and how to set up your own Oracle Blockchain Network. You’ll design and develop a smart contract, and learn how to run it on the Oracle Blockchain Cloud Service. The final part of the book looks at how the Blockchain will affect your customers across various industry sectors. By studying industry trends in the financial services sector, healthcare industry, and the transport industry, you’ll discover how the options and possibilities for you and your clients are being transformed by the Blockchain across Oracle. You’ll complete this professional orientation by looking at Blockchain trends and future directions.
Table of Contents (24 chapters)
Title Page
Packt Upsell
Contributors
Preface
3
Blockchain 101 - Assets, Transactions, and Hashes
4
Blockchain 101 - Blocks, Chains, and Consensus
Index

How does a blockchain work?


The technology (that is, the architecture, mechanisms, security, and so forth) behind the blockchain can be seen both as the backbone for future accounting and as an engine for a modern message transport system. So how does a blockchain actually work during runtime?

The following diagram shows how blockchain systems must follow a specific flow of actions in order to consistently maintain a distributed ledger of facts (a key-value database with the current state of assets) and a separate history of their updates (distributed transaction log). The transactions that you submit are stored and verified without the involvement of a governing central authority using advanced mathematics and computer science, that is, cryptographic hash functions.

The blockchain not only secures these transactions but also protects their integrity (and anonymity). This demonstrated in the following diagram:

The flow that a transaction follows from submission to being verified by the majority of networks

Now let's take a closer look at the preceding diagram that describes the flow of transactions in a blockchain. When you want to exchange data with someone else on the blockchain, you do this by submitting a transaction in which you propose your changes. A Transaction usually contains the context (action) in which it should be executed and any asset that can be described in digital form, such as currency, contracts, and incident and medical records. The Data structure of proposed changes to an asset can be both structured and unstructured, but often it is represented as JSON (JavaScript Object Notation), which is a human-readable text format for data objects.

A typical blockchain provides client APIs to interact with the transaction, but generally you would use a web application that calls the API with which you would submit your transaction to one of the active nodes (peers) in the network.

Depending on the network's capabilities, the transaction is either locally validated or directly broadcast to all active nodes in the network using the peer-to-peer network (P2P). When locally validated, your transaction is only broadcast after validation, based on a set of network rules. Each node that receives your transaction will, depending on network rules, either verify it instantly or transcribe it into a secure record and place it in a queue of pending transactions. In this case, nodes, in other words, the participating computers or servers in the network, verify whether your transaction is valid based on a set of rules to which the network has agreed.

For example, your transaction can trigger participating nodes to execute business logic (such as a smart contract) and follow the consensus protocol to verify the results. Some consensus protocols require you to pay a transaction fee to get your transaction verified. The amount you pay is part of your transaction, and it determines the time it takes to get verified. Some nodes that create blocks only verify transactions that have a higher reward.

Depending on the rules defined by the network's protocol, validating nodes combine transactions into a block and digitally fingerprint the result so that they can be validated by other nodes in the network. Just like transactions, blocks are broadcast to all active nodes using the peer-to-peer network. When consensus is reached, depending on the network' rules, participating nodes either batch the transactions and store the results as a cryptographically secured, immutable data block, or they take the approved block and append it to their ledger. Consensus protocols may include a reward system for nodes that create a block or require you to pay a transaction fee to distribute the currency to the rightful recipient.

Following the consensus mechanisms and network rules, it may take several blocks until you can be certain that your transaction is verified and not part of an orphaned chain. It is possible for multiple peers to create a block at the same time or just a few seconds apart from each other. This can produce a fork in the chain. Both blocks are initially accepted by the majority of the network, creating two chains. For any block of transactions, however, there is only one way to the genesis block (that is, first created in the chain), and blocks that are part of the smaller chain are eventually rejected.

 

 

In the following diagram, you can see that the longest chain survives and that smaller chains are rejected:

The genesis block is shown in green. The main chain is shown in black and the orphaned/rejected chain appears in red.

Those transactions that are part of the rejected block(s) are added back to the pool of queued transactions and will eventually be included in another block. With blockchains that use an incentive model, the reward that someone receives for solving an orphaned block is practically lost.