Blockchain-Agri-Usecase-using-Multichain

Step 1 : Download the Docker image

Step 1.1 : Copy to the home folder and load the docker by running the following command

	sudo docker load --input multichaindocker

alt-tag

alt-tag

Step 1.2 : Run the following command to check installed image.

	sudo docker images

alt-tag

Note : This docker image has the following things installed.

pip

wget

multichain link

Savoir link

Pubnub==3.8.3 link

logging

git

Step 2 : Open three terminals and run the docker image in three terminals.

Note : Decide the terminals with the names

   example :
   			container 1 - farmland 
   			container 2 - warehouse
   			container 3 - retailstore

alt-tag

alt-tag

Step 3 : run cd in each container.

alt-tag

Step 4 : clone the repo in three containers.

alt-tag

alt-tag

alt-tag

Step 5 : Choose the farmland contianer as the admin by starting the chain in the farmland container

Step 5.1 : run the command "multichain-util create chain1" in the farmland container.

multichain-util create chain1

alt-tag

alt-tag Step 5.2 : run the command "multichaind chain1 -daemon"

multichaind chain1 -daemon

alt-tag

alt-tag

Step 6 : Connect to the chain from the other(warehouse,retailstore) containers.

Step 6.1 : copy the command that given when you started the chain in farmland.

alt-tag

Step 6.2 : Run that command in other contatiners.

alt-tag

Step 7 : Now we have to give permissions for the other containers.

Step 7.1 : Copy the line that you got in the above operation.

alt-tag

Step 7.2 : Paste it in the admin(farmland) container and add two more permissions

	 1) issue 
	 2) mine

and run the command

alt-tag

alt-tag

Step 7.3 : Please follow the same procedure to give permissions for the retailstore container.

alt-tag

alt-tag

alt-tag

Now permissions are granted for the warehouse and retailstore containers.

Step 8 : Now we have to start the chain from the warehouse and retailstore containers.

multichaind chain1 -daemon

alt-tag

alt-tag

Step 9 : Next have to give permission for the burnaddress of the chain.

Step 9.1 : run the following command to get the info about the chain.

	multichain-cli chain1 getinfo

alt-tag

Step 9.2 : copy the burnaddress

alt-tag

Step 9.3 : Grant receive permission to the burn address by running following command.

multichain-cli chain1 grant <copied burnaddress> receive.

alt-tag

Step 10 : Now goto the repository root folder and run the following get.sh to get the

run the following command 

	sh get.sh

	rpcuser
	rpcport
	rpcpassword

alt-tag

Note : Run this program in three containers and save those values.

Step 11 : Now goto the respective folders in the container.

	container 1 - Farmland folder
	container 2 - Warehouse folder
	container 3 - Retailstore folder

alt-tag

Step 11.1 : Open the config.ini program in each container and paste those copied values from the step 10, and save.

Step 12 : Now the run the programs in three containers.

container1 - python farmland.py
container2 - python warehouse.py
container3 - python retailstore.py

alt-tag