Create your first permission blockchain with Multichain

A lifelong learner. Love to travel. Listen to music.
Search for a command to run...

A lifelong learner. Love to travel. Listen to music.
No comments yet. Be the first to comment.
Bitcoin raised the blockchain technology, whereas Ethereum took it to the next level. Often said, Blockchain 2.0, and Ethereum proved the possibility of blockchain technology beyond the financial sector. This public blockchain network is famous for a...
Best Practices for Path Structure, Versioning, and Error Handling

Understanding the Performance Implications of async and defer Attributes

Overview static: Default position. It does not allow setting properties like top, bottom, left, right, z-index relative: Acts the same as static. but allows positioning it relatively by putting properties like top, bottom, left, right, z-index absolu...

Overview When an element in the browser has a conflict of styles, the browser uses a set of rules to determine which style should be rendered. This set of rules is defined as CSS Selector Specificity. For instance, for an element, if we have the foll...

Master block, inline, flex, and grid to build better web layouts

Multichain is an open-source, bitcoin forked permission blockchain solution.
Let’s Imagine an application that is shared by multiple organizations. The application is interacting with an underlying database.
In a traditional centralized architecture, this database is hosted and administered by a single party which all of the participant's trust, even if they do not trust each other.
Transactions that modify the database are initiated only by applications on this central party’s systems, often in response to messages received from the participants. The database simply does what it’s told because the application is implicitly trusted to only send it transactions that make sense.
Multichain provides an alternative way of managing a shared database, without a trusted intermediary [Reference].
Core advantages are:
Rather than public blockchain, like Ethereum) or bitcoin, the transactions and activities are kept private to the selected participants.
Admin/Admins can make sure, which participants can connect to the blockchain and even read or write on the platform.
With all these goodies, although PoW is optional here, we can also include wallets, assets and create our own currency.
In this article, using multichain, we will create a permission blockchain solution.
Create two nodes
Each node will have a copy of the chain
We tweak some permission between these nodes
Create a block data in the first node chain and Make sure, that block data is available in the sibling node chain
Before we start, please create 2 ubuntu instances under the same network. Let’s call the first one origin_node and the second one sibling_1 node.
origin_node is the Genesis node. It also plays the role of admin_node.
The sibling_1 will get permission to connect with the chain and write.
For creating an instance, please consider the following criteria
Use ubuntu 16.04 server
Use a security group that allows port 443, 22 and 8333
443 for HTTPS, 22 for SSH and 8333 for Custom TCP
The objective of this section is to create a genesis node and run the chain. SSH to your origin_node.
ssh ubuntu@origin_node_public_ip -i key
Become a root user
sudo su
Download multichain
wget [https://www.multichain.com/download/multichain-2.0-alpha-5.tar.gz](https://www.multichain.com/download/multichain-2.0-alpha-5.tar.gz)
Extract files:
tar -xvzf multichain-2.0-alpha-5.tar.gz
Move files to binary directory
cd multichain-2.0-alpha-5
mv multichaind multichain-cli multichain-util /usr/local/bin
Return to home directory
cd ~
Create a genesis node
multichain-util create my-blockchain
Update default network and RPC port to 8333 and 8332
nano /root/.multichain/my-blockchain/params.dat
You can use the default network port. But you have to ensure to put the port explicitly in the next command.
Now run the node,
multichaind my-blockchain -daemon
You will get response like,
Other nodes can connect to this node using:
multichaind my-blockchain@origin_node_ip:8333
Now configure HTTPS and default network port firewall.
HTTPS for syncing and interacting other nodes and default network port to connect with other nodes.
ufw allow OpenSSH
ufw allow in 443/tcp
ufw allow in 8333/tcp
ufw enable
ufw status
We successfully run a multichain node.
Just like the previous origin_node install multichain.
ssh ubuntu@origin_node_public_ip -i key
sudo su
wget https://www.multichain.com/download/multichain-2.0-alpha-5.tar.gz
tar -xvzf multichain-2.0-alpha-5.tar.gz
cd multichain-2.0-alpha-5
mv multichaind multichain-cli multichain-util /usr/local/bin
cd ~
Initialize chain from origin_node
multichaind my-blockchain@private_ip_of_origin_node:8333
Now you should get a wallet address for further transactions.
Great, one sibling node is initialized.
Right now it’s the chain is initialized. But it does not have any permission to connect or write to the chain.
origin_node:We will grant Permission of sibling_node to connect and write to the chain.
From the origin_node, grant permission to connect and write,
multichain-cli my-blockchain grant sibling_1_node_wallet_address connect,send,receive,mine,create
Since permission is granted, now we can connect and write data to the chain from sibling_1 node.
Go to your sibling_1 and connect to the chain,
multichaind my-blockchain -daemon
To write some json data, go to interactive mode,
multichain-cli my-blockchain
Create a stream to mine some block,
create stream my-blockchain-stream true
Write data through the stream
publish my-blockchain-stream "json" '{"json":{"myKey":"myValue"}}'
Make sure, there is no space between the colon, cottation or brackets
It’s time to check, the chain is synced among all the nodes.
origin_nodeNow the chain data should be synced through all the nodes. To check this, Go to the origin_node and check if the data block exists in the chain. In the origin_node, Go to interactive mode,
multichain-cli my-blockchain
Subscribe to the stream
subscribe my-blockchain-stream true
Now your data should be displayed
liststreamitems my-blockchain-stream
You will get output something like this,
[
{
"publishers": ["1aokp3bti15AuRs51wPemtBuiqAdRDFaGYnRQw"],
"keys": ["json"],
"offchain": false,
"available": true,
"data": {
"json": {
"myKey": "myValue"
}
},
"confirmations": 4,
"blocktime": 1571709550,
"txid": "transaction_id"
}
]
Create a 2nd sibling with reading permission and read the chain
Create a 3rd sibling with written permission and verify the chain
Blog of Multichain: https://www.multichain.com/blog/2018/12/smart-contract-showdown/
Video Course: https://www.udemy.com/course/build-blockchain-deploy-private-blockchain/
Official Getting Started: https://www.multichain.com/getting-started/
Permissions: https://www.multichain.com/developers/permissions-management/
Runtime Parameters: https://www.multichain.com/developers/runtime-parameters/