#!/usr/bin/env bash # bdag-node-config.sh - writes the settings for a plain BDAG Community full node (stack-v0.1.2). # From the guide at https://bdagnode.org. Read it before you run it; it is short. # # What it does: copies the verified release into /opt/bdag/stack and writes node.conf and .env there. # What you get: a node that only follows the chain - no pool, no mining, no wallet. # Its RPC ports listen on this machine only (127.0.0.1); only P2P port 8150 is public. # Usage: bash bdag-node-config.sh YOUR.PUBLIC.IP.ADDRESS set -euo pipefail TAG=stack-v0.1.2 SRC=/opt/bdag/payload/pool-stack-docker-$TAG-linux-amd64 STACK=/opt/bdag/stack PUBLIC_IP=${1:-} case "$PUBLIC_IP" in *.*.*.*) ;; *) echo "Usage: bash bdag-node-config.sh YOUR.PUBLIC.IP.ADDRESS"; exit 1 ;; esac [ -d "$SRC" ] || { echo "Release not found in $SRC - do step 2 of the guide first."; exit 1; } mkdir -p "$STACK" cp -a "$SRC/." "$STACK/" mkdir -p "$STACK/ops/runtime" /opt/bdag/node-data cd "$STACK" # Keep an existing RPC password across re-runs; otherwise make a random one. if [ -f node.conf ] && grep -q '^rpcpass=' node.conf; then RPCPASS=$(sed -n 's/^rpcpass=//p' node.conf | head -1) else RPCPASS=$(head -c 24 /dev/urandom | base64 | tr -dc 'A-Za-z0-9' | head -c 32) fi { # A node that accepts newcomers (the one behind rpc.bdagnode.org); your node learns more peers from it. echo 'addpeer=/ip4/5.222.24.127/tcp/8150/p2p/16Uiu2HAmSukD42XnDt8UqErjKNXHQq1PeV6MvxnghYidpGDoNVGW' # Public seed peers shipped with the release (private 10.x addresses left out). grep '^addpeer=' node.conf.example | grep -v '/ip4/10\.' | sort -u } > /tmp/bdag-peers.txt cat > node.conf <> .env; fi } setenv NODE_DATA_DIR /opt/bdag/node-data setenv NODE_RPC_USER bdag_mainnet_rpc setenv NODE_RPC_PASS "$RPCPASS" setenv BDAG_P2P_ADVERTISE_IP "$PUBLIC_IP" setenv BDAG_ENABLE_NODE_MINING 0 setenv BDAG_NODE_ARCHIVAL 0 setenv BDAG_NODE_CACHE_MB 1536 setenv BDAG_NODE_DEBUG_LEVEL info setenv DASHBOARD_BINARY node-dashboard setenv MINING_POOL_ADDRESS "" setenv BDAG_STACK_HOST_ROOT "$STACK" chmod 600 .env rm -f /tmp/bdag-peers.txt echo "Done. Settings are in $STACK (node.conf, .env). Advertised address: $PUBLIC_IP:8150" echo "Seed peers: $(grep -c '^addpeer=' node.conf)"