Skip to content

Commit

Permalink
upstream update (#1)
Browse files Browse the repository at this point in the history
* Add helpful tips to veriables in my-peer-info, params.sh, and README.md

* Update launch_data.json

* Update README.md

* Create verifyABPs.sh

* Create resignAuth.sh

* Create 06_SET_ABPs.sh

* Update launch_data.json

* Update launch_data.json

* Update autolaunch.sh

* Update returning-user.md

* Update generate-config.sh

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update installGhostbusters.sh

* Update lxd-setup.md

* Update README.md

* Update 06_SET_ABPs.sh

Needs testing

* Update 06_SET_ABPs.sh
  • Loading branch information
Ben Sigman committed May 28, 2018
1 parent a389d6f commit 3e3cbef
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 28 deletions.
51 changes: 42 additions & 9 deletions README.md
Expand Up @@ -7,7 +7,8 @@
Start by joining the eos_ghostbusters Keybase group: https://keybase.io/team/eos_ghostbusters.

- Install keybase: https://keybase.io/docs/the_app/install_linux
Ubuntu instructions

Ubuntu instructions - do not install as root user, please use sudo where appropriate
```console
# Install curl if required
sudo apt install curl
Expand All @@ -20,12 +21,12 @@ sudo dpkg -i keybase_amd64.deb
sudo apt-get install -f
run_keybase
```

- Mandatory step: modify keybase default storage path for kbfs
```console
curl -sL https://raw.githubusercontent.com/HKEOS/Ghostbusters-Testnet/master/keybase_relocate.sh | bash -
```

- Login or signup:
```console
# Login
Expand All @@ -51,6 +52,11 @@ sudo apt-get install wireguard resolvconf
mkdir Ghostbusters && cd Ghostbusters
curl -sL https://raw.githubusercontent.com/HKEOS/Ghostbusters-Testnet/master/setup.sh | bash -
```
- Note
For the Ghostbusters testnet, you will need to choose 3 ports that can be whatever you want (greater than 1024):
1. wireguard VPN port - default is 5555
2. EOS API / HTTP port - some are using 8888
3. EOS P2P port - some are using 9876

- Create Wireguard keys and config
```console
Expand All @@ -62,10 +68,22 @@ echo -e "Address = 192.168.100.X/22" >> ghostbusters.conf
sudo cp ghostbusters.conf /etc/wireguard/.
```


- Selecting your Wireguard IP

Your Wireguard IP address should be within the range of 192.168.100.X to 192.168.103.X, where X is between 0 and 255, inclusive.
You can input any number for "X" in `ghostbusters.conf` that hasn't been taken by another node.
To check which IPs have been claimed:
```console
cd ~/kbfs/team/eos_ghostbusters/ip_list
ls
# You will see the list of IP addresses that have already been claimed
# Choose an address that is open
touch <your-node-name>@<chosen-ip-address>
```

This adds your a file with your IP address to the ip_list folder.

```console
sudo nano /etc/wireguard/ghostbusters.conf
# Add in the value of X that you have chosen
Expand All @@ -77,8 +95,9 @@ It is recommended that you use Keybase when communicating information related to
- Publish peer information
```console
nano my-peer-info
## Fill in your information
## Fill in your information for PublicKey, AllowedIPs, Endpoint, p2p-peer-address, and peer-key

## then run this script
./publishPeerInfo.sh my-peer-info
```

Expand Down Expand Up @@ -139,13 +158,13 @@ Input your information for the highlighted fields shown below:
cp bp_info.json ~/kbfs/public/<username>
```
**Note:** You do not have to fill out your BP node's api_endpoint and p2p_endpoint-- this way, they can remain hidden from public.

- Check that file is up on `https://<username>.keybase.pub/bp_info.json`

#### 5.1 BP Info verification (optional)

You can verify that bp_info.json correctly follows the schema using command line. We recommend ajv-cli for the job.

If npm is not installed:
```console
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
Expand All @@ -166,14 +185,24 @@ Try `cat config.ini`, and `cat cleos.sh` to check that all the information is co

```console
sudo apt install jq
crontab -e
# Select nano (if you are initializing cron for the first time)
# Exit
```

Run `autolaunch.sh` when the team (on Keybase) is ready to queue up and launch. Run `autolaunch.sh` on only one of your nodes, and manually launch the rest of them when the genesis.json file is published.

```console
# Run autolaunch, answer questions prompted by script
./autolaunch.sh

# If the target BTC block was not reached at runtime,
# it will schedule itself on CRON, please verify with
crontab -e

```
If `autolaunch.sh` doesn't start your node correctly, run the following command:
```console
./start.sh --delete-all-blocks --genesis-json ./genesis.json
```

### 8. Bios Node
Expand All @@ -186,8 +215,12 @@ If at any point you need to restart your node:
```console
./start.sh
tail -F stderr.txt

# Hard resync
./start.sh --delete-all-blocks --hard-replay-blockchain
tail -F stderr.txt
```
Or you can update your peers and restart at the same time:
You can also update your peers and restart at the same time:
```console
./updatePeers - restart
```
2 changes: 1 addition & 1 deletion autolaunch.sh
Expand Up @@ -267,7 +267,7 @@ if (( $matched > 0 )); then
add_cronjob;
exit 1;
fi
if ((($latestblock - $TARGET_BLOCK) > 1)); then
if ((($latestblock - $TARGET_BLOCK) > 0)); then
echo "You have passed the time limit to launch automatically. Please receive the genesis file through the team and start your node.";
exit 1;
fi
Expand Down
40 changes: 40 additions & 0 deletions bios-node/06_SET_ABPs.sh
@@ -0,0 +1,40 @@
#!/bin/bash
################################################################################
#
# Script created by Eric Björk, EOS Sw/eden
# Script edited by Jae Chung, HKEOS and Igor Lins e Silva, EOS Rio
# For Ghostbusters testnet
#
################################################################################

#!/bin/bash

SORUCES_FOLDER="$( jq -r '.SOURCES_FOLDER' "00_CONFIG.conf" )"

EOS_BUILD_DIR=$SOURCES_FOLDER/build

EOSIO_KEY=EOSIO_PRODUCER_KEY="$( jq -r '.EOSIO_PRODUCER_PUB_KEY' "00_CONFIG.conf" )"

PRODUCERS_JSON='{"schedule":['
while read -r line
do
a=(${line//,/ })
name="${a[0]}"
key="${a[1]}"

./cleos.sh create account eosio $name $key $key
sleep 1
if [ "$PRODUCERS_JSON" = '{"schedule":[' ]; then
PRODUCERS_JSON="$PRODUCERS_JSON{\"producer_name\":\"$name\",\"block_signing_key\":\"$key\"}"
else
PRODUCERS_JSON="$PRODUCERS_JSON,{\"producer_name\":\"$name\",\"block_signing_key\":\"$key\"}"
fi

done < "producers.csv"

PRODUCERS_JSON="'$PRODUCERS_JSON]}'" #,{\"producer_name\":\"eosio\",\"block_signing_key\":\"$EOSIO_KEY\"}]}'"

echo $PRODUCERS_JSON

#echo "./cleos.sh push action eosio setprods \"$PRODUCERS_JSON\" -p eosio"
./cleos.sh push action eosio setprods $PRODUCERS_JSON -p eosio
2 changes: 1 addition & 1 deletion bios-node/generate-config.sh
Expand Up @@ -9,7 +9,7 @@
##########################################
cd "$(dirname "$0")"
GLOBAL_PATH=$(pwd)
CONFIG='$GLOBAL_PATH'/config.ini
CONFIG=$GLOBAL_PATH/config.ini

SOURCES_FOLDER="$( jq -r '.SOURCES_FOLDER' "00_CONFIG.conf" )"
PUB_KEY="$( jq -r '.EOSIO_PRODUCER_PUB_KEY' "00_CONFIG.conf" )"
Expand Down
29 changes: 29 additions & 0 deletions bios-node/resignAuth.sh
@@ -0,0 +1,29 @@
#!/bin/bash
################################################################################
#
# Script Created by Jae Chung, HKEOS and Igor Lins e Silva, EOS Rio
# For Ghostbusters testnet
#
################################################################################

echo -e "\n changing permissions for bios account \n";

abps=();
for abp in "${abps[@]}"
do
echo -e "\n changing permissions for $abp \n";
./cleos.sh push action eosio updateauth '{"account": "eosio", "permission": "owner", "parent": "", "auth":{"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "abp", "permission": active}}]}} -p eosio@active
./cleos.sh push action eosio updateauth '{"account": "eosio", "permission": "active", "parent": "owner", "auth":{"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "abp", "permission": active}}]}} -p eosio@active
sleep 1;
done


accounts=( eosio.bpay eosio.msig eosio.names eosio.ram eosio.ramfee eosio.saving eosio.stake eosio.token eosio.vpay );

for account in "${accounts[@]}"
do
echo -e "\n changing permissions for $account \n";
./cleos.sh push action eosio updateauth '{"account": "account", "permission": "owner", "parent": "", "auth":{"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "eosio", "permission": active}}]}} -p eosio@owner
./cleos.sh push action eosio updateauth '{"account": "account", "permission": "active", "parent": "owner", "auth":{"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "eosio", "permission": active}}]}} -p eosio@active
sleep 1;
done
19 changes: 10 additions & 9 deletions installGhostbusters.sh
Expand Up @@ -61,15 +61,6 @@ TESTNET_DIR="$GLOBAL_PATH/$TESTNET";

if [[ $EOS_SOURCE_DIR == "" ]]; then
EOS_SOURCE_DIR="$GLOBAL_PATH/eos-source"
else
EOS_GIT_BRANCH=$(git -C $EOS_SOURCE_DIR branch | grep '*' | cut -f 5 -d' ' | cut -f1 -d')');
echo "Source code at branch $EOS_GIT_BRANCH";
EOS_VERSION=$("$EOS_SOURCE_DIR/build/programs/nodeos/nodeos" --version)
echo "Current nodeos version: $EOS_VERSION";
if [[ "$EOS_VERSION" != "$EOS_TARGET_VERSION" ]]; then
echo "Wrong version, $EOS_TARGET_VERSION required!";
exit 1
fi
fi

WALLET_DIR="$GLOBAL_PATH/wallet"
Expand Down Expand Up @@ -98,6 +89,16 @@ if [[ ! -d $EOS_SOURCE_DIR/build ]]; then
cd $GLOBAL_PATH
fi

# Check version
EOS_GIT_BRANCH=$(git -C $EOS_SOURCE_DIR branch | grep '*' | cut -f 5 -d' ' | cut -f1 -d')');
echo "Source code at branch $EOS_GIT_BRANCH";
EOS_VERSION=$("$EOS_SOURCE_DIR/build/programs/nodeos/nodeos" --version)
echo "Current nodeos version: $EOS_VERSION";
if [[ "$EOS_VERSION" != "$EOS_TARGET_VERSION" ]]; then
echo "Wrong version, $EOS_TARGET_VERSION required!";
exit 1
fi

# Creating Wallet Folder and files

signature='#!/bin/bash
Expand Down
2 changes: 1 addition & 1 deletion launch_data.json
@@ -1,4 +1,4 @@
{
"btc_block":524642,
"btc_block":524661,
"initial_chain_id":"0000000000000000000000000000000000000000000000007472696e6974790d"
}
2 changes: 1 addition & 1 deletion lxd/lxd-setup.md
Expand Up @@ -5,7 +5,7 @@
```console
cd /opt/eos
git pull
git checkout dawn-v4.1.0
git checkout dawn-v4.2.0
git submodule update --recursive
```

Expand Down
8 changes: 4 additions & 4 deletions my-peer-info
@@ -1,11 +1,11 @@
#Wireguard
[Peer]
PublicKey = <peer-public-key>
AllowedIPs = 192.168.100.Y/32
Endpoint = <peer-public-endpoint>:<peer-vpn-port>
PublicKey = <from-publickey-file>
AllowedIPs = <wireguard-private-ip>/32
Endpoint = <node-public-ip>:<ListenPort-from-ghostbusters.conf>
PersistentKeepAlive = 20

#EOS
[EOS]
p2p-peer-address = <vpn-ip-address>:<p2p-port>
p2p-peer-address = <wireguard-private-ip>:<p2p-port>
peer-key = "<eos-public-key>"
12 changes: 11 additions & 1 deletion params.sh
Expand Up @@ -16,14 +16,19 @@ TESTNET="ghostbusters";
##### PARAMETERS TO BE MODIFIED ######

# EOS Source code folder, if left completely blank - it will create the folder, download sources and compile on the specified tag
# UPDATE THIS
EOS_SOURCE_DIR="/path/to/eos"

# Node port definitions (avoid ports below 1024 - you shouldn't run as root)
# UPDATE THIS
NODE_API_PORT="<api-port>"
# UPDATE THIS
NODE_P2P_PORT="<p2p-port>"
# Network address (Wireguard private IP)
# UPDATE THIS
NODE_NET_ADDR="<net-addr>"
# Externally accessible node address (Wireguard private IP)
# UPDATE THIS
NODE_HOST="<server-address>"

# HTTPS Settings - Leave port blank to disable
Expand All @@ -32,6 +37,7 @@ SSL_PRIV_KEY="/path/to/certificate-key"
SSL_CERT_FILE="/path/to/certificate-chain"

### Node Agent Name
# UPDATE THIS
AGENT_NAME="<agent-name>"

### Peer Credentials (if blank will be equal to the producer keys)
Expand All @@ -42,23 +48,27 @@ PEER_PRIV_KEY=""
ISBP=true

### PRODUCER INFO ###
# UPDATE THIS
PRODUCER_PUB_KEY="<EOS-public-key>"
PRODUCER_PRIV_KEY="";
## PRODUCER NAME MUST HAVE 12 CHARS!
# UPDATE THIS
PRODUCER_NAME="<producer-name>"

### STANDARD BLOCK PRODUCER INFO - according to https://github.com/eosrio/bp-info-standard
### Replace username with your keybase username
# UPDATE THIS
PRODUCER_URL="https://<username>.keybase.pub/bp_info.json"

### WALLET INFO ###
WALLET_HOST="127.0.0.1"
# UPDATE THIS
WALLET_PORT="7777"

### PRE-DEFINED PEER LIST ###
PEER_LIST='
# p2p-peer-address = 192.168.10.Y:9876
# p2p-peer-address = <vpn-ip-address>:<p2p-port>
# p2p-peer-address = <vpn-ip-address>:<p2p-port>
'

### PRE-DEFINED PEER KEYS ###
Expand Down
2 changes: 1 addition & 1 deletion returning-user.md
Expand Up @@ -9,7 +9,7 @@ This is a quick guide on how to get ready for the next launch as soon as possibl
### Update EOS
```console
cd /path/to/eos
git checkout DAWN-2018-05-22
git checkout dawn-v4.2.0
git submodule update --init --recursive
ex -sc '16i|set( CORE_SYMBOL_NAME "EOS" )' -cx CMakeLists.txt
git pull
Expand Down
26 changes: 26 additions & 0 deletions verifyABPs.sh
@@ -0,0 +1,26 @@
#!/bin/bash

if [[ -f abp_list ]]; then
rm abp_list;
fi

for file in ~/kbfs/team/eos_ghostbusters/mesh/*.peer_info.signed; do
[ -e "$file" ] || continue;
kbuser=$(echo "$file" | sed -e 's/.*mesh\/\(.*\).peer_info.signed*/\1/');
cat "$file" | keybase verify -S "$kbuser" &>output;
out=$(<output);
err=$(echo "$out" | grep "ERR");

if [[ "$err" == "" ]]; then
echo "$kbuser";
peerdata=$(cat ~/kbfs/public/$kbuser/bp_info.json);
acc=$(echo "$peerdata" | jq -r ".producer_account_name");
pubkey=$(echo "$peerdata" | jq -r ".producer_public_key");
if [[ $acc != "" ]] && [[ $pubkey != "" ]]; then
echo "$acc,$pubkey" >> abp_list
fi
fi
done

echo -e "\n >> ABP List is ready!";
cat abp_list;

0 comments on commit 3e3cbef

Please sign in to comment.