This is the transcript of the presentation on Multichain given on the 29th of Febuary on the Blockchain Vlaanderen meetup. In this presentation I gave the attendees a glimpse into Multichain. Multichain is an open source Bitcoin Blockchain fork that tries to deal with some of the biggest shortcomings of the Bitcoin Blockchain.
In essence the Bitcoin Blockchain is a single asset (Bitcoin) Blockchain, meaning it's a distributed immutable ledger that registers transactions of Bitcoin between addresses. Since it also allows to encode extra data into a transaction, data that I as immutable as the transaction itself, innovators in the Blockchain scene have begun to "abuse" this extra data to use Blockchain as a general purpose permanent decentralised data store. It does however have some major shortcomings.
It has a limited capacity. The Bitcoin Blockchain (at this time) can handle about 3-7 transactions per second. For everybody in the entire world... Compare this with Visa for example that handles a few thousand a second and can scale to several tens of thousands a second. This limits it's use for high volume use cases.
It also has transaction costs. Almost every transaction has a transaction fee built in, a fee used to pay the miners to take your transaction into account. With a Bitcoin price of 400 dollars and an average fee of 0.0005 Bitcoin a single transaction will cost 20 cents!
It's filled with data you don't need. The entire history ever is part of the Blockchain. We are already over 60GB of data. If you build something on this Blockchain, you need to store and process all this data.
In a lot of cases the openness of the Bitcoin Blockchain, where anyone can connect, read and interact with the chain, is not a benefit but a hurdle to take.
And last but not least the fact that it is a single asset Blockchain, which limits what you can store as native transaction elements without jumping though hoops and workarounds.
Multichain tries to solve this by creating a fork/copy of the original Bitcoin Blockchain code. They modified and extended the code to fix these issues.
First off they made it so that you can run private block chains. A private Blockchain is a chain where you can control who can connect, read and interact with the chain by adding a permissions system. Private can mean either in one company, but also in consortiums of companies. We've seen that, at this time, most practical applications, especially in financial and governmental applications, will start off with these private blockchains. According to rumour most Dutch Banks use Multichain for their experiments.
Since it's a private Blockchain, you have a lot more control about the miners in the chain. This allows you to have specific mining settings for your chain like mining diversity, block size and frequency and as such solve the capacity problems.
Since the miners are all part of your organisation or consortium, there is no need for mining rewards which removes all transaction fees.
And again because it's private and allows you to create multiple chains per server, your chains won't hold any superfluous data.
And last but not least they added support for multiple assets. For example an assets for stocks in company x, and an asset for company y, and an asset for euro's, etc.
If you have worked both bitcoin, you have noticed that you can send coins to someone, but in a multi asset exchange situation, if I send you my asset, how can I be certain you send your asset back. This is why they added atomic exchanges that fully prevent double spending and guarantee the assets are exchanged only if both sides are fulfilled.
Before we can start to play with Multichain, we need to install it and run at least 3 nodes. Since we need at least a few nodes, and speed in running in development is important, we are going to use Docker to run these nodes on my laptop.
I won't go into Docker or how this works, there are meetups for that, but by using these open source docker images I've made and this docker compose file you can get it up and running in no time.
First usecase I want to demonstrate is essentially a stock market. This is based on a real world application that will launch in production later this week.
It's called the Bolero Crowdfunding Boleuro. (Android) The application allows participants to experience investing in a crowdfunding campaign (essentially an IPO) by trading shares of the company. It will be used in production this Thursday at the Bolero Crowdfunding Inspiration Session in Antwerp, a first for Blockchain based applications in Belgium.
While building a complete application is too complicated to demo here, I will show a basic trading scenario in the following demonstration.
We go a bit more technical here, so keep up :)
# get the source code for this demo git clone https://github.com/Kunstmaan/hands-on-with-multichain.git # enter the code folder cd hands-on-with-multichain # run the installation routine # # You need: # - PHP 7 (if you tweak the composer.json a lower version might work # - Dinghy (Installation instructions on https://github.com/codekitchen/dinghy) # It will: # - Install Composer and the dependencies of this code # - Setup the Docker services # - Wait for 90 seconds while the Multichain is started and all nodes have finished connecting and syncing # - Create the MySQL database tables ./setupEnvironment.sh
At this point the Dockerised Multichain cluster is running. You can explore it by browsing to https://multichain-explorer.docker:2750/
# run the exchange example # IMPORTANT: Go slow! Actions need to be confirmed in all nodes of the chain, # until this is finished follow up commands will not work. ./runExchange.sh
Bitcoin style "send" transaction
Multichain style "exchange" transaction
A second example is related to the "general pupose" database capacities. In this demo we will store a document on the blockchain, and verify it. We also test a modified file to show that it is not verified.
# run the document example # IMPORTANT: Go slow! Actions need to be confirmed in all nodes of the chain, # until this is finished follow up commands will not work. ./runDocument.sh