Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.env
bin/bdag/*
wallet.txt
.DS_Store
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ Optional for Linux users:
```bash
./blockdag.sh # default miner node
./blockdag.sh full # validation without mining
./blockdag.sh relay # gateway relay mode
```
The script resolves your address, exports it as `PUB_ETH_ADDR`, selects the matching compose file, and calls node.sh`. Set `NODE_ROLE=<role>` in your
environment if you prefer not to pass a CLI argument.
Expand Down Expand Up @@ -143,15 +142,13 @@ This repository now ships dedicated Docker Compose files for each supported node
|-----------|--------------|------------|
| Miner | `docker-compose.yml` | Enables mining via `--miner`/`--generate` and exposes JSON-RPC/WebSocket endpoints for local tooling. |
| Full | `docker-compose.full.yml` | Syncs and validates the network without mining. |
| Relay | `docker-compose.relay.yml` | Runs the gateway stack (`--gateway`) to proxy DAG/EVM traffic for external clients. |

> **Tip:** Any of the non-archive templates can double as an archive node just
> by keeping the default `--gcmode=archive`. Removing that flag reverts to the
> previous pruned behaviour.

To start a specific role with the helper script, run `./blockdag.sh <role>`. For
example, `./blockdag.sh relay` loads `docker-compose.relay.yml` while
`./blockdag.sh full` launches the `docker-compose.full.yml`. Use
example, `./blockdag.sh full` launches the `docker-compose.full.yml`. Use
`./blockdag.sh` to fall back to the default `docker-compose.yml` miner node.

### Launching a specific node type
Expand Down Expand Up @@ -181,7 +178,7 @@ archive deployments.

Use the helper scripts at the repository root:

- `stop.sh [role|all]` – stops containers for the selected role (defaults to `miner`). Pass `all` to shut down miner, full, and relay stacks in one go.
- `stop.sh [role|all]` – stops containers for the selected role (defaults to `miner`). Pass `all` to shut down miner and full stacks in one go.
- `restart.sh [role]` – shuts down Docker Compose for the selected role (defaults to `miner`), removes the image referenced by the compose file, and relaunches using your configured wallet.
- `restartWithCleanup.sh [role]` – same as above but also clears `./bin/bdag/*` (data, logs, any cached binaries). **Back up your wallet before running this.**
- `install_docker.sh` – Ubuntu/WSL convenience installer. Review the script before executing (`sudo ./install_docker.sh`).
Expand Down
23 changes: 12 additions & 11 deletions blockdag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Usage: ./blockdag.sh [ROLE]
ROLE may be one of:
miner - use docker-compose.yml (default)
full - use docker-compose.full.yml
relay - use docker-compose.relay.yml

You can also set NODE_ROLE environment variable instead of passing ROLE.
USAGE
Expand All @@ -27,9 +26,6 @@ case "$ROLE_INPUT" in
full)
COMPOSE_FILE="docker-compose.full.yml"
;;
relay)
COMPOSE_FILE="docker-compose.relay.yml"
;;
default|miner)
COMPOSE_FILE="docker-compose.yml"
;;
Expand All @@ -41,20 +37,25 @@ case "$ROLE_INPUT" in
esac

ENV_FILE="$SCRIPT_DIR/.env"
NEEDS_MINING_ADDR=false
if [ "$COMPOSE_FILE" = "docker-compose.yml" ]; then
NEEDS_MINING_ADDR=true
fi

# load PUB_ETH_ADDR from .env if present
if [ -f "$ENV_FILE" ]; then
# shellcheck disable=SC1090
source "$ENV_FILE"
fi

if [ -z "${PUB_ETH_ADDR:-}" ]; then
if [ -f "$SCRIPT_DIR/wallet.txt" ]; then
PUB_ETH_ADDR=$(tail -n 1 "$SCRIPT_DIR/wallet.txt")
else
echo "PUB_ETH_ADDR not set. Please create $ENV_FILE or wallet.txt" >&2
exit 1
fi
PUB_ETH_ADDR="${PUB_ETH_ADDR:-}"
if [ -z "$PUB_ETH_ADDR" ] && [ -f "$SCRIPT_DIR/wallet.txt" ]; then
PUB_ETH_ADDR=$(tail -n 1 "$SCRIPT_DIR/wallet.txt")
fi

if $NEEDS_MINING_ADDR && [ -z "$PUB_ETH_ADDR" ]; then
echo "PUB_ETH_ADDR not set. Please create $ENV_FILE or wallet.txt" >&2
exit 1
fi

export PUB_ETH_ADDR
Expand Down
14 changes: 6 additions & 8 deletions docker-compose.full.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

services:
full_node:
image: blockdagnetwork/awakening:v0.0.3
image: blockdagnetwork/awakening:v0.1.0
container_name: blockdag-full-testnet
restart: unless-stopped
ports:
Expand All @@ -15,12 +15,10 @@ services:
- ./bin/bdag/logs:/bdag/logs
environment:
NODE_ARGS: >-
--testnet --rpclisten=0.0.0.0:38131 --notls --rpcuser=test --rpcpass=test
--walletpass=test
--evmenv="--http --http.port=18545 --http.addr=0.0.0.0
--http.api=net,web3,eth,bdag,txpool,debug --allow-insecure-unlock --ws
--ws.addr=0.0.0.0 --ws.port=18546 --rpc.allow-unprotected-txs --gcmode=archive"
--datadir=/bdag/data
--testnet --rpclisten=0.0.0.0:38131 --notls --rpcuser=test --rpcpass=test ${MINING_ADDR_FLAG:-}
--evmenv="--http.api=net,web3,eth,bdag,txpool,debug --rpc.allow-unprotected-txs --gcmode=archive"
--miningstatesync --datadir=/bdag/data --logdir=/bdag/logs --maxpeers=250
--evm.http.port=18545 --evm.http.addr=0.0.0.0 --evm.ws.port=18546
--addpeer=/ip4/13.245.135.249/tcp/18150/p2p/16Uiu2HAm3hjo65MZvBEJuVASMoSDsXfMzC8m2ZEAeK8CjjJkRvf9
RPC_URL: ws://127.0.0.1:18546
CONTRACT_ADDRESS: 0x96C22c86B91235165eBF1F0f41FbeadA9C323A7A
Expand All @@ -29,4 +27,4 @@ services:
HEALTH_MIN_PEERS: 1

volumes:
bdag_bin: {}
bdag_bin: {}
33 changes: 0 additions & 33 deletions docker-compose.relay.yml

This file was deleted.

13 changes: 6 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

services:
miner_node:
image: blockdagnetwork/awakening:v0.0.3
image: blockdagnetwork/awakening:v0.1.0
container_name: blockdag-miner-testnet
restart: unless-stopped
ports:
Expand All @@ -15,12 +15,11 @@ services:
- ./bin/bdag/logs:/bdag/logs
environment:
NODE_ARGS: >-
--testnet --rpclisten=0.0.0.0:38131 --notls --rpcuser=test --rpcpass=test
--miner
--evmenv="--http --http.port=18545 --http.addr=0.0.0.0
--http.api=net,web3,eth,bdag,txpool,debug --allow-insecure-unlock --ws
--ws.addr=0.0.0.0 --ws.port=18546 --rpc.allow-unprotected-txs --gcmode=archive"
--miningaddr=${MINING_ADDRESS} --generate --datadir=/bdag/data
--testnet --rpclisten=0.0.0.0:38131 --notls --rpcuser=test --rpcpass=test --miner
--miningaddr=${MINING_ADDRESS} --generate
--evmenv="--http.api=net,web3,eth,bdag,txpool,debug --allow-insecure-unlock --rpc.allow-unprotected-txs --gcmode=archive"
--miningstatesync --datadir=/bdag/data --logdir=/bdag/logs --maxpeers=250
--evm.http.port=18545 --evm.http.addr=0.0.0.0 --evm.ws.port=18546
--addpeer=/ip4/13.245.135.249/tcp/18150/p2p/16Uiu2HAm3hjo65MZvBEJuVASMoSDsXfMzC8m2ZEAeK8CjjJkRvf9
RPC_URL: ws://127.0.0.1:18546
CONTRACT_ADDRESS: 0x96C22c86B91235165eBF1F0f41FbeadA9C323A7A
Expand Down
12 changes: 12 additions & 0 deletions node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ if [ ! -f "$compose_path" ]; then
fi

export MINING_ADDRESS="$mining_address"
if [ -n "${MINING_ADDRESS:-}" ]; then
export MINING_ADDR_FLAG="--miner --miningaddr=$MINING_ADDRESS"
else
export MINING_ADDR_FLAG=""
fi

# Force amd64 image on ARM hosts since the blockdag image is not multi-arch.
arch=$(uname -m)
if [ -z "${DOCKER_DEFAULT_PLATFORM:-}" ] && [[ "$arch" =~ ^(arm64|aarch64)$ ]]; then
export DOCKER_DEFAULT_PLATFORM=linux/amd64
echo "Detected $arch host; using DOCKER_DEFAULT_PLATFORM=$DOCKER_DEFAULT_PLATFORM"
fi

# Force amd64 image on ARM hosts since the blockdag image is not multi-arch.
arch=$(uname -m)
Expand Down
26 changes: 14 additions & 12 deletions restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usage() {
cat <<'USAGE'
Usage: ./restart.sh [ROLE]

ROLE matches the options from blockdag.sh (miner, full, relay).
ROLE matches the options from blockdag.sh (miner, full).
If omitted, the miner template is used. NODE_ROLE environment variable can also
set the default role.
USAGE
Expand All @@ -23,9 +23,6 @@ resolve_compose_file() {
full)
echo "docker-compose.full.yml"
;;
relay)
echo "docker-compose.relay.yml"
;;
miner|default)
echo "docker-compose.yml"
;;
Expand All @@ -49,6 +46,10 @@ if ! COMPOSE_FILE=$(resolve_compose_file "$ROLE_INPUT"); then
usage >&2
exit 1
fi
NEEDS_MINING_ADDR=false
if [ "$COMPOSE_FILE" = "docker-compose.yml" ]; then
NEEDS_MINING_ADDR=true
fi

if [[ "$COMPOSE_FILE" = /* ]]; then
compose_path="$COMPOSE_FILE"
Expand All @@ -62,14 +63,15 @@ fi
# shellcheck disable=SC1090
source "$ENV_FILE"
fi

if [ -z "${PUB_ETH_ADDR:-}" ]; then
if [ -f "$SCRIPT_DIR/wallet.txt" ]; then
PUB_ETH_ADDR=$(tail -n 1 "$SCRIPT_DIR/wallet.txt")
else
echo "PUB_ETH_ADDR not set. Please populate $ENV_FILE or wallet.txt" >&2
exit 1
fi

PUB_ETH_ADDR="${PUB_ETH_ADDR:-}"
if [ -z "$PUB_ETH_ADDR" ] && [ -f "$SCRIPT_DIR/wallet.txt" ]; then
PUB_ETH_ADDR=$(tail -n 1 "$SCRIPT_DIR/wallet.txt")
fi

if $NEEDS_MINING_ADDR && [ -z "$PUB_ETH_ADDR" ]; then
echo "PUB_ETH_ADDR not set. Please populate $ENV_FILE or wallet.txt" >&2
exit 1
fi

if docker compose version >/dev/null 2>&1; then
Expand Down
26 changes: 14 additions & 12 deletions restartWithCleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usage() {
cat <<'USAGE'
Usage: ./restartWithCleanup.sh [ROLE]

ROLE matches the options from blockdag.sh (miner, full, relay).
ROLE matches the options from blockdag.sh (miner, full).
If omitted, the miner template is used. NODE_ROLE environment variable can also
set the default role.
USAGE
Expand All @@ -23,9 +23,6 @@ resolve_compose_file() {
full)
echo "docker-compose.full.yml"
;;
relay)
echo "docker-compose.relay.yml"
;;
miner|default)
echo "docker-compose.yml"
;;
Expand All @@ -49,6 +46,10 @@ if ! COMPOSE_FILE=$(resolve_compose_file "$ROLE_INPUT"); then
usage >&2
exit 1
fi
NEEDS_MINING_ADDR=false
if [ "$COMPOSE_FILE" = "docker-compose.yml" ]; then
NEEDS_MINING_ADDR=true
fi

if [[ "$COMPOSE_FILE" = /* ]]; then
compose_path="$COMPOSE_FILE"
Expand All @@ -62,14 +63,15 @@ fi
# shellcheck disable=SC1090
source "$ENV_FILE"
fi

if [ -z "${PUB_ETH_ADDR:-}" ]; then
if [ -f "$SCRIPT_DIR/wallet.txt" ]; then
PUB_ETH_ADDR=$(tail -n 1 "$SCRIPT_DIR/wallet.txt")
else
echo "PUB_ETH_ADDR not set. Please populate $ENV_FILE or wallet.txt" >&2
exit 1
fi

PUB_ETH_ADDR="${PUB_ETH_ADDR:-}"
if [ -z "$PUB_ETH_ADDR" ] && [ -f "$SCRIPT_DIR/wallet.txt" ]; then
PUB_ETH_ADDR=$(tail -n 1 "$SCRIPT_DIR/wallet.txt")
fi

if $NEEDS_MINING_ADDR && [ -z "$PUB_ETH_ADDR" ]; then
echo "PUB_ETH_ADDR not set. Please populate $ENV_FILE or wallet.txt" >&2
exit 1
fi

if docker compose version >/dev/null 2>&1; then
Expand Down
6 changes: 1 addition & 5 deletions stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Usage: ./stop.sh [ROLE]
ROLE may be one of:
miner - stop stack defined in docker-compose.yml (default)
full - stop stack defined in docker-compose.full.yml
relay - stop stack defined in docker-compose.relay.yml
all - stop all of the above stacks

You can also set NODE_ROLE to pick the default role instead of passing ROLE.
Expand All @@ -23,14 +22,11 @@ resolve_compose_files() {

case "$role_input" in
all)
echo "docker-compose.yml docker-compose.full.yml docker-compose.relay.yml"
echo "docker-compose.yml docker-compose.full.yml"
;;
full)
echo "docker-compose.full.yml"
;;
relay)
echo "docker-compose.relay.yml"
;;
miner|default)
echo "docker-compose.yml"
;;
Expand Down