Course Outline
1. Cryptocurrency and Blockchain
2. Delving into Blockchain
3. Bitcoin and Blockchain
4. Bitcoin Mining
5. Ethereum
6. Setting up a Private Blockchain Environment Using Ethereum Platform
7. Hyperledger
8. Setting up a Development Program Using Hyperledger Composer
9. Creating and Deploying a Private Blockchain on Multichain
10. Prospects of Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Create & Deploy
a Private
Blockchain on
Multichain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Agenda
At the end of this session, you will be able to:
Define Multichain
Describe Multichain Streams
Create and Deploy a Private Blockchain
Explain Connecting to a Blockchain
Identify Multichain Interactive Mode
List Native Assets
Define Transaction Metadata
Explain Streams
Explain Mining
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain
“
Let’s learn about Multichain.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Blockchains for Enterprises
Private shared database
Control pf limit + cost
Designate “miners”
No digital money
Aggregate administrator
Shroud the points of interest
Blockchain as apparatus not belief system
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain: Introduction
• Multichain is an off-the-rack stage for the creation and
arrangement of Private Blockchains, either inside or
between associations.
“
• Derived from Bitcoin center programming,
consequently, it is perfect with Bitcoin biological
community.
“
• Multichain underpins Windows, Linux and Mac servers
• It gives a basic API and charge line interface that makes
it simple to maintain and deploy.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Bitcoin to Private Blockchain
Many aspects of Multichain’s design are aimed at enabling smooth transitions between Private
Blockchains and the bitcoin blockchain in either direction:
• Multichain depends on a fork of Bitcoin Core, the official customer for the bitcoin
network. Code changes are restricted, empowering future bitcoin upgrades to be
converged in.
• It utilizes bitcoin's protocol, transaction and Blockchain engineering, with changes just to
“
the hand-shaking procedure when two nodes initially connect. Every single other
element is executed utilizing metadata and changes to the approval rules for transactions
and blocks.
• Its interface (command line and API) is completely perfect with that of Bitcoin Core, with
all extra usefulness gave by new orders.
“
• It can go about as a node on the consistent bitcoin network (or other bitcoin like systems),
by means of a basic convention setting in the per blockchain arrangement record.
• Its multicurrency and informing highlights work comparably to the CoinSpark convention
for upgrading bitcoin transactions.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Aims of Multichain
The main aims of Multichain are:
1 To guarantee that visibility of Blockchain's action must be kept inside the picked members
2 To control over which transactions are allowed
3 To enable more secure mining with proof of work and its associated cost
The Blockchain framework just stores transactions identified with members.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Hand-shaking Process
Multichain uses a private key cryptography property to restrict blockchain access to a list of
permitted users, by expanding the “hand-shaking” process that occurs when two blockchain
nodes connect.
Every node displays its way of life as an open address on the allowed list.
Every node confirms that the alternate's address is without anyone else allowed list.
Every node sends a test message to the next gathering.
Every node sends back a mark of the test message giving their responsibility for the private
key relating to people in general address they exhibit.
On the off-chance that any of the nodes don't have the fulfilling comes about, they
prematurely end the distributed association.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Use Cases
Permission Blockchain
Validation by consensus, not by proof of work 01
Full asset Lifecycle
Issuance, transfer, exchange, escrow,
reissuance, redemption and destruction
02
General Storage and Search
64 MB of data per transaction
Streams: key-value, identitySTEP
and time series
03
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Permissions
Interface with network
Send and receive transactions
Keep in touch with a stream
Issue resources
Make streams
Add block to chain
Change authorizations by agreement
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Assets
No requirement for keen contracts
Flexible resource metadata
Permissioned take after on issuance
Atomic multi-resource payments
Multi-way atomic resource trades
Multi-signatures for security + escrow
Buy in to resource inquiry transactions
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Streams
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Streams “
Streams can be used to implement different
types of databases. Let’s learn more about
“
Multichain streams.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Streams
Streams
05
provide a natural abstraction for Blockchain use cases which focus on general data
06
retrieval, timestamping and archiving.
Any number of streams can be created in a Multichain Blockchain, and each stream acts as an
independent append-only collection of items.
Nodes choose which streams to index.
Streams can be used to implement three different types of databases on a chain:
• A key-value database or document store, in the style of NoSQL
• A time-series database, which focuses on the ordering of entries
• An identity-driven database, where entries are classified according to their author
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Streams Basics
Each item in a stream has the following characteristics:
One or more publishers who have digitally signed that item
A discretionary key for helpful later recovery.
A few information, which can run from a little bit of content to numerous megabytes of crude
double
A timestamp, which is taken from the header of the block in which the thing is affirmed
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Retrieving from Streams
If a node is subscribed to a stream, information can be retrieved from that stream in a number
of ways:
Retrieving items from the stream in an order
Retrieving items with a particular key
Retrieving items signed by a particular publisher
Listing the keys used in a stream, with item counts for each key
Listing the publishers in a stream, with item counts
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Consensus Model
Each block is digitally signed by the creator
• Only permissioned parties can “mine”
Mining diversity for distributed consensus
No proof-of-work or digital money
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Flexibility
There are 45+ Blockchain parameters.
• Block size/time, permissioning, admin consensus, mining, optional native currency, etc.
Authorizations can change after some time.
Resources: reissuance and devastation
Streams: hubs take after their interests
Custom metadata all around
They are bound together JSON-RPC API for applications.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Deployment Options
Environment agnostic:
• Self-hosted in data center
• Public or private cloud
• Accessed as a service
Nodes are added simply and quickly.
API cleanly separates app from node.
Shared administration model
• Smooth governance transitions
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Security in Multichain
Forked from Bitcoin Core
• $40B+ and more than 8 years of presentation to web
Full multi-signature bolster
Outer key administration
• Bitcoin equipment security modules
Agreement over information not execution
• Avoids Ethereum-style hard forks
• No need for fees to stop runaway
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Speed & Scalability
Millions of addresses, assets and streams
Unlimited transactions/stream items
1000 tps (1.0 bets 2 + mid-range server)
Signature verification + transaction processing, i.e., real Byzantine tolerance
Unlimited nodes in network
Block time as low as 2 seconds
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Process of Mining in Multichain Technology
Multichain defines miners to an identifiable set of entities. It introduces a criterion known as
mining diversity that binds with 0 <= mining diversity <= 1
The efficacy of block is verifiable by performing the following steps:
• Apply the changes in permissions set by transactions and the block, respectively
• Count the total approved miners set after these variations in the block
• Multiply the number of miners by mining diversity and round up to attain left spacing
This put the round-robin plan for impact in which the allowed mineworkers must make obstructs
in turn in request to produce a legitimate Blockchain.
The mineworkers make obstructs in a turn in this calendar to produce a precise Blockchain.
The mining decent variety measure builds up the unbending nature of the plan.
The "one" esteem outlines that the pivot incorporates each of the allowed diggers. While, zero
limitations implies no limitations by any means.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
The params.dat File
You can set these values in a params.dat file. The params.dat file contains the whole configuration
as follows:
The chain’s protocol Mining reward
Target time for block Permitted transaction type
Active permission types Maximum block size
Mining diversity Maximum metadata per transaction
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Create & Deploy a Private Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Create & Deploy a Private Blockchain “
Now, we are going to learn steps to create and
deploy a Private Blockchain.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Steps to Create & Deploy a Private Blockchain
Following are the steps to create and deploy a Private Blockchain:
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 1: Creating a Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Download & Install Multichain
su (enter root password)
cd /tmp
wget https://www.multichain.com/download/multichain-1.0.3.tar.gz
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Download & Install Multichain
tar -xvzf multichain-1.0.3.tar.gz
cd multichain-1.0.3
mv multichaind multichain-cli multichain-util /usr/local/bin
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating a Blockchain
First, we will create a new Blockchain named chain1 (you can give the name of your choice).
On the first server, run this command: multichain-util create chain2
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Viewing Default Settings
To view the Blockchain’s default settings, run the following commands:
cat ~/.multichain/chain1/params.dat
(The above command will list the parameters and settings of the Blockchain)
Note: The list shown here is just a specimen, as the list was too long to display on the ppt.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Initializing the Blockchain
Run the following command to initialize the Blockchain, including mining the genesis block:
multichaind chain1 -daemon
Note: You should be told that the server has started and then, after a few seconds, that the genesis block
was found. You should also be given the node address that others can use to connect to this chain.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Connecting to a Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Connecting to a Blockchain “
Let’s learn about Connecting to a Blockchain.
“
.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 2: Connecting to a Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Connecting to a Blockchain from the Second Server
Now, we’ll connect to this Blockchain from elsewhere. On the second server, run the following:
multichaind chain1@[ip-address]:[port
Note: You should be told that the Blockchain was successfully initialized, but you do not have permission
to connect. You should also be shown a message containing an address in this node’s wallet.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Adding Connection Permissions for the Address
To add connection permissions for this address, run the following:
multichain-cli chain1 grant 13qhJDHhdvTjVr4qyjfkUXF92kyVmWz1FsyfnMconnect
The above command will grant permission to connect to the specified address.
Note: The address here is unique for this particular Blockchain. It will be different when you run your
Blockchain.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Reconnecting from the Second Server
Now, try reconnecting again from the second server:
multichaind chain1 -daemon
Note: You should be shown a message that the node has been started, and it should display the second
node’s address.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Interactive Mode
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Multichain Interactive Mode “
Let's learn about the Multichain Interactive Mode.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 3: Multichain Interactive Mode
Before we proceed, let’s enter the interactive mode so that we can issue commands without
typing multichain-cli chain1 every time.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Switching to the Interactive Mode
To enter the Multichain interactive mode, on both servers run the following command:
multichain-cli chain1
Server 1:
Server 2:
Note: Now that the Blockchain is working on two nodes, you can run the commands in this section on
either any one or both nodes.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Getting the General Information
To get the general information of the Blockchain, execute the following:
getinfo
The above command will provide the general information about the Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Permissions Currently Assigned
To show all the permissions currently assigned, execute the following:
listpermissions
The above command will list all the permissions currently assigned to the address.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating a New Address in the Wallet
To create a new address in the wallet, execute the following:
getnewaddress
The above command will create a new address in the wallet.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
List All Addresses
To list all the addresses in the wallet, execute the following:
getaddresses
The above command will list all the addresses in the wallet.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Getting Blockchain Parameters
To get Blockchain parameters, execute the following:
getblockchainparams
The above command will display the parameters of this blockchain.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Getting a List of Connected Peers
For each node, get a list of connected peers by executing the following:
getpeerinfo
The above command will list the connected peers.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Native Assets
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Native Assets “
Let's learn about Native Assets.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 4: Native Assets
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Getting Permissions to Create Assets
Now, we are going to create a new asset and send it between nodes.
On the first server, get the address that has the permission to create assets by running the following:
listpermissions issue
The above command will list the address that has the permission to create assets.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating a New Asset
Now, we’ll create a new asset on this node with 1000 units, each of which can be subdivided
into 100 parts, sending it to itself.
To create a new asset, execute the following:
issue 1JXy9Va15ikDf4xmE8XGu74ZuxfAnz3Ug6pq4J asset1 1000 0.01
The above command will issue asset1 to the specified address.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Verifying the Asset
On both servers, verify that the asset named asset1 is listed by the following command:
listassets
Server 1:
The asset can be
seen listed in both
servers.
Server 2:
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking Asset Balances
Now, we will check the asset balances on each server. The first should show a balance of 1000,
and the second should show no assets at all.
Server 1
The first server shows
the asset balance of
1000, whereas the
second server has no
asset at all. Hence,
verified.
Server 2
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Sending the Asset
On the first server, now try sending 100 units of the asset to the second server’s wallet.
To send the units, execute the following command:
gettotalbalances
Server 1
The first server shows
the asset balance of
1000, whereas the
second server has no
asset at all. Hence,
verified.
Server 2
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Adding Permissions
Beforehand, you probably might have observed a blunder that the address does not get
authorizations. So, it's a great opportunity to include get and send authorizations.
To allow authorizations to the address, execute the accompanying order:
grant 13aNooypwXPW5NzuxvzGEDtEG6Hxtq8LhpByd receive, send
The above command will grant permission to the address to receive or send the asset.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Resending the Asset
Now, try sending the asset again, and it should go through:
sendasset 13aNooypwXPW5NzuxvzGEDtEG6Hxtq8LhpByd asset1 100
The above command will now send the asset to the particular address.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking Asset Balances
Now, we will check the asset balances on each server, including transactions with zero
confirmations. They should be 900 and 100, respectively.
To check asset balances, execute the following command:
gettotalbalances 0
You can see Server 1
that the Server
1 asset balance
is now 900,
and Server 2
has an asset
balance of 100.
Server 2
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
View Transaction
You can likewise see the transaction on every node and perceive how it influence their
equalizations.
To view the transaction, execute the following command on each node:
listwallettransactions 1
Server 2
Server 1
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Transaction Metadata
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Transaction Metadata “
Let's learn about Transaction Metadata.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 5: Transaction Metadata
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking Asset Balances
To create a transaction with some metadata on the first server, execute the following
command:
sendwithdata 13qhJDHhdvTjVr4qyjfkUXF92kyVmWz1FsyfnM '{"asset1":125}'
48692066726f6d204d756c7469436861696e21
This is just an example of metadata,
and it can be anything of your choice.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Examining the Transaction
Now, the previous transaction can be examined on the second server.
To examine the second server, execute the following command:
getwallettransaction ϭϯϯϯ7eϮa…..ϭϬfϭ7
This is the transaction ID.
In the balance field, you can see the
incoming 125 units of asset1 and the
data field containing the hexadecimal
metadata that was added.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Streams in Multichain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Streams in Multichain “
Let's learn about Streams in Multichain.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 6: Streams in Multichain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Examining the Transaction
To create a stream, execute the following command on the first server:
create stream stream1 false
Note: The false means that the stream can only be written to and by those with explicit permissions.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Permissions of the Stream
Let’s see the permissions of the stream.
To see the permissions, execute the following command:
listpermissions stream1.*
Note: So far only the first server has the ability to write to the stream, as well as administrate it.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Publishing to the Stream
Let’s publish something to the stream using the key.
To publish to the stream with the key, execute the following:
publish stream1 key1 73747265616d2064617461
This is just a random data. It can
be anything of your choice.
Note: So far only the first server has the ability to write to the stream, as well as administrate it.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking the Visibility of the Second Server
Now, let’s see whether the stream is visible on another node.
For this, on the second server execute the following command:
liststreams
The above command will list the streams.
Note: Here, the root stream was in the system by default.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Allowing Second Server to Subscribe to the Stream
Now, we want the second server to subscribe to the stream and view its contents.
To subscribe to the stream and view its content, execute the following command:
subscribe stream1
liststreamitems stream1
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Allowing Second Server to Publish to the Stream
Now, we want the second server to be allowed to publish to the stream.
To publish to a stream, first we have to provide permission to the address. For this, execute the
following on the first server:
grant 13aNooypwXPW5NzuxvzGEDtEG6Hxtq8LhpByd receive,send
grant 13aNooypwXPW5NzuxvzGEDtEG6Hxtq8LhpByd stream1.write
Note: The address needs both general send/receive permissions for the Blockchain, as well as permission
to write to this specific stream.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Publishing items on the second server
Now, let’s publish a couple of items on the second server, by running the following:
publish stream1 key1 736f6d65206f746865722064617461
publish stream1 key2 53747265616d732052756c6521
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining “
Let’s learn more about mining.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Step 7: Mining
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Start Mining
To start the mining process, on the first server run the following:
grant 13qhJDHhdvTjVr4qyjfkUXF92kyVmWz1FsyfnM mine
grant 1ZzjXBkmMAkGad3KA8LSZwEfndFkjvY7v2hkke mine
Note: We have granted mining permission to both nodes.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Check if the Two Permitted Miners Are Listed
To check whether the two permitted miners are listed, execute the following command on the
second server:
listpermissions mine
We can see that the
mining consent is
allowed to both
mineworkers.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Setting Runtime Parameters
To maximize the degree of miner randomness, execute the following command:
setruntimeparam miningturnover 1
Note: Presently, sit tight for a few minutes with the goal that a couple of blocks will be mined.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking the Current Block Height
To check the block height on both servers, run the following command:
getinfo
Note: The block stature is in the blocks field of the reaction.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Getting information of last few blocks
Now let’s get information about the last few blocks, beginning with this (here, 197) one:
getblock [block-height]
The address of the digger of each block is in
the mineworker field of the reaction. In
various blocks you should see the two
unique locations in this field
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Thank You
Email us:
[email protected] Visit us: https://intellipaat.com
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.