Skip to content

r-publishing/rdrive-testnet-launch

Repository files navigation

rdrive-testnet-launch

setup the machine

https://docs.docker.com/engine/install/ubuntu/

Key generation

Two keys are required for genesis

  1. genesis node private key
  2. automated propose private key

The keys used to genesis testnet-launch have been generated by using https://github.com/r-publishing/mainnet-launch-best-practices and are available from the relevant key holders

Create genesis files

The shell variable $GENESIS_NODE should be set to the rnode directory for whatever rnode you're doing genesis on

mkdir -p $GENESIS_NODE/genesis
cd $GENESIS_NODE/genesis
wget https://raw.githubusercontent.com/r-publishing/rdrive-testnet-launch/master/gen-wallets.bash
bash gen-wallets.bash

Check wallets.txt

The following two commands should output the same number. If they do not, then there are duplicate REV addresses in the wallet config files which need to be resolved

cat wallets.txt|wc -l
13942
sort -u wallets.txt|wc -l
13942

Get bonds.txt

wget https://raw.githubusercontent.com/r-publishing/rdrive-testnet-launch/master/testnet-launch.validator.bonds.txt
mv testnet-launch.validator.bonds.txt bonds.txt

Get escrow public keys

cd ..
wget https://raw.githubusercontent.com/r-publishing/rdrive-testnet-launch/master/testnet-launch.escrow.conf
mv testnet-launch.escrow.conf rnode.conf

Update rnode.conf for genesis

echo "casper.genesis-ceremony.ceremony-master-mode = true" >> rnode.conf
echo "standalone = true" >> rnode.conf
echo "casper.validator-private-key = <Your private key for node0 here>" >>rnode.conf

Run rnode with appropriate genesis arguments

These are the settings in docker .env

TNL_DOMAIN=testnet-launch.r-publishing.com

RNODE_JAVA_CONFIG=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/rnode/heapdump_OOM.hprof -XX:+ExitOnOutOfMemoryError -XX:ErrorFile=/var/lib/rnode/hs_err.log -Dlogback.configurationFile=/var/lib/rnode/logback.xml -XX:MaxRAMPercentage=80 -XX:MaxDirectMemorySize=4g -J-Xms8g -J-Xmx24g
TNL_RNODE_RUN_CONFIG=run -c /var/lib/rnode/rnode.conf --network-id rdrive-testnet --shard-name rdrive-testnet-launch --fault-tolerance-threshold -1 --synchrony-constraint-threshold 0.99 --no-upnp --finalization-rate 1  --max-number-of-parents 1

These are the settings in docker-compose.yml

version: '2.3'

x-rnode:
  &default-rnode
  image: rchain/rnode:v0.13.0-alpha3
  user: root

services:
########################################################################
#
  node0:
    << : *default-rnode
    container_name: node0
    ports:
      - 40440:40440
      - 40442:40402
      - 40444:40444
    volumes:
      - $RNODE_DIR/node0/rnode/:/var/lib/rnode/
    command:
      $RNODE_JAVA_CONFIG
      $TNL_RNODE_RUN_CONFIG      --api-max-blocks-limit=3
      --host node0.$TNL_DOMAIN   --protocol-port 40440 --discovery-port 40444

When am I done?

Genesis time is dependant on the size of your wallets.txt. The current testnet-launch uses a wallets.txt that is ~14,000 entries and takes ~11 minutes to complete

Use docker logs node0 -f, to view the rnode log When genesis is finished you should see this message in the log

Making a transition to Running state. Approved Block #0 (4bc51d1fad...) with empty parents (supposedly genesis)

cleanup

Bring down genesis node

docker stop node0

Remove your rnode.conf file for security

rm $GENESIS_NODE/rnode.conf

update docker .env config

There should be a log message that looks like rnode://d2afe404c2a6ea99027b5b51011e449b6bd6efc6@node0.testnet-launch.r-publishing.com?protocol=40440&discovery=40444 Update .env entry for TNL_RNODE_RUN_CONFIG to include

--bootstrap rnode://d2afe404c2a6ea99027b5b51011e449b6bd6efc6@node0.testnet-launch.r-publishing.com?protocol=40440&discovery=40444

certificate setup

node0.testnet-launch.r-publishing.com must resolve using dig node0.testnet-launch.r-publishing.com Create a certificate for the genesis node

certbot certonly --standalone --agree-tos --preferred-challenges http --register-unsafely-without-email  --config-dir /rchain/files/letsencrypt -d node0.testnet-launch.r-publishing.com

Reverse proxy

Update docker-compose.yml to include

########################################################################
  revproxy:
    image: nginx
    container_name: revproxy
    ports:
      - 443:443
      - 40401:40401
      - 40403:40403
    volumes:
      - $RNODE_DIR/revproxy/conf:/etc/nginx/conf.d:ro
      - $RNODE_DIR/files/letsencrypt:/etc/letsencrypt:ro
      - $RNODE_DIR/revproxy/log:/var/log/nginx
      - /var/run/docker.sock:/var/run/docker.sock
    restart: always

Observer node

Create a certificate for observer using https://github.com/r-publishing/rdrive-testnet-launch#certificate-setup

Update docker-compose.yml to include observer node

########################################################################
  observer:
    << : *default-rnode
    container_name: observer
    ports:
      - 40460:40460
      - 40464:40464
    volumes:
      - $RNODE_DIR/observer/rnode/:/var/lib/rnode/
    command:
      $RNODE_JAVA_CONFIG
      $TNL_RNODE_RUN_CONFIG         --api-max-blocks-limit=100 --api-enable-reporting
      --host observer.$TNL_DOMAIN   --protocol-port 40460 --discovery-port 40464

revproxy must be updated https://github.com/r-publishing/rdrive-testnet-launch#run-revproxy to include

The observer node will take time to update with the current blockchain state

Running automated propose

install packages and python dependencies

cd /rchain/scripts/propose
apt install python-pip autoconf automake libtool
wget https://raw.githubusercontent.com/rchain/rchain-testnet-node/dev/scripts/requirements.txt

remove pyjq from requirements.txt -- it should be the last line

pip3 install -r requirements.txt

Configure propose script

Get propose script

wget https://raw.githubusercontent.com/rchain/rchain-testnet-node/dev/scripts/propose_in_turnv1.py

Use the config from the top of propose_in_turnv1.py to create propose.yml

servers:
  - node0:
      host: node0.testnet-launch.r-publishing.com
      grpc_port: 40441
      http_port: 40443
valid_offset: -1
waitTimeout: 300000
waitInterval: 2
proposeInterval: 10
error_node_records: /var/log/propose-script-error.txt
error_logs: /var/log/propose-script-error.log
pause_path: /rchain/scripts/propose/PAUSE-PROPOSE-SCRIPT
keepalive: 10
keepalive_timeout: 10
max_propose_retry: 3
deploy:
    contract: /rchain/scripts/propose/coop.rho
    phlo_limit: 100000
    phlo_price: 1
    deploy_key: <Your propose private key here>
    shardID: rdrive-testnet-launch
mv propose_in_turnv1.py propose_in_turn.py
cp propose-orchestrator.service /etc/systemd/system
systemctl enable propose-orchestrator.service
systemctl start propose-orchestrator.service

Additional validators

Running additional validators is not necessary. To run more than one validator, do the following for each Note that each addition validator must have an entry in the original bonds.txt that was used during genesis https://github.com/r-publishing/rdrive-testnet-launch#get-bondstxt

  1. update docker-compose.yml
  2. update propose.yml
  3. update revproxy config
  4. start docker container

Testing

You can check the token balance of the automated propose key with the following The token address for the automated propose private key can be obtained at https://r-publishing.github.io/rnode-client-js/

wget https://github.com/r-publishing/rpub-cli/releases/download/v1.0.1/rpub-cli-linux
./rpub-cli-linux --balance --revAddress <REV address for propose private key> --readOnlyHost https://observer.testnet-launch.r-publishing.com --decimals 6 --ticker RPC

Output should be a number followed by RPC

123456 RPC

Troubleshooting

What if something goes wrong and I need to start over?

To start over, make sure all running rnode instances are stopped.

docker command here

Remove all blockchain data

rm -rf /rchain/{node?,observer}/rnode/{blockstorage/,casperbuffer/,dagstorage/,deploystorage/,eval/,rnode.log,rspace/}

You can now make any changes necessary and begin again.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published