Resources

Parallel Heiko

Snapshot

https://snapshot-heiko.s3.us-east-2.amazonaws.com/db.7z

Telemetry

Heiko Telemetry

Parallel PARA

Snapshot

https://snapshot-parallel.s3.us-east-2.amazonaws.com/db.7z

Telemetry

Scripts

Note:

  • --ws-external is needed when you need to activate websocket subscription, unlike ethers.js, polkadot.js sdk prefer websocket so we recommand activate it by default.

  • --rpc-external --rpc-cors all is needed when you need to activate HTTP support

full-node.sh

#!/usr/bin/env bash

DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

cd $DIR

set -xe

RELAY_WS_PORT=9945
RELAY_RPC_PORT=9934
RELAY_P2P_PORT=30334

PARA_WS_PORT=9944
PARA_RPC_PORT=9933
PARA_P2P_PORT=30333

NODE_NAME="$1"
DOCKER_VERSION="${2:-v1.8.8}"
PARA_CHAIN="${3:-heiko}"
RELAY_CHAIN="${4:-kusama}"
VOLUME="chains"
BASE_PATH="/data"

if [ $# -lt 1 ]; then
  echo "help: ./fullnode.sh <NODE_NAME>" && exit 1
fi

CHECK_CONTAINER=$(docker container ls | grep $PARA_CHAIN-fullnode |awk '{print $1}')
if [ $CHECK_CONTAINER ]; then
  docker container stop $PARA_CHAIN-fullnode || true
  docker container rm $PARA_CHAIN-fullnode || true
fi

CHECK_VOLUME=$(docker volume ls | grep $VOLUME |awk '{print $2}')
if [ !$CHECK_VOLUME ]; then
  docker volume create $VOLUME || true
fi

docker run --restart=always --name $PARA_CHAIN-fullnode \
  -d \
  -p $PARA_WS_PORT:$PARA_WS_PORT \
  -p $PARA_RPC_PORT:$PARA_RPC_PORT \
  -p $PARA_P2P_PORT:$PARA_P2P_PORT \
  -p $RELAY_WS_PORT:$RELAY_WS_PORT \
  -p $RELAY_RPC_PORT:$RELAY_RPC_PORT \
  -p $RELAY_P2P_PORT:$RELAY_P2P_PORT \
  -v "$VOLUME:$BASE_PATH" \
  parallelfinance/parallel:$DOCKER_VERSION \
    -d $BASE_PATH \
    --chain=$PARA_CHAIN \
    --ws-port=$PARA_WS_PORT \
    --rpc-port=$PARA_RPC_PORT \
    --ws-external \
    --rpc-external \
    --rpc-cors all \
    --ws-max-connections 4096 \
    --pruning archive \
    --wasm-execution=compiled \
    --execution=wasm \
    --state-cache-size 0 \
    --listen-addr=/ip4/0.0.0.0/tcp/$PARA_P2P_PORT \
    --name=$NODE_NAME \
    --prometheus-external \
  -- \
    --chain=$RELAY_CHAIN \
    --ws-port=$RELAY_WS_PORT \
    --rpc-port=$RELAY_RPC_PORT \
    --ws-external \
    --rpc-external \
    --rpc-cors all \
    --ws-max-connections 4096 \
    --wasm-execution=compiled \
    --execution=wasm \
    --database=RocksDb \
    --state-cache-size 0 \
    --unsafe-pruning \
    --pruning=1000 \
    --listen-addr=/ip4/0.0.0.0/tcp/$RELAY_P2P_PORT \
    --name="${NODE_NAME}_Embedded_Relay"

create-volume.sh

#!/usr/bin/env bash

DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

cd $DIR

set -xe

SNAPSHOT_PATH="db/full"
VOLUME="chains"

if [ "$1" == "--polkadot" ]; then
  DB_PATH="polkadot/chains/polkadot"
elif [ "$1" == "--kusama" ]; then
  DB_PATH="polkadot/chains/ksmcc3"
elif [ "$1" == "--heiko" ]; then
  DB_PATH="chains/heiko"
elif [ "$1" == "--parallel" ]; then
  DB_PATH="chains/parallel"
fi

docker volume create $VOLUME || true

mountpoint=$(docker volume inspect $VOLUME | jq '.[].Mountpoint' | tr -d '"')
sudo mkdir -p $mountpoint/$DB_PATH/db || true
sudo rm -fr $mountpoint/$DB_PATH/db/full || true

rm -rf db || true

if [ "$1" == "--kusama" ]; then
  curl -o - -L https://ksm-rocksdb.polkashots.io/snapshot | lz4 -c -d - | tar -x -C ./
elif [ "$1" == "--heiko" ]; then
  wget https://snapshot-heiko.s3.us-east-2.amazonaws.com/db.7z && 7z x db.7z
elif [ "$1" == "--polkadot" ]; then
  curl -o - -L https://dot-rocksdb.polkashots.io/snapshot | lz4 -c -d - | tar -x -C ./
elif [ "$1" == "--parallel" ]; then
  wget https://snapshot-parallel.s3.us-east-2.amazonaws.com/db.7z && 7z x db.7z
fi
sudo mv $SNAPSHOT_PATH $mountpoint/$DB_PATH/db

sudo chown -R $(id -un):$(id -gn) $mountpoint

Last updated