Run Simulation - nreinhol/lem_sim GitHub Wiki

Presetting

A few requirements are needed, to run the simulation. Check the requirements section for more informations. If everything is properly installed, open your terminal and go into the lem_sim directory.

cd /path/to/lem_sim


Main Steps

  1. First of all, we have to start the local blockchain. For this type in:

docker-compose up ganache

  1. After that, we need to deploy the smart contract into the running local blockchain. Therefore, we open another terminal window and change the directory to:

cd /path/to/lem_sim/dealer

  1. To deploy the smart contract, type in the following expression:

truffle migrate --network development

  1. After these steps, the blockchain and the smart contract are ready for communication. Now, we move to the python application. Therefore, change the directory to:

cd path/to/lem_sim/pyapp

  1. Now, you need to set up the python virtual environment. Therefore, type in the following expression:

make requirements

  1. This expression will create a virtual environment in the folder pyapp/env and install all required python packages into this virtual environment. After the successful set up, type in the following expression to run the python simulation

make simulate


Tipps

  • To redeploy contracts without making any changes in the code base, use the following command:
    truffle migrate --reset --network development
    Otherwise, you have to restart the local blockchain and deploy the contract