igneum/packaging/hive/h-config.sh
igneum-labs 1028c2579f Miner dev fee: app switch and UI line, HiveOS package, Linux worker cross-build, docs and public text
Decision of 4 October 2026 (evening): the Igneum Miner software takes a visible, switchable 1% dev fee, the norm
for GPU miners; the protocol stays fee-free. The miner side (--dev-fee, the 1-in-100 template counter, the audit
command) is on branch dev-fee of the node fork.

- app: settings.dev_fee (default on) passes --dev-fee 0 to igneum-miner when off; Settings shows the miner's own
  "dev fee 1% (1 block in 100) to 0x..." line next to the rewards address with a switch; the engine parses the
  miner's start line and its dev-fee block lines (fee_session, lifetime fee_total, an event per fee block)
- packaging/hive: h-manifest.conf, h-config.sh, h-run.sh, h-stats.sh, make-hive-package.sh (igneum-hive-<v>.tar.gz
  with the Linux igneumd, igneum-miner and both GPU workers), README with the Flight Sheet, selftest.sh (bash -n,
  stub binaries, the three hooks the way Hive runs them, the stats JSON parsed). Hive itself is untested
- infra/cross/build-workers-linux.sh: the NVRTC and OpenCL workers cross-compiled for Linux with zig;
  proto-opencl/cl_dynamic.h gains the Linux dlopen branch (libOpenCL.so.1)
- tools/dev-fee/run.mjs: the fee-block test network (two nodes on 29900+, three CPU miners, payouts audit)
- docs/design/miner-dev-fee.md (mechanism, flag, lines, the DEV_FEE_ADDRESS placeholder and the devnet address),
  docs/fud-ledger.md E18 and the E5/L9 status line, litepaper "What a miner's hour looks like" paragraph, homepage
  miner section note

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 21:46:41 +00:00

61 lines
3.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Igneum Miner for HiveOS: writes igneum.conf from the Flight Sheet. Sourced by Hive (so: return, never exit).
# CUSTOM_URL the node the miner mines against: grpc://host:26610 (your own igneumd), or "local" to run the
# bundled node on this rig (data under the miner folder, peers from PEERS or the public seed)
# CUSTOM_TEMPLATE the payout address: 0x followed by 40 hex (an EVM address you hold the key for), optionally
# followed by .workername (the label of this rig's keys; defaults to the Hive worker name)
# CUSTOM_PASS unused
# CUSTOM_USER_CONFIG extra lines, KEY=VALUE, one per line or separated by spaces:
# DEV_FEE=1 the miner software's dev fee in whole percent (1 block template in 100 to the dev
# address); DEV_FEE=0 turns it off. The protocol itself takes no fee.
# IDENTITIES=8 vote keys per card (8 for a big card, 2 for a small one)
# WORKER=auto auto | cuda | opencl (the GPU worker; auto = cuda on NVIDIA, opencl on AMD)
# VOTE=1 sign finality checkpoints (0 = mine without voting)
# PEERS=a:26611,b:26611 peers for the bundled node when CUSTOM_URL=local
# EXTRA="..." appended to every igneum-miner command line
# Hive sources h-manifest.conf before this hook; the fallback is for a run outside Hive (selftest.sh)
[[ -z "$CUSTOM_CONFIG_FILENAME" ]] && . "$(dirname "${BASH_SOURCE[0]}")/h-manifest.conf"
[[ -z "$CUSTOM_TEMPLATE" ]] && echo -e "${YELLOW:-}Igneum: the wallet (CUSTOM_TEMPLATE) is empty; it must be 0x followed by 40 hex${NOCOLOR:-}" && return 1
[[ -z "$CUSTOM_URL" ]] && echo -e "${YELLOW:-}Igneum: the pool URL (CUSTOM_URL) is empty; grpc://host:26610 of your node, or local${NOCOLOR:-}" && return 1
wallet="${CUSTOM_TEMPLATE%%.*}"
label="${CUSTOM_TEMPLATE#*.}"
[[ "$label" == "$CUSTOM_TEMPLATE" || -z "$label" ]] && label="${WORKER_NAME:-rig}"
label="$(printf '%s' "$label" | tr -c 'A-Za-z0-9_-' '-' | cut -c1-32)"
if ! [[ "$wallet" =~ ^0x[0-9a-fA-F]{40}$ ]]; then
echo -e "${YELLOW:-}Igneum: the wallet must be 0x followed by 40 hex characters, got '$wallet'${NOCOLOR:-}"
return 1
fi
# defaults, then the user's KEY=VALUE lines
DEV_FEE=1; IDENTITIES=8; WORKER=auto; VOTE=1; PEERS=""; EXTRA=""
while read -r kv; do
[[ -z "$kv" || "$kv" == \#* ]] && continue
key="${kv%%=*}"; val="${kv#*=}"
case "$key" in
DEV_FEE|IDENTITIES|WORKER|VOTE|PEERS|EXTRA) printf -v "$key" '%s' "$val" ;;
*) echo "Igneum: unknown setting '$key' ignored" ;;
esac
done < <(printf '%s\n' "$CUSTOM_USER_CONFIG" | tr ' ' '\n' | sed 's/^"//; s/"$//')
[[ "$DEV_FEE" =~ ^[0-9]+$ ]] || DEV_FEE=1
[[ "$IDENTITIES" =~ ^[0-9]+$ ]] || IDENTITIES=8
url="$CUSTOM_URL"
[[ "$url" == "local" ]] && url="local"
[[ "$url" != "local" && "$url" != grpc://* ]] && url="grpc://$url"
mkdir -p "$(dirname "$CUSTOM_CONFIG_FILENAME")"
cat > "$CUSTOM_CONFIG_FILENAME" <<CONF
# written by h-config.sh from the Flight Sheet; edit the Flight Sheet, not this file
NODE_URL=$url
WALLET=$(printf '%s' "$wallet" | tr 'A-F' 'a-f')
LABEL=$label
DEV_FEE=$DEV_FEE
IDENTITIES=$IDENTITIES
WORKER=$WORKER
VOTE=$VOTE
PEERS=$PEERS
EXTRA=$EXTRA
CONF
echo "Igneum: config written to $CUSTOM_CONFIG_FILENAME (node $url, wallet ${wallet:0:8}..., dev fee ${DEV_FEE}%, $IDENTITIES identities per card)"