- What is Multichain
- Pros and Cons of Private Blockchains
- Mining in Multichain
- Configuration of Blockchain in Multichain
- Implementation of MultiChain using SAP Cloud Platform
- Generic Architecture
- Setup of MultiChain on Cloud Platform
With boom in bitcoin and expansion of blockchain based platforms, a private blockchain network was introduced by Multichain for Enterprises and finance sectors. In this blog, we will explore multichain and how SAP has integrated it in to its cloud platform. Before we start with Multichain, please read What is Blockchain?
What is Multichain
Multichain is a platform which uses integrated management of user permissions to create private blockchains. It is derived from bitcoin. It supports Windows, Linux and Mac servers. Multichain was developed to overcome shortcomings of Bitcoin such as generic mining, privacy and openness.
Pros and Cons of Private Blockchains
Private blockchains are the one that are controlled by single or multiple organizations that determines who can read it, submit transactions to it, and participate in the consensus or mining process. This brings both advantages and disadvantages with itself.
It does not support smart contracts. As per SAP, “Since they are 100% centralized, private blockchains are useful as sandbox environments, but not for actual production.”
Mining in Multichain
Unlike Bitcoin, from which it is derived, Multichain does not depend only upon the concept of Proof of Work that can be owned by a single person in some situation. It uses a round-robin schedule, in which the permitted/authorized miners must create blocks in rotation to generate a valid blockchain. This scheme is implemented using a parameter called Mining diversity.
A mining diversity is a value between 0(No restriction) and 1(Every permitted miner must be included into rotation). In general, mining diversity is kept 0.75 which means if some miners are inactive, still the mining and rotation is possible. Now, based upon mining diversity value fixed by the blockchain administrator, following are the steps for validations that are required to add a block in the blockchain:
- All the changes that a transaction defines should be applied successfully and in order (It means an incomplete and unordered transaction cannot be added into a block)
- Count the miners that are permitted to mine (suppose 10)
- Multiply the miner count to mining diversity (suppose 10 * .75 = 7.5), round it up to get spacing (here 8)
- If the miner of this block has already mined the previous spacing (spacing – 1, here 7) then the block is invalid
Miners in Multichain neither charge transaction fees nor block rewards. Hence, transaction is free between two parties. But, a miner can charge a fixed service fee from the network participants. SAP too applies this type of fees and charge a fixed amount for a Block per hour.
Configuration of Blockchain in Multichain
In a configuration file, Multichain allows a user to set all the blockchain’s parameter that are mentioned below:
- Type of chain protocol (Private Blockchain or Bitcoin like Public Blockchain)
- Target time for blocks (time taken to add block, e.g. 1 min)
- Active permission types (e.g. Anyone can connect, only some can send/receive)
- Mining diversity (as discussed above, it will be a value)
- Level of consensus required (authorization) for creating/removing administrators and minors
- Mining reward (as discussed above, it can be zero too)
- IP ports for peer-to-peer connection and the JSON-RPC API (will discuss later)
- Permitted transaction type (e.g. pay-to-address, etc.)
- Maximum block size (e.g. 1 MB)
- Maximum metadata per transaction (termed as OP_RETURN; e.g. 4096 bytes)
These configurations are maintained in the first node or Genesis block. To add a new node, Multichain requires to be run from another computer using a node address (e.g. email@example.com:8571) with three parameters:
- The destination blockchain name (here chain1)
- Its IP port number (here 8571)
- The IP address of an existing node (here 22.214.171.124)
Implementation of MultiChain using SAP Cloud Platform
This is a generic architecture where it is shown how a MultiChain network is setup and how SAP Cloud Platform communicates with a MultiChain Node. To learn more about Multichain Architecture please refer the references.
Setup of MultiChain on Cloud Platform
To Create a MultiChain on SAP Cloud Platform, initially we need to setup our Global Account on SAP Cloud Platform and create a MultiChain enabled sub-account. Then only we can proceed with development.
Follow the following steps to enable MultiChain on your Cloud Platform:
Step 01: Go to your SAP cloud platform [If you don’t have, go here and create one] and select region as Europe (Frankfurt).
Step 02: Create a sub account there [Give your desired Display name and Subdomain name].
Step 03: Click Entitlements button from the left menu bar.
Step 04: Inside Entitlements menu, you will see Edit button, click it to change the mode to editable and scroll down to multichain as shown below:
Step 05: Click your sub account to open it. Click Spaces and create a new space giving all authorization to that space as shown below:
Step 06: Click on the newly space created and select Service Marketplace and scroll down to MultiChain and click to open it as shown below:
Once the initial setup of MultiChain is done, you can create your own nodes and instances. Follow Hands on Exercise to create your own SAP MultiChain service.