Skip to content

How to start las2peer with ethereum (v1.2)

aparkova edited this page Mar 16, 2022 · 6 revisions

This tutorial is for Windows 10 users!

Tools needed

Windows 10 users need to have the Docker Desktop App installed.

Starting the las2peer network with ethereum

First let's make sure we have all the required prerequisites:

  • Docker: docker --version docker-compose --version
  • Node
  • Set up the PowerShell Execution Policy: Open Windows PowerShell as administrator and use the command Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Let's move on to downloading the ethcompose.yml file from this repository in our workspace directory (or just any directory of your choice). After you download the file, navigate to its directory open Windows PowerShell and run docker-compose -f .\ethcompose.yml up to start the ethereum network. Then you can see the following Volume being created in the Docker Desktop App:

DockerVolume

Next, clone the following GitHub repository: https://github.com/rwth-acis/las2peer-registry-contracts. When done, navigate to the directory, open it in Windows PowerShell install all the dependencies with npm install afterwards run the following command: ./node_modules/.bin/truffle migrate. If everything runs successfully you should see the deployed smart contracts with their addresses, transaction hashes, etc.

Now we have to build the las2peer-template-project, a way to do is in the terminal with gradle build.

Next, clone the las2peer git repository: https://github.com/rwth-acis/las2peer In order to connect the las2peer network to the Ethereum blockchain navigate to the directory you cloned the las2peer repository in and open your terminal then type the following command:

java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -cp "core/src/main/resources/;core/export/jars/*;restmapper/export/jars/*;webconnector/export/jars/*;core/lib/*;restmapper/lib/*;webconnector/lib/*" i5.las2peer.tools.L2pNodeLauncher --service-directory service --node-id-seed 1 --ethereum-mnemonic "differ employ cook sport clinic wedding melody column pave stuff oak price" startWebConnector interactive "node=getNodeAsEthereumNode()" "registry=node.getRegistryClient()" "n=getNodeAsEthereumNode()" "r=n.getRegistryClient()".

For Linux users the semicolons(;) must be replaced with colons(:) .

After the command was executed we can start my_new-service from the las2peer-template-project. Navigate to the .\las2peer-template-project\my_new_service\export\jars directory, copy the file inside and place it to .\las2peer\core\lib directory. Then start the service by executing the following command in the same terminal from the previous paragraph: startService("[email protected]").

To make sure everything runs properly, check the frontend: http://localhost:8080 If the fingerprint is green, then the node is connected to the blockchain.

Frontend-GreenFingerprint

Useful tips

  • Delete the .\build directory from the las2peer-registry-contracts before every migartion.
  • The running network can be shut down with docker-compose -f .\ethcompose.yml down and then you can go to the three dots of the volume in Docker Desktop and remove it.
  • Delete the .\node-storage directory from the las2peer after making any changes, to avoid errors the next time you run the service.
  • Check the output of the template_service in the browser: localhost:8080/template/get
Clone this wiki locally