Merge branch 'bvander/bloxberg-refactor' into 'master'

Bvander/bloxberg refactor

See merge request grassrootseconomics/cic-internal-integration!3
This commit is contained in:
Blair Vanderlugt 2021-02-04 01:34:56 +00:00
commit 59d70d76cb
12 changed files with 361 additions and 4 deletions

3
.gitmodules vendored
View File

@ -10,6 +10,3 @@
[submodule "apps/cic-meta"]
path = apps/cic-meta
url = git@gitlab.com:grassrootseconomics/cic-meta.git
[submodule "apps/bloxbergValidatorSetup"]
path = apps/bloxbergValidatorSetup
url = git@gitlab.com:grassrootseconomics/bloxbergValidatorSetup.git

@ -1 +0,0 @@
Subproject commit 6aad348b2dfa92d587614e38d43c95158ffcc02b

View File

@ -0,0 +1,3 @@
/validator/bloxbergData
/validator/bloxberg.log
keys/**/*

View File

@ -0,0 +1,26 @@
FROM parity/parity:v2.5.13-stable
# root user for installing os dep's and setting file permissions
# RUN apt-get update && sudo apt-get -y install sed
USER root
WORKDIR /root
# ARG BASE_PATH=root/.local/share/io.parity.ethereum/
ARG KEY_PATH=/root/keys/
# mount a key volume locally if you want to persist keys between runs
# to generate new account + keys run:
#
RUN mkdir -p $KEY_PATH
COPY ./validator/bloxberg.json \
./validator/bootnodes.txt \
./validator/validator.pwd \
./validator/validator.toml \
/root/
# RUN chown -R parity:parity $HOME/ && \
# chmod -R 775 $HOME/ && \
# chmod g+s $HOME/
# USER parity
ENTRYPOINT [ "parity" ]
CMD [ "--config", "/root/validator.toml", "--keys-path", "/root/keys/" ]

View File

@ -0,0 +1,62 @@
# Refactored bloxberg node
The original bloxberg node config was kind of annoying so I am running it more like vanilla parity. This way you can pass command flags directly to parity.
## Make some keys
```
docker build -t bloxie . && docker run -v ${PWD}/keys:/root/keys --rm -it -t bloxie account new --chain /root/bloxberg.json --keys-path /root/keys
```
## Enter the signer address and passwords in the config files
validator.toml
```
[mining]
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
engine_signer = "0x0a7cac94bcd82ced7cd67651246dcb6a47553d53" <---- address goes here
reseal_on_txs = "none"
force_sealing = true
min_gas_price = 1000000
gas_floor_target = "10000000"
```
validator.pwd <--- put your password in here or leave it blank if you didn't enter a password.
## Run it!
Mount the keys folder on your host if you want to preserve the keys between runs...
```
docker run -v ${PWD}/keys:/root/keys -it -t bloxie
```
---
# bloxbergValidatorSetup
This is a Docker image for running a validator node on the bloxberg blockchain.
Remote Machine Minimum System Requirements:
* Ubuntu 16.04 or 18.04 Image (Other Operating Systems can work, but commands may have to be altered)
* Minimum 2 CPU
* Minimum 2GB RAM Memory
* We recommend for future proofing at least 100 GB of SSD storage.
These are simply the minimum requirements and we do recommend to allocate more resources to ensure stability.
With the latest update to parity 2.7, it is also necessary for your server CPU to support aes. This can be found by running:
```
cat /proc/cpuinfo
```
on the server and checking in the flags column for aes.
Additionally, the blockchain connects to other nodes via port 30303, so it is important this port is open via your firewall beforehand.
In the `docker-compose.yml` you will also see the ports 8545 (JSON-RPC API) and 8546 (Web-Socket). These can be used to interact with blockchain via means of your local node but don't need to be accesible over the internet.
## Setup Process
1. Clone the repository to the server you are hosting the validator node.
2. Edit the validator.yml with a text editor (nano or vim) and change the NATIP variable to your external IP. Save this file
3. Edit the `validator/validator.pwd` file and insert a secure password. This will be used to encrypt your private key.
4. Run 'sudo ./setup.sh'.
5. Run 'docker-compose -f validator.yml up'. This will start the docker container and generate an ethereum address and an enode address. Send these both to the bloxberg consortium.
6. Use Ctrl+C to shut down the docker container. Lastly, run 'docker-compose -f validator.yml up -d'. This will daemonize the container and start running the validator node in the background.

View File

@ -0,0 +1,27 @@
#!/bin/bash
check_packages() {
if [ $(grep -i debian /etc/*-release | wc -l) -gt 0 ]; then
if [ ! -f /usr/bin/docker ]; then
echo "INSTALLING DOCKER"
sudo apt-get install -y docker-ce
fi
if [ ! -f /usr/local/bin/docker-compose ]; then
echo "INSTALLING DOCKER-COMPOSE"
sudo apt-get install docker-compose
fi
fi
#Chrony configuration
sudo apt install chrony
cat src/chronyConfig.tpl > /etc/chrony/chrony.conf
sudo service chrony restart
sudo systemctl enable chrony
sudo chown -R 1000:1000 ./validator
}
check_packages

View File

@ -0,0 +1,45 @@
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usuable directives.
# This will use (up to):
# - 4 sources from ntp.ubuntu.com which some are ipv6 enabled
# - 2 sources from 2.ubuntu.pool.ntp.org which is ipv6 enabled as well
# - 1 source from [01].ubuntu.pool.ntp.org each (ipv4 only atm)
# This means by default, up to 6 dual-stack and up to 2 additional IPv4-only
# sources will be used.
# At the same time it retains some protection against one of the entries being
# down (compare to just using one of the lines). See (LP: #1754358) for the
# discussion.
#
# About using servers from the NTP Pool Project in general see (LP: #104525).
# Approved by Ubuntu Technical Board on 2011-02-08.
# See http://www.pool.ntp.org/join.html for more information.
pool ntp.ubuntu.com iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2
# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys
# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift
# Uncomment the following line to turn logging on.
#log tracking measurements statistics
# Log files location.
logdir /var/log/chrony
# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it cant be used along with the 'rtcfile' directive.
rtcsync
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3

View File

@ -0,0 +1,21 @@
version: '2'
services:
validator:
build:
context: ./src
dockerfile: Dockerfile
container_name: validator
volumes:
- ./validator:/home/parity/.local/share/io.parity.ethereum
restart: unless-stopped
entrypoint: /start.sh
environment:
#CHANGE NAT_IP to your IP
NAT_IP: 130.183.206.234
#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"

View File

@ -0,0 +1,126 @@
{
"name": "Bloxberg",
"engine": {
"authorityRound": {
"params": {
"maximumUncleCountTransition": 5006743,
"maximumUncleCount": 0,
"stepDuration": "5",
"validators" : {
"list": ["0x0ade5bd2065debbb250e816f614bc342a6ef71c1"]
}
}
}
},
"params": {
"gasLimitBoundDivisor": "0x400",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x7A1200",
"networkID" : "0x2324",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
"eip658Transition": "0x0",
"eip145Transition": 5006743,
"eip1014Transition": 5006743,
"eip1052Transition": 5006743,
"eip1283Transition": 5006743,
"eip1344Transition": 5006743,
"eip1706Transition": 5006743,
"eip1884Transition": 5006743,
"eip2028Transition": 5006743
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0x7A1200"
},
"accounts": {
"0x0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0x0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0x0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } } },
"0x0000000000000000000000000000000000000006": {
"builtin": {
"name": "alt_bn128_add",
"activate_at": 0,
"pricing": {
"alt_bn128_const_operations": {
"price": 500
}
}
}
},
"0000000000000000000000000000000000000007": {
"builtin": {
"name": "alt_bn128_mul",
"pricing": {
"0": {
"price": {
"alt_bn128_const_operations": {
"price": 40000
}
}
},
"5006743": {
"info": "Istanbul HF",
"price": {
"alt_bn128_const_operations": {
"price": 6000
}
}
}
}
}
},
"0000000000000000000000000000000000000008": {
"builtin": {
"name": "alt_bn128_pairing",
"pricing": {
"0": {
"price": {
"alt_bn128_pairing": {
"base": 100000,
"pair": 80000
}
}
},
"5006743": {
"info": "Istanbul HF",
"price": {
"alt_bn128_pairing": {
"base": 45000,
"pair": 34000
}
}
}
}
}
},
"0x0000000000000000000000000000000000000009": {
"builtin": {
"name": "blake2_f",
"pricing": {
"5006743": {
"info": "Istanbul HF",
"price": {
"blake2_f": {
"gas_per_round": 1
}
}
}
}
}
},
"0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C": { "balance": "102000000000000000000000000000000" }
}
}

View File

@ -0,0 +1,16 @@
#MPDL Bootnode and Authority
enode://a7a53baf91b612b25b84993c964beb987879bfe7430cf6acb55bd721b9c0d96ceb1849049b1dcc0aa6e86fa1e2234280581b16c1265d56644fb09085e6906034@130.183.206.234:30304
enode://16287e6f87719b4f58f9598d74c82f2e4cebf2f3064a59659d9a553c5653864407fe5654beab39476a4e209725a63bf4c808d5340dd23989b15754294fe4a845@141.5.98.231:30303
enode://e6b181c16d20194029c220ce886fdc7a745cb37ee655c3b41ea744ec89143db6731a1c01ff3c40b39f969079090ad34e0e3319e47b0d22a8d510ff1f7b5a9ac7@130.183.206.234:30303
#GeorgiaTech
enode://4d9e6925ef3a92315283a655e856aa29dd516172c4f38d2a8fcd58c233a2cd80c57b507fed3bf351b1ac0611e8c7fefd6fb1c49de2d0d15eb1816d43629ac4ba@3.14.148.213:30303
#CMU
enode://ce0154eb13c1c038017151dd1ff4d736178ffedc33f5e11fe694c247eb09279886d253c3c775486eb709a65057901e2788098f991c58e6ad26ff957a8f45253e@128.2.25.89:30303
#UCL
enode://e41a38d659f13d47f3d88c5178e0cfe97487d3568000b85ae3a4abbcc35404d2628cee8a7e9071b63802542bafd886447ecf1d02fc663be0534779094a3e4fd1@128.16.12.165:30303
#Sarajevo
enode://a246cbc6a66ccf0447c74e108211433849f8035e2c89a598b5dd19cbb5fc49fcadae7693c2bcf297b4d12158cbd587a4ca6b1c087c678d7c7167641a7cff432e@195.222.43.21:30303
#Zurich
enode://6173beaabd1a82d41e3615da2a755e99f3bd53e04737e2ae2f02a004c42445d8dfd1d87aadfafabc4c45a1df2a80f359ab628c93522d1dac70690a9689912bbc@129.132.178.74:30303
#Internet Security
enode://bc50cf41d29f346f43f84ee7d03b21cd2d4176cd759cd0d26ce04c16448d4c8611c4eab4c5543e29075c758c0afc2fd6743fa38f48dc0ed1f016efbb5c5a7654@194.94.127.78:30303

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,34 @@
[parity]
chain = "/root/bloxberg.json"
auto_update = "all"
[network]
port = 30303
reserved_peers = "/root/bootnodes.txt"
nat = "any"
discovery = false
[rpc]
port = 8545
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
interface = "all"
[websockets]
disable = false
port = 8546
interface = "all"
origins = ["none"]
[account]
password = ["/root/validator.pwd"]
[mining]
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
engine_signer = "0x0ade5bd2065debbb250e816f614bc342a6ef71c1"
reseal_on_txs = "none"
force_sealing = true
min_gas_price = 1000000
gas_floor_target = "10000000"
[footprint]
tracing = "off"