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.

 

SAP S/4: Study on Transformation

The study "Expectations on S/4HANA in 2022" by techconsult and CamelotITLab shows possible painpoints in any migration and how they can be avoided. With data from 200 companies in Germany.

Download the complete study here

Recommended articles

Innovation

Blockchain with SAP: Developing Applications with Hyperledger Fabric (I)

This blogpost is one of a series of articles on the “Blockchain mit SAP” (Blockchain with SAP) book published in 2019 (Rheinwerk …

read more
Logistics

Temperature Management and Supply Chain Visibility: What needs to be done

This final article of our blog series explores what needs to be done to integrate temperature management with supply chain visibility

read more
New Now in Organizations

My Journey to CAMELOT

One of our CAMELOT’s tells about his dream of being an Olympic champion in swimming and shares his personal journey towards …

read more

Reimagine your Value Chain with us

Contact us