#!/bin/sh # SourceLess Chain — Intellectual property of Alexandru Marius Stratulat and the SourceLess team. # GitHub: alexccoin · Email: alex@strlabs.io · All rights reserved. No use without written # consent. See LICENSE. # # Join SourceLess Asgard mainnet as a light node — keeps no chain at all (STARW class: pulsar). # macOS. Generated by scripts/himinbjorg.mjs — do not edit this file, edit the generator. # # sh asgard-pulsar-macos.sh # # WHAT THIS DOES, IN ORDER, AND NOTHING ELSE # 1. refuses to run if this machine cannot hold a pulsar (192 MiB RAM, 64 MiB disk) # 2. fetches brokkr.sh and the Asgard genesis from https://asgard.xplstr.org/get # 3. checks both against the SHA-256 digests written into this file, and STOPS on a mismatch # 4. runs the installer with this realm, this class, a fixed p2p port and the published seeds # # WHAT IT CANNOT DO, STATED HERE SO IT IS NOT DISCOVERED LATER # It cannot make this node SEAL BLOCKS. Asgard is a production chain, and only the validator # set named in its genesis can seal a block on it. A pulsar does not produce blocks in any configuration: its policy # says producesBlocks: false and the node clamps the interval to 0 before it is built. # # WHAT THE DIGESTS BELOW ARE WORTH # They pin what this script fetches, so the only file you check by hand is this one. They are # worth what TLS and this page are worth and no more. What is worth more is the genesis PIN: # 1cf8655125cc1bbbc0ca06a491f53775499785c349b4d0f5748d5ea170e517bf # compiled into the build, covering the allocations, the validator set and the bridge attestors. # strblk refuses any other genesis, so a tampered file cannot put this node on another chain. set -eu BASE=${SOURCELESS_DOWNLOAD_BASE:-https://asgard.xplstr.org/get} CLASS=pulsar P2P_PORT=13130 PEERS='asgard.xplstr.org:47001,asgard.xplstr.org:47002,asgard.xplstr.org:47003,asgard.xplstr.org:47004,asgard.xplstr.org:47005,asgard.xplstr.org:47006,asgard.xplstr.org:47007' BROKKR_SHA256=f63a3c709722a42dfc850d980156f78e9121f5977ff2d81f78c783aa4d00a307 GENESIS_SHA256=fdb62e83e025b282382536af7bfc97091cb900b5b1432a6b089491c38a2d6054 say() { echo " $*"; } step() { echo; echo "== $*"; } die() { echo; echo "join-asgard: $*" >&2; exit 2; } step "this machine" # The interpreter, resolved and reported. Not because this script needs it — it is sh — but because # the thing it is about to install runs under a SERVICE MANAGER, whose PATH is not this shell's. # launchd starts a job with PATH=/usr/bin:/bin:/usr/sbin:/sbin and node from Homebrew is at # /opt/homebrew/bin/node, which is how 371 installs ended as loaded services that had never run. # Brokkr resolves it for itself and refuses without it; this is the early, readable version of the # same refusal. NODE_BIN=${SOURCELESS_NODE_BIN:-$(command -v node 2>/dev/null || true)} if [ -z "$NODE_BIN" ]; then for candidate in /opt/homebrew/bin/node /usr/local/bin/node /usr/bin/node "$HOME/nodejs/bin/node"; do [ -x "$candidate" ] && { NODE_BIN=$candidate; break; } done fi if [ -z "$NODE_BIN" ]; then die "no node on this machine. Install Node 22.11 or newer, or set SOURCELESS_NODE_BIN to its absolute path. This installer builds the node FROM SOURCE and cannot do that without one. If installing Node is not what you want: https://asgard.xplstr.org/get/#binaries publishes a single-file executable that carries its own runtime. It is not the same thing as this installer and the difference matters - it does not configure a network, and started without --network asgard it joins the DEVELOPMENT chain. The page says so beside the download." fi say "node $NODE_BIN ($("$NODE_BIN" --version))" command -v shasum >/dev/null 2>&1 || die "shasum is needed to check the downloads, and there is no --skip-checksum. An installer that verifies when it can and proceeds when it cannot verifies nothing." if command -v curl >/dev/null 2>&1; then FETCH='curl -fsSL -o' elif command -v wget >/dev/null 2>&1; then FETCH='wget -q -O' else die "need curl or wget to fetch the installer"; fi # RAM and disk against this class's profile. A refusal, because the alternative is a node that is # OOM-killed at an unpredictable height and an operator who reads that as a chain fault. # # UNCHECKED rather than zero where the probe is not there. This script's own rule, and it is not # defensive padding: a probe that cannot read anything leaves TOTAL_MIB empty, and an empty value in # [ -ge ] is a syntax error that under set -e aborts with a message about an integer expression. That # is a refusal an operator cannot act on, for a machine that may be perfectly adequate. TOTAL_MIB=$(sysctl -n hw.memsize 2>/dev/null | awk '$1 ~ /^[0-9]+$/ { printf "%d", $1 / 1048576 }') if [ -n "$TOTAL_MIB" ]; then say "memory $TOTAL_MIB MiB total, 192 MiB wanted by a pulsar" [ "$TOTAL_MIB" -ge 192 ] || die "a pulsar wants 192 MiB and this machine has $TOTAL_MIB MiB. The figure is measured idle RSS plus the class retention budget plus 64 MiB of headroom; see deploy/profiles/starw-classes.json. This is the smallest class there is: a pulsar keeps no chain. There is nothing lighter to fall back to, so this machine cannot hold a SourceLess node." else say "memory UNCHECKED — sysctl hw.memsize could not be read. A pulsar wants 192 MiB." fi # Disk, against the same profile, measured on the filesystem the data directory will live on and not # on /. Claimed in this script's banner, so it is CHECKED: a requirement printed and not enforced is # a requirement discovered when the store cannot append. DISK_TARGET=${SOURCELESS_PREFIX:-$HOME} FREE_MIB=$(df -Pm "$DISK_TARGET" 2>/dev/null | awk 'NR == 2 { print $4 }') if [ -n "$FREE_MIB" ]; then say "disk $FREE_MIB MiB free on $DISK_TARGET, 64 MiB wanted (measured)" [ "$FREE_MIB" -ge 64 ] || die "a pulsar wants 64 MiB and $DISK_TARGET has $FREE_MIB MiB free. This is the smallest class there is: a pulsar keeps no chain. There is nothing lighter to fall back to, so this machine cannot hold a SourceLess node." else say "disk UNCHECKED — df could not read $DISK_TARGET" fi # The descriptor limit. MEASURED on a Mac 2026-10-06: a login shell's default is 256, a running seat # held 41 at rest, and a sync that opens more fails in a way that reads as a network fault. LIMIT=$(ulimit -n 2>/dev/null || echo 0) say "descriptors $LIMIT" if [ "$LIMIT" != unlimited ] && [ "$LIMIT" -lt 1024 ]; then say " low. The LaunchAgent brokkr writes raises it to 8192 for the node itself." fi step "download" WORK=$(mktemp -d 2>/dev/null || printf '%s' "${TMPDIR:-/tmp}/sourceless-join.$$") mkdir -p "$WORK" trap 'rm -rf "$WORK"' EXIT INT TERM HUP sha_of() { shasum -a 256 "$1" | awk '{print $1}'; } verify() { want=$2 got=$(sha_of "$1") if [ "$got" != "$want" ]; then echo echo "join-asgard: $1 is NOT the file this installer expects." >&2 echo " expected $want" >&2 echo " got $got" >&2 echo >&2 echo " Nothing has been installed. Do not work around this. Either the download was corrupted" >&2 echo " or it was replaced; in both cases the remedy is to fetch it again and, if it still" >&2 echo " differs, to stop." >&2 exit 2 fi say "verified $(basename "$1") $want" } $FETCH "$WORK/brokkr.sh" "$BASE/brokkr.sh" || die "could not fetch $BASE/brokkr.sh" verify "$WORK/brokkr.sh" "$BROKKR_SHA256" $FETCH "$WORK/asgard-genesis.json" "$BASE/asgard-genesis.json" || die "could not fetch $BASE/asgard-genesis.json" verify "$WORK/asgard-genesis.json" "$GENESIS_SHA256" # The genesis has to outlive this script: the installed node reads it at every start. Kept beside # the install rather than in the temporary directory, which is removed by the trap above. GENESIS_HOME=${SOURCELESS_GENESIS_DIR:-$HOME/.sourceless} mkdir -p "$GENESIS_HOME" cp "$WORK/asgard-genesis.json" "$GENESIS_HOME/asgard-genesis.json" # VERIFIED after copying, not assumed. A cp onto a full disk reports failure through its exit code # and a cp onto a read-only mount can leave a truncated file; both have happened in this project's # own deploy scripts, and both reported success one step later. [ -f "$GENESIS_HOME/asgard-genesis.json" ] || die "the genesis did not land at $GENESIS_HOME/asgard-genesis.json" verify "$GENESIS_HOME/asgard-genesis.json" "$GENESIS_SHA256" step "install" say "class $CLASS (light node — keeps no chain at all)" say "p2p port $P2P_PORT" say "seeds $(echo "$PEERS" | tr ',' '\n' | wc -l | tr -d ' ') published" echo # --advertise is NOT passed. A node behind NAT that advertises an address nobody can reach is a node # that gets quarantined, and this script cannot know whether port $P2P_PORT is forwarded to this # machine. Pass it yourself once it is, and pass a HOST and never host:port — brokkr refuses the # second form, because the node appends the port it bound and the result is an address every peer # discards. sh "$WORK/brokkr.sh" \ --network asgard \ --genesis "$GENESIS_HOME/asgard-genesis.json" \ --class "$CLASS" \ --p2p-port "$P2P_PORT" \ --peers "$PEERS" \ --service launchd \ "$@" echo say "Done. What to do next:" say " read it strblk status --dir ~/.sourceless/data/asgard-pulsar" say " open it forward TCP $P2P_PORT to this machine, then re-run brokkr with --advertise " say " the chain https://asgard.xplstr.org"