-
Notifications
You must be signed in to change notification settings - Fork 12
How to start las2peer with ethereum (v1.2)
- Docker:
Please check if it is properly installed or not by using the following commands: docker --version
docker-compose --version
.
Useful tip for Windows users is to set up the PowerShell Execution Policy the following way: Open Windows PowerShell as administrator and use the command Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
.
- Let's start by creating a file
ethcompose.yml
with the following content:
version: "3"
services:
ethereum:
image: rwthacis/monitored-geth-client
ports:
- 30303:30303/udp
- 30303:30303/tcp
- 8545:8545/tcp
- 8546:8546/tcp
environment:
GETH_VERBOSITY: "3"
ETHEREUM_DATA_DIR: /root/.ethereum/devchain
volumes:
- ethereumStoragePersistent:/root/.ethereum/devchain
command: /root/start.sh
volumes:
ethereumStoragePersistent: {}
Now open the terminal from the directory you saved the ethcompose.yml
file and run the following command to start the Ethereum network:
Windows: docker-compose -f .\ethcompose.yml up
Linux: docker-compose -f ./ethcompose.yml up
You can also see the following Volume being created in the Docker Desktop App:
- Next,
git clone https://github.com/rwth-acis/las2peer-registry-contracts.git
. Open the terminal from the directory you cloned the repo in and install the dependencies withnpm install
, then 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 using the command:
gradle clean build
. -
In this step in the las2peer-template-project\etc folder, where we can find the properties for the WebConnector and the service, create new file
i5.las2peer.registry.data.RegistryConfiguration.properties
with the following content:
endpoint = http://127.0.0.1:8545
gasPrice = 20000000000
gasLimit = 6721975
communityTagIndexAddress = 0xeB510FB89C25cc1Af61fE45B965b5Fe27F1BCBa0
userRegistryAddress = 0x0e8acA05A8B35516504690Fa97fAEa69bbAFf901
reputationRegistryAddress = 0xd35284B7644732094338559c13a5CE880D247D37
serviceRegistryAddress = 0xdD76D242AAe1C3251DaE4f90EB0021215e62AFc4
groupRegistryAddress = 0x1A37393184eD5D0040521728cBbfc819e07E9d20
You should make sure that the contract addresses from Step 2 match the addresses in this file. If they don't, then replace the contracts' addresses with the values from your terminal!
-
Windows: Replace the content in the start_network.bat file in the directory
las2peer-template-project\bin
with:
%~d0
cd %~p0
cd ..
set BASE=%CD%
set CLASSPATH="%BASE%/lib/*;"
set ADD_OPENS=--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED
set ETH_MNEMONIC=--ethereum-mnemonic "differ employ cook sport clinic wedding melody column pave stuff oak price"
set ETH_OPTIONS="node=getNodeAsEthereumNode()" "registry=node.getRegistryClient()" "n=getNodeAsEthereumNode()" "r=n.getRegistryClient()"
java -cp %CLASSPATH% %ADD_OPENS% i5.las2peer.tools.L2pNodeLauncher %ETH_MNEMONIC% --node-id-seed 1 --port 9011 --service-directory service uploadStartupDirectory startService('[email protected]') startWebConnector %ETH_OPTIONS% interactive
pause
Start the service by running the start_network.bat
file.
Linux: Replace the content in the start_network.sh script in the directory las2peer-template-project\bin
with:
java -cp "lib/*" --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED i5.las2peer.tools.L2pNodeLauncher --port 9011 --service-directory service uploadStartupDirectory --ethereum-mnemonic "differ employ cook sport clinic wedding melody column pave stuff oak price" "node=getNodeAsEthereumNode()" "registry=node.getRegistryClient()" "n=getNodeAsEthereumNode()" "r=n.getRegistryClient()" startService\(\'i5.las2peer.services.templateService.TemplateService@1.0.0\'\) startWebConnector interactive
Start the service by executing the start_network.sh
script from the root directory of the deployment with ./bin/start_network.sh
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.
- 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 Docker Desktop App and remove the volume. - Check the output of the template_service in the browser: localhost:8080/template/get