This blog post is an article from a series of articles on the book published in December 2019 “Blockchain with SAP” (Rheinwerk publishing, Bonn, ISBN 978-3-8362-6914-8). This blog post concerns the eighth chapter of the book, which develops two example applications for MultiChain.

MultiChain is a descendant of the Bitcoin software, extended with functions for operation in private networks. Specifically, this is implemented through encryption to protect the participants’ communication.

The SAP Cloud platform supports MultiChain 1.0 and the new version 2.0. Version 1.0 does not support any smart contracts – MultiChain is therefore only a distributed ledger without the possibility for automation and programming. Only version 2.0 introduced smart filters – just another word for smart contracts. The programming language for it is JavaScript. MultiChain offers support for assets which can be managed in their own streams.

No smart contracts?

Without blockchain programmability, it prompts the question of configurability of separate applications – how are dezentralized applications developed for MultiChain?

The answer is RPC, or Remote Procedure Calls. The SAP Cloud platform offers a Swagger interface in the SAP Business Hub that allows you to configure your MultiChain entity via http calls. For this to work, you need to have your own MultiChain node provisioned and a service key created for it. You use this information to log in to the API page and set up a working environment (“Configure environments”), stating the new service keys. It would look something like this:

(c) Rheinwerk Verlag New working environment “Testing_Environment” to call up RPC methods. (Source: “Blockchain with SAP,” p. 366, Rheinwerk publishing, Bonn)

The screenshot on the left lists the two categories RPC (remote procedure calls) and Availability – the calls of the first category configure the MultiChain blockchain and the second category shows the general availability (“heartbeat”) of the node.

Pharmaceutical inventory

An initial basic application for the inventory of drugs is developed with MultiChain, analogous to the Hyperledger telephone book example from one of the previous blog posts. A single drug is labeled with its properties such as name, ID, date of manufacture, and so on – this must be recorded in the blockchain.

To do this, a separate stream must first be defined for a MultiChain blockchain – a separate data container for storing our drugs. Key-value pairs can in turn be assigned to this stream. The idea behind this is to store our drugs as JSON objects by stating a unique key in the blockchain.

Using the MultiChain API for version 1.0 sets up the stream – for this, a name needs to be assigned, “DemoStream” in this screenshot.

(c) Rheinwerk Verlag RPC API call for the system of a separate data stream in the MultiChain (Source: “Blockchain with SAP,” p. 372, Rheinwerk publishing, Bonn)

After a successful call, the blockchain is successfully configured and individual drugs can be written into the stream. This, too, happens by way of a special RPC call of the “publish” method.

SAPUI5 Frontend

After the backend has been successfully developed, a corresponding frontend can now be developed for it. The following screenshot shows the finished interface for the MultiChain pharmaceutical inventory.

(c) Rheinwerk Verlag Interface of a MultiChain-based pharmaceutical inventory for recording drugs (Source: “Blockchain with SAP,” p. 369, Rheinwerk publishing, Bonn)

The interface enables new products to be simply added, their availability edited and it lists all recorded products. It has been developed in the SAP web IDE and implements the general operations such as the saving of new drugs and the readout of available drugs in JavaScript. To do this, the frontend directly sends RPC calls to the MultiChain blockchain and receives the results for this which are in turn shown in the frontend. When writing, a new drug is written as a JSON object from the interface to the blockchain. The other way around, the interface can also send a read call via AJAX call to the blockchain in order to query all saved drugs.

More articles of this series can be found here:

 

Wollen Sie mehr zur SAP Cloud Platform und der Funktionsweise der Blockchains erfahren? In unserem Buch „Blockchain mit SAP“ erläutern wir Ihnen ausführlich die Funktionsweise und demonstrieren Ihnen anhand zahlreicher Beispiele die Vorzüge dieser innovativen Technologie. Eine ausführliche Leseprobe zum Buch stellt der Verlag online bereit.

Would you like to find out more about the possibilities of MultiChain for your company? Our book “Blockchain with SAP” gives a detailed explanation of the advantages of MultiChain-based blockchain solutions. A detailed extract from the book is available online from the publisher.

 

Recommended articles

New Now in Organizations

Transformation Analytics: The Key to Tackle S/4HANA Transformations

Change management in S/4HANA transformation projects is vital. In this blog we shed some light on the biggest challenges of …

read more
Supply Chain Management

How to plan your supply chain (Part I)

Within the last quarter of 2017 the number of Google searches for digitalization increased by more than 60%, which clearly shows the interest …

read more
CRM

Medical Technology Sales in 2021: Opportunities and Challenges

Representatives of the industry agree that 2021 is going to be a challenging year for medical technology sales. What exactly are the …

read more

Reimagine your Value Chain with us

Contact us