Four genuine blockchain use cases
Don't waste your time attempting this project on any 32-bit OS, a Mac, any version of Windows, or any version of Kali. It is possible to get the blockchain running on 64-bit Windows, but not this GUI.
The instructions below use two VMware virtual machines.
A good way to do this project is with two students working together. You can also do it with one student and two machines (real or virtual).
In a Terminal window, execute these commands:
sudo apt update
sudo apt install openssh-server -y
Execute this command to find your
Linux server's IP address:
ip addr show
Find your IP address,
as highlighted in the image
below.
In a Terminal window, execute these commands:
cd /tmp
wget https://www.multichain.com/download/multichain-latest.tar.gz
tar -xvzf multichain-latest.tar.gz
cd multichain-1.0.5
sudo mv multichaind multichain-cli multichain-util /usr/local/bin
multichain-util create chain1
multichaind chain1 -daemon
The response contains the command to
use to join the blockchain,
as highlighted in the image below.
multichaind chain1@172.16.1.253:6457 -daemon
The node can't join the blockchain,
because it lacks "connect" permission.
The command that must be executed on the Primary Node is shown, as highlighted in the image below.
multichain-cli chain1 grant 13r9FcgicW5pCLGBvuw8cZXLBYVXEQ7nbuR4Nj connect
The command succeeds, returning a long
Transaction ID number,
as shown below.
multichaind chain1@172.16.1.253:6457 -daemon
The node joins the blockchain successfully this time,
as shown below.
multichain-cli chain1 help
A long list of commands appears,
including the "getinfo" command,
as shown below.
On either node, execute this command:
multichain-cli chain1 getinfo
Information about the blockchain appears,
as shown below. Notice that the blockchain
is very small, containing only 69 blocks.
Multichain doesn't mine blocks when there
are no new transactions, making it far more
efficient for small, closed blockchains than
Bitcoin or Ethereum.
On either node, execute this command:
multichain-cli chain1 help getinfo
The help message explains how the "getinfo" command
works, and ends with examples, including one starting
with "curl",
as highlighted in the image below.
The "curl" commands show how to use the RPC, which is designed for Web-based clients and GUI's.
On either node, execute this command:
multichain-cli chain1 getchaintips
Find the "status" of your blockchain,
redacted in the image below.
sudo apt install git curl -y
Execute these commands:
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
When you are prompted to, press ENTER to
continue.
Execute these commands:
sudo apt update
sudo apt install php7.2 -y
sudo apt install php7.2-curl php7.2-dev -y
cd /var/www/html
sudo git clone https://github.com/MultiChain/multichain-web-demo.git
cd multichain-web-demo/
sudo cp config-example.txt config.txt
cat ~/.multichain/chain1/multichain.conf
grep rpc-port ~/.multichain/chain1/params.dat
You see the username, password, and port number,
as shown below.
Now you need to enter those credentials into the GUI configufation file.
Execute this command:
sudo nano config.txt
Enter the port and password into this file,
as shown below.
To save the file, press Ctrl+X, Y, Enter.
Execute this command to restart Apache:
sudo service apache2 restart
Troubleshooting
If you have a Multichain node running and you want to delete it and start over, execute these commands:
pkill multichain cd sudo rm -r .multichain sudo rm -r /var/www/html/multichain-web-demo
Troubleshooting
If you are developing more PHP pages, it helps to turn on PHP error reporting. This is insecure, and should not be enabled on production servers.To find the PHP configuration file, execute these commands:
Find the file in an "apache2" folder, as highlighted in the image below.
sudo updatedb locate php.iniExecute this command to edit that file, adjusting the file path as necessary:
Change display_errors to On, as shown in the image below.
sudo nano /etc/php/7.2/apache2/php.iniSave the file with Ctrl+X, Y, Enter.
Execute this command to restart Apache:
sudo service apache2 restart
ip addr show
Find your IP address,
as highlighted in the image
below.
In a Web browser, enter your IP address followed by /multichain-web-demo.
The GUI opens, as shown below. Click Default.
You see basic information about your blockchain, as shown below.
Troubleshooting
Here are some common problems and solutions.Multichain Not Running
Problem: "Error: HTTP 0", as shown below.Solution: on the primary node, execute this command:
Solution: on a secondary node, execute this command, adjusting the IP and port number as needed.
multichaind chain1 -daemon
multichaind chain1@172.16.1.253:6457 -daemon
Incorrect RPC Password
Problem: "Error 401 Unauthorized", as shown below.Solution: execute this command to find the correct password:
Execute this command to correct it:
cat ~/.multichain/chain1/multichain.conf
sudo nano /var/www/html/multichain-web-demo/config.txt
Fill in these fields, leaving the other fields at their default values, and replacing "YOURNAME" with your own name, as shown below.
Scroll to the bottom of the page and click the "Issue Asset" button.
A green message says "Asset successfully issued...", as shown below.
There's also a "Warning" message reminding us that this is all beta software, not a professional financial product.
On the right side, in the "Send Asset" section, click the "To address" field. Only one address is available, as shown below, and it's "local" -- that is, the Primary Node itself.
We can't send assets to the Secondary Node, because it doesn't have receive permission.
On the right side, in the "Change Permissions" section, the "For address" is empty, as shown below.
In the Secondary Node's GUI, at the top right, in the "My Addresses" section, highlight the address, right-click, and click Copy, as shown below.
In the Primary Node's GUI, in the right side, in the "Change Permissions" section, paste the address into the "For address" field.
Check Send and Receive, as shown below.
Click the "Change Permissions" button. A green message says "Permissions successfully changed...".
On the right side, in the "Send Asset" section, click the "To address" field and select the second address, the one that is not "local".
Enter a Quantity of 50, as shown below.
Click the "Send Asset" button.
A green message says "Asset successfully sent...".
In the Secondary Node's GUI, in the top menu bar, click Send.
On the left side, the "Available Balances" section now shows 50 "YOURNAME-Coin", as shown below.
Fill in these fields, leaving the other fields at their default values, and replacing "YOURNAME" with your own name, as shown below.
Scroll to the bottom of the page and click the "Issue Asset" button.
A green message says "Asset successfully issued...".
In the Primary Node's GUI, in the top menu bar, click "Create Offer".
On the right side, in the "Create Offer" section, enter these values:
Click the "Create Offer" button.
A green message says "Offer successfully prepared...", as shown below.
On the left side, in the "Available Balances" section, one YOURNAME-GoldCoin is now "locked" -- that is, it cannot be spent for any other purpose, to ensure that it remains available for the atomic exchange.
Under the green message a long line of hexadecimal text appears, as highlighted in the image below. Double-click it and copy it to the Clipboard.
On the right side, in the "Decode Offer" field, paste in the hexadecimal text, as shown below.
Click the "Decode Offer" button.
The "Complete Offer" section appears, as shown below, showing that we can get a YOURNAME-GoldCoin for ten YOURNAME-Coins.
Click the "Complete Offer" button.
The exchange is successful, and you now have a GoldCoin, as shown below.
On the right side, in the "Permissions" line, find the word that is redacted in the image below.
Posted 6-4-16 by Sam Bowne
Revised 6-11-17
Updated to 1.0.1 10-16-17
Changed to a Windows project 6-15-18
GUI Troubleshooting images added 7-20-18