What is Blockchain?

Blockchain has long been resonating beyond the walls of the software industry. Every day, messages circulate about the development of the Bitcoin price index, while startups are competing to create the next earth-shattering business model based on this technology.

Yet what do we really understand about it?

At the peak of the 2008 financial crisis, an individual or a group of individuals acting under the pseudonym Satoshi Nakamoto sent a paper entitled “Bitcoin: A Peer-to-Peer Electronic Cash System” to a mailing list. It contained a practical solution to a problem that had left virtual currency theorists scratching their heads: the Byzantine General’s Problem.

Creating Consensus Among Decentralized Players

The Byzantine General’s Problem originates in an historical legend at the time of Constantinople’s fall to the Ottoman Empire in 1453. The fortified city could only be successfully overrun with help of carefully planned troop movements coming from various directions. To achieve this, the commanding Ottoman generals had to resort to communicating through messengers. However, the decision about the moment of attack was severely hampered by one key detail: As some of the generals wanted discredit their colleagues to the sultan, they purposefully provided false information to instigate a premature attack. From that point on, none of the generals could be sure if the incoming messages were authentic or not.

The crux of the problem was the issue of consensus, deriving from the fact that the individual decision-makers could not trust one another.

Money and the Role of the Intermediary

The same situation applies to digital transactions of value. How can we reach consensus that a virtual dollar will not be paid out twice? To date, the answer could not have been simpler: by involving an intermediary third party to oversee all transactions; in other words, a bank.

This isn’t always smooth sailing. International payments in the form of SWIFT transferrs often take several days to process due to the various parties involved. This increases the transaction costs and makes small one-off payments inconvenient. The option of being able to cancel a transaction also has its pitfalls; to be able to minimize fraud, providers of irreversible services are required to collect more information about their customers than is usually necessary.

Yet for physical value transactions the problem has been largely resolved. Take the following example: If Alice wants to pay Bob a certain sum of money, it is sufficient for her to hand him a counterfeit-proof coin that represents the respective value. It is impossible for Alice to make two separate payments simultaneously using the same coin.

There have been many attempts to convert the principle of physical currency into the digital world, yet with varying degrees of success. Bitcoin was the first to largely meet these demands.

Cryptographic Signatures and Digital Value

To ensure that digital coins can only be spent by their lawful owners, Bitcoin uses public-key cryptography. This involves a private key made up of randomly-generated numbers, which, in turn also derives a public key. Conversely, public keys cannot be used to derive the corresponding private key. A digital signature is generated from the private key and a set of data. The public key enables users to determine that the signature derives from the corresponding private key, without needing to know it.

Bitcoin also uses the cryptographic hash function, which converts large strings of data into fixed-length data values, otherwise known as a hash. A good hash function is characterized by a high level of security and can assign various input quantities using as few of the same hashes as possible.

Compared to an encryption, this process cannot be reversed. When applied to the same input quantity, the hash function always produces the same hash yet it cannot be attributed to the original input quantity. Every change to the input quantity generates a completely different hash. For this reason, hashes are also known as digital fingerprints.

A coin in the Bitcoin system is ultimately a combination of digital signatures. The coin is passed on when the owner (Alice) digitally signs a hash from the previous transaction and the receiver’s (Bob) public key. For Bob to be sure that Alice has not already used her coin in another transaction, all transactions are publicly available.

Mathematical Race to Reach Consensus

Bitcoin achieves this through a peer-to-peer network. A network node compiles various transactions together in a block, generates a hash from them, and releases it with a time stamp. Each block contains the hash from the previous block, thereby forming a chain: the blockchain.

This brings us back to the “Byzantine General’s Problem”: all nodes must agree on which transaction has taken place first and whether another block should be added to the chain. Bitcoin here uses the so called proof of work method. To add an additional block to the chain, the respective computer nodes are required to solve a complex mathematical puzzle. The node that first finds the solution then shares it with all the other nodes. Once the solution has been verified by them, every node adds the block to their copy of the chain. The process then starts all over again.

To comply with the changing total computing power in the network, the difficulty of the puzzle is constantly adapted, so that new blocks are added to the chain approximately every 10 minutes. If two blocks are found simultaneously, the next block found determines which sub-chain will be kept. The longest chain wins.

Since the puzzle must be re-solved for every change to the block, which is also the case for all subsequent blocks, the chain becomes more secure the longer it becomes. To change it, an attacker would have to re-solve the mathematical puzzle for all blocks before being able to add a new block to the chain. The element of trust, which currently exists in the form of a bank, is thereby contained within blockchain’s mathematical logic.

The Internet of Value

Blockchain functions as a distributed public journal that records irreversible transactions. Users can quickly and cost-effectively verify and audit their transactions without intermediaries.

Use cases of public blockchain have the potential to completely transform existing markets

Blockchain technology use cases are by no means restricted to Bitcoin. Blockchain is far more a message about the transmission of value — the “Internet of Value.” The database serves as the ultimate determination of ownership rights. All kinds of assets that can be transformed into digital twins can be included in blockchain: diamonds, buildings, good deliveries – the possibilities are endless.

Whether this innovation is disruptive or incremental depends on the areas of operation. Reaching consensus within or between companies means evolutionary change, while use cases of public blockchains have the potential to completely transform existing markets.

One blockchain use case is Everledger, a startup that produces digital twins for diamonds. These digital twins are calculated from 40 data points and are stored on blockchain, enabling the stone’s ownership to be traced from when it first mined to when it becomes a piece of jewelry. Over 1 million jewels have already been digitally secured — a real success story.

Learn more about how SAP is bringing blockchain to the enterprise. http://bit.ly/2yF6A8k #SAP #SAPCloud #AI

Part 1B: Using your Custom HTML5 application as User Task in Workflow

In this part of the blog, you will see how you can integrate your SAPUI5 application as Task UI in workflow.

Before we start the learning, there are few things you must know about the user task of SAP Cloud Platform Workflow.

The task associated with user-task activity in the workflow are available under the Tasks list in My Inbox application. The user interface configured for the user task is rendered as task UI when an end user opens the task in My Inbox. Application developer is, thus, given the flexibility to integrate any custom UI with the user task of workflow

This means that your existing custom application needs to be modified so that it can (a) access the task-data, (b) bind the task data with the UI elements of the application and © implement code for the task actions like complete, cancel etc.

Let us now learn how can you do that.

*

* Open the SAP Web IDE Full-StackRefer section Part 1A to ensure the you open with correct URL parameter
Note: Ensure that you have Workflow Editor feature enabled in the Web IDE.

Follow the guide to do so:
https://help.sap.com/viewer/f63bbdc234ce4211ab2cdb44564a0acd/Cloud/en-US/5e058cf1333b4e18bfa6431a52e991d3.html

* Create a new Workflow Project if you do not have one.Follow the guide to do so:
https://help.sap.com/viewer/f63bbdc234ce4211ab2cdb44564a0acd/Cloud/en-US/2b6375d9a80945ff852142b9543ff1e1.htmlIf you already have a workflow project, then you can create a new workflow in /workflows folder

* Click on the start event and from the speed buttons, select User Task

* Select the User Task and configure the task from the User Properties sectionIn General section, provide the name of the taskIn Details section, fill in the following details of the user interface that would be seen when the task is opened in My Inbox

Subject
This is the name of the task that would be seen in list of tasks when this task is available in the My Inbox.

Receivers
You can give comma-separated users or a group of users who will be able to see these tasks in their My Inbox. This is a way to control the access of confidential information and enables the access of information to the right set of people.

User Interface
Enter the details of the SAPUI5 application that you want to show when this task is opened in My Inbox.

HTML5 App: Name of the HTML5 application
Component URL: Location of  in the HTML5 project
SAPUI5 Component: SAPUI5 component name without  suffix

If you have doubts, then refer Step9 in the official documentation:
https://help.sap.com/viewer/f63bbdc234ce4211ab2cdb44564a0acd/Cloud/en-US/5e058cf1333b4e18bfa6431a52e991d3.html

Note: Carefully enter the required details as this is most crucial part of the configuration.

With this, you are done with the User Task configuration.

* Click on the empty space in the editor and change the Workflow Properties as shown.This means that the subject of the workflow, when seen from Workflow Monitoring application, would pick up the FirstName and LastName fields from the workflow context

* Finally, deploy the workflowNow let us see how the user task looks in the My Inbox application.
* Open the Workflow Monitor App from Fiori Launchpad.If you do not know the URL, then open the Fiori Launchpad URL from the Workflow service – Overview page in the cockpit
* Click on Workflow Definitions tile, and you will see your workflow

* Click on Start New Instance and enter the following initial payload to start the workflow { “user”:{ “FirstName”:“Kate”, “LastName”:“Beckett”, “city”:“London”, “country”:“United Kingdom” } }​

 
* Click on Show Instances button to see all the running instances of the workflow.Observe the name of the workflow. The first-name (i.e. Kate) and last-name (i.e. Beckett) is picked from the initial payload that is being sent while starting the workflow.Also notice the EXECUTION LOG, you see that a new task is created in MyInbox of list of recipients

* Logon to the My Inbox with the recipient username and password.You can find the tile of MyInbox app in the Fiori Launchpad URL seen in the workflow overview page (-in SAP Cloud Platform cockpit-)
* Open MyInbox and click on the task

But why did the context data did not get loaded?

Let us now see how to update the user interface to show the task data and workflow context in Part 1C

  http://bit.ly/2h1nqEn #SAP #SAPCloud #AI