** Prerequesites It is required to have docker-compose v2.3.3 installed for the scripts to work (or you get a nonsense misleading python error). To upgrade:
sudo apt update
sudo apt install docker-compose-plugin
docker compose version
sudo rm /usr/local/bin/docker-compose
echo 'alias docker-compose="docker compose"' >> ~/.bashrc
source ~/.bashrc
docker-compose version
docker build -f monitoring.dockerfile -t pocr-mon . In the root of the pocr-monorepo folder there is a docker-compose.yml that bootstrap many services
-
geth-bootnode: Used as discovery node for the blockchain and the
Dockerfileof the service can be found atpocr-network/bootnode/Dockerfile -
sealer-1,2,3: Those are 3 nodes that start
gethclient withProof Of Climate awaRenessand theDockerfilecan be found atpocr-network/sealer/DockerfileTheDockerfileusesmultistagethe default stageruntimewill download thegethbuilt priviously and available in the gitlab and the second stagedevis to getgethfrom local machine To usedevstage update in.envfile the keySEALER_TARGETbydevinstead ofruntimeand then copy yourgethbinary topocr-network/sealer/geth -
pocr-monitoring: frontend app that will monitor the network (local or remote) nodes and show the carbon footprint of each and the
CRCrewards cumulated by each -
lite-explorer: An opensource solution, to explorer the blocks of the blockchain
-
monitor and dahsboard: An opensource solution to start the ethstats monitor on the network
.env file
This file is used by docker-compose.yml to read the default environment variables
pocr-network/genesis directory
Everytime the smartcontracts changes the CICD will build and publish 2 genesis files kerleano.jsonand local.json, the sealer download the genesis of the blockchain (check pocr-network/sealer/Dockerfile ) and then use geth init with the file downloaded to init the network before the start
Deprecated This directory contains some genesis files used as example to bootstrap the blockchain locally. Example:
pocr-network/genesis/saturndev-sealer1-authorized.json: init the network with onlysealer-1as authorized node to seal blocks in the networkpocr-network/genesis/saturndev-all-sealers-authorized.json: init the network with all the 3 sealers authorized
You can start the local network with any genesis file you want by changing in .env file the path to genesis MOUNT_GENESIS_FILE_PATH=<path_to_genesis_file> and the network id NETWORK_ID=<network_id_of_the_genesis>
in the root folder there are start.sh and stop.sh scripts to start and stop the stack.
Those scripts use docker-compose.yml to start all or some specific services
./start.sh./start.sh all ./start.sh network./start.sh monitoring./start.sh network monitoring# start monitoring in background
./start.sh monitoring -d
# start network in background
./start.sh network -d./stop.shThe account 0x3D0a5f7514906c02178c6Ce5c4ec33256F08Ce58 is initialized with some CRC (6000 for now) in the genesis. To use it you have in the pocr-network/keystore folder the json wallet (which password is password) or the auditor private key.
The docker-compose persiste the data of sealers by mounting the volumes to the host using the keys in .env file
MOUNT_DATADIR_NODE_1=./pocr-network/data/node1/
MOUNT_DATADIR_NODE_2=./pocr-network/data/node2/
MOUNT_DATADIR_NODE_3=./pocr-network/data/node3/
If you want to reset the blockchain then delete /pocr-network/data directory (rm -rf /pocr-network/data/)
When you start the stack you can access the diffrent services at the urls bellow:
-
Pocr-monitoring:
http://localhost:8081/pocr/ -
ethstats:
http://localhost:8008 -
lite-explorer:
http://localhost:8800 -
rpc endpoints:
http://localhost:8541/,http://localhost:8543/andhttp://localhost:8545/if you start thereverse-proxynginx servicelbyou can usehttp://localhost/rpcas a loadbalance url to the 3 rpc endpoints -
ws endpoints:
ws://localhost:8542/,http://localhost:8544/andhttp://localhost:8546/if you start thereverse-proxynginx servicelbyou can usews://localhost/wsas a loadbalance url to the 3 ws endpoints -
Portainer: accessible at the url
http://localhost:9000At first, initiate Portainer with a login password You would then have the possibility to view your 3 nodes logs in real time directly in your browser, including possible monitoring services you would add in your network through the docker-compose.INFO [04-04|15:38:08.002] Commit new sealing work number=141 sealhash=f2a191..478cdb uncles=0 txs=0 gas=0 fees=0 elapsed="294.288µs" INFO [04-04|15:38:08.002] Carbon footprint nb nodes result=0000000000000000000000000000000000000000000000000000000000000000 INFO [04-04|15:38:08.002] No reward for signer node=0x6E45c195E12D7FE5e02059F15d59c2c976A9b730 error="no node in PoCR smart contract"