Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
docker-compose -f validator.yml up -d validator
docker-compose -f validator.yml exec validator /init.sh --debug
docker-compose -f validator.yml stop validator
docker-compose -f validator.yml up -d validator
docker-compose -f validator.yml logs -f --tail=10 validator
5 changes: 5 additions & 0 deletions rebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
docker-compose -f validator.yml build --no-cache --force-rm validator
docker-compose -f validator.yml stop validator
docker-compose -f validator.yml up -d validator
docker-compose -f validator.yml logs -f --tail=20 validator
4 changes: 4 additions & 0 deletions restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
docker-compose -f validator.yml stop validator
docker-compose -f validator.yml up -d validator
docker-compose -f validator.yml logs -f --tail=10 validator
5 changes: 5 additions & 0 deletions resync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
docker-compose -f validator.yml stop validator
docker-compose -f validator.yml run validator --resync
docker-compose -f validator.yml up -d validator
docker-compose -f validator.yml logs -f --tail=10 validator
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ check_packages() {


#Chrony configuration
sudo apt install chrony
sudo apt install chrony wget
cat src/chronyConfig.tpl > /etc/chrony/chrony.conf
sudo service chrony restart
sudo systemctl enable chrony
Expand Down
6 changes: 3 additions & 3 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM parity/parity:v2.6.2-beta
FROM parity/parity:v2.5.7-stable
USER root

ADD start.sh validator.tpl /
ADD init.sh validator.tpl /
RUN apt-get update
RUN apt-get -y install sed
RUN apt-get -y install sed wget
80 changes: 80 additions & 0 deletions src/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

start () {
keypairs=(`ls /home/parity/.local/share/io.parity.ethereum/bloxbergData/keys/Bloxberg/UTC*`)

if [[ -z "${NAT_IP}" ]]
then
NAT_IP_STRING=""
else
NAT_IP_STRING="extip:${NAT_IP}"
fi

if [ -f "/engine_signer" ]
then
ENGINE_SIGNER=`cat /engine_signer`
fi

if [ -f "/debug" ]
then
DEBUG="-l sync,network"
fi

if [ -e "${keypairs[0]}" ]
then
echo "Keypair is present, skipping account generation"
if [[ -z ${AUTH_ADDRESS} ]]
then
KEYPAIR_FILE=`ls -1tr /home/parity/.local/share/io.parity.ethereum/bloxbergData/keys/Bloxberg/UTC* | head -1`
ENGINE_SIGNER='0x'`cat ${KEYPAIR_FILE} | awk -F 'address":"' '{print $2}' | awk -F '"' '{print $1}'`
else
ENGINE_SIGNER='0x'${AUTH_ADDRESS}
fi
else
cp /validator.tpl /home/parity/.local/share/io.parity.ethereum/validator.toml
ENGINE_SIGNER=`parity --config /home/parity/.local/share/io.parity.ethereum/validator.toml account new 2>&1 | grep 0x`
echo "Generated keypair: ${ENGINE_SIGNER}"
echo ${ENGINE_SIGNER} > /engine_signer
fi


cat /validator.tpl | sed s/"__ENGINE_SIGNER__"/${ENGINE_SIGNER}/ | sed s/"__NAT_IP__"/${NAT_IP_STRING}/ > /home/parity/.local/share/io.parity.ethereum/validator.toml

echo "Using Authority Address: ${ENGINE_SIGNER}"

parity --config /home/parity/.local/share/io.parity.ethereum/validator.toml $DEBUG
}

resync () {
rm -rf /home/parity/.local/share/io.parity.ethereum/bloxbergData/chains
rm -rf /home/parity/.local/share/io.parity.ethereum/bloxbergData/cache
wget https://raw.githubusercontent.com/bloxberg-org/bloxbergValidatorSetup/master/validator/bootnodes.txt -O /home/parity/.local/share/io.parity.ethereum/bootnodes.txt
}

debug () {
if [ -f "/debug" ]
then
rm -rf /debug;
echo "Debug mode disbled";
else
touch /debug;
echo "Debug mode enabled";
fi
}

while test $# -gt 0
do
case "$1" in
--start) start;
;;
--resync) resync;
;;
--debug) debug;
;;
--*) echo "invalid option $1"
;;
*) echo "invalid argument $1"
;;
esac
shift
done
37 changes: 0 additions & 37 deletions src/start.sh

This file was deleted.

13 changes: 7 additions & 6 deletions validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ services:
container_name: validator
volumes:
- ./validator:/home/parity/.local/share/io.parity.ethereum
entrypoint: /start.sh
entrypoint: /init.sh
command: --start
environment:
NAT_IP: 130.183.206.234
NAT_IP: __PUT_YOUR_PUBLIC_IP_ADDRESS_HERE__
#If you have multiple addresses, you can specify one address for the authority node.
#AUTH_ADDRESS: 0xab59a1ea1ac9af9f77518b9b4ad80942ade35088
user: "0:0"
ports:
- 8545:8545
- 8546:8546
- 30303:30303
ports:
- 8545:8545
- 8546:8546
- 30303:30303
38 changes: 0 additions & 38 deletions validator/validator.toml

This file was deleted.