Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
5c5ffbf
Add Linux GUI installer via Wine
Vic-Nas Jul 26, 2026
2bfeb10
Fix launcher creation and add BTF_RELAY env var support
Vic-Nas Jul 26, 2026
d99f659
Pool server, Linux GUI, unified binary, README update
Vic-Nas Jul 26, 2026
83fa01f
Root Makefile: make linux / make windows, cleaner README
Vic-Nas Jul 26, 2026
fb1ffa4
Remove headless.cpp
Vic-Nas Jul 26, 2026
4cb3d3a
Fix XPM color count mismatch causing toolbar image errors on Linux
Vic-Nas Jul 26, 2026
29ac280
XPM icons: same code on Windows and Linux, no ifdefs around image loa…
Vic-Nas Jul 26, 2026
8d5b836
Fix GTK icon crash and Linux printf format
Vic-Nas Jul 26, 2026
0a67bba
btfrv: 10s socket timeout on relay connects
Vic-Nas Jul 26, 2026
b1971ea
Faster peer discovery: more dials per pass, shorter backoff and sleep
Vic-Nas Jul 26, 2026
aae3f56
Parallel btf peer connections
Vic-Nas Jul 26, 2026
b99e30f
Fix GetMyExternalIP - was disabled, now uses modern IP echo services
Vic-Nas Jul 26, 2026
b80cb56
Fix tunnel disconnect on idle and restore external IP detection
Vic-Nas Jul 26, 2026
3e8928e
Filter stale Nostr descriptors
Vic-Nas Jul 26, 2026
60fae86
Sort peers by freshness, fresh first
Vic-Nas Jul 26, 2026
6a76ec9
Pool: add .btf Stratum listener — miners connect via rendezvous, no p…
Jul 26, 2026
e7f81df
btf pool: self-replacing listeners, one per relay, no queuing between…
Jul 26, 2026
f9fc48d
Mining modes: solo/operator/participant — pool server on-demand, part…
Jul 26, 2026
a780566
Status bar: show external IP and .btf address
Jul 26, 2026
af09cda
README: clean rewrite, concept-first, minimal
Vic-Nas Jul 26, 2026
1c08c38
make linux produces AppImage
Vic-Nas Jul 26, 2026
6134532
make linux produces AppImage
Vic-Nas Jul 26, 2026
1ac33df
Pool dashboard: connect instructions, tabs, share bars
Vic-Nas Jul 26, 2026
0571281
Perf fixes: GetMyExternalIP threaded, btf listener counted
Vic-Nas Jul 26, 2026
1133e11
Perf fixes: GetMyExternalIP threaded, btf listener counted
Vic-Nas Jul 26, 2026
cacbd44
Fix pool payouts: defer until coinbase maturity
Vic-Nas Jul 27, 2026
88a3b69
Pool: clean mode switching, IP warning
Vic-Nas Jul 27, 2026
a690725
Pool: clean mode switching
Vic-Nas Jul 27, 2026
2a63129
Fix gPoolRunning: remove static
Vic-Nas Jul 27, 2026
4aa635c
AppImage: use real icon from bitcoin.ico
Vic-Nas Jul 27, 2026
353fb29
Fix exit crash; Mining menu
Vic-Nas Jul 27, 2026
d043eee
Fix exit crash; Mining menu
Vic-Nas Jul 27, 2026
9133bcf
Fix exit crash; Mining menu
Vic-Nas Jul 27, 2026
973d78c
Fix exit crash; Mining menu
Vic-Nas Jul 27, 2026
56442b3
Fix exit crash; Mining menu
Vic-Nas Jul 27, 2026
ea1d8f4
Windows build: use mingw32-make
Vic-Nas Jul 27, 2026
26354ea
Windows build: simpler make invocation
Vic-Nas Jul 27, 2026
6d0807c
Add deps-windows target
Vic-Nas Jul 27, 2026
178242a
Windows build fixes
Vic-Nas Jul 27, 2026
5509545
Windows build fixes
Vic-Nas Jul 27, 2026
0e90b32
Windows makefile: fix obj dir
Vic-Nas Jul 27, 2026
32379ec
Windows: output to repo root
Vic-Nas Jul 27, 2026
6d47632
Windows: bundle DLLs into zip
Vic-Nas Jul 27, 2026
83af065
Replace wxWidgets with ImGui+GLFW: same build on Linux and Windows
Jul 27, 2026
0e724e9
Fix %I64d that slipped back through rebase (main.h, net.h)
Jul 27, 2026
259a969
MinGW: add _mkdir shim for non-MSVC Windows; fix %I64d
Jul 27, 2026
a9fac4b
Fix gPoolRunning extern outside ifndef _WIN32
Jul 27, 2026
3525e4c
Remove -lboost_system: boost is header-only in this codebase
Jul 27, 2026
826d51b
Status bar: copy buttons for IP and .btf address
Jul 27, 2026
3b3b0d0
Windows: add app icon via windres, strip wx stuff from rc file
Jul 27, 2026
eeef4e4
Clean GUI: single Options menu item, bigger font, better spacing, cle…
Jul 27, 2026
4be73fb
GUI: embed Roboto font at 16px for clear readability on all platforms
Jul 27, 2026
993e927
Windows: windres depends on obj dir target
Jul 27, 2026
a41120e
Fix balance hidden off-screen: put on own line below address bar
Jul 27, 2026
3334fbd
Windows: inline mkdir in every rule, remove dir target that confused …
Jul 27, 2026
8d353ae
Windows: move all target to top so it's the default rule
Jul 27, 2026
b7bbf2e
Fix pool server not starting: always start when operator selected, re…
Jul 27, 2026
87a09e3
Write debug.log to data directory (AppData/Roaming/Bitflash on Windows)
Jul 27, 2026
a4c67f6
Participant miner: use wallet address as username so payouts go to wa…
Jul 27, 2026
8c47149
Add .gitattributes to lock LF line endings, prevent CRLF drift
Jul 27, 2026
4b9db07
Refactor pool mining to btf-only transport
Vic-Nas Jul 27, 2026
affbe54
Persist pool settings and startup wiring
Vic-Nas Jul 27, 2026
a5c934d
Prune stale peers and expose pool queries
Vic-Nas Jul 27, 2026
a9ccc6b
Fix build regressions and add CLI mode/arg parity
Vic-Nas Jul 27, 2026
8f4d245
Fix rpc miner stats declaration order
Vic-Nas Jul 27, 2026
d5feaf2
Centralize pool runtime extern declarations
Vic-Nas Jul 27, 2026
2eb037e
Separate operator/participant dashboards and restore peer stats
Vic-Nas Jul 27, 2026
f0b159b
Add live telemetry strip and clearer per-mode runtime metrics
Vic-Nas Jul 27, 2026
14cfe6b
Reduce mining dashboard clutter and remove manual pool entry
Vic-Nas Jul 27, 2026
6d945fc
Count only authorized pool miners
Vic-Nas Jul 27, 2026
a835d71
Seed initial pool job on startup
Vic-Nas Jul 27, 2026
2871224
Use a real share target for pool work
Vic-Nas Jul 27, 2026
ceaf876
Switch pool accounting to round-based shares
Vic-Nas Jul 27, 2026
3b8551a
Fix nostr pool announcer stats call sites
Vic-Nas Jul 27, 2026
a1beaae
Fix pool stats definition order
Vic-Nas Jul 27, 2026
3caa939
Improve pool worker status display
Vic-Nas Jul 27, 2026
24dd455
Add mutex include for participant status
Vic-Nas Jul 27, 2026
f186b46
Replace ImClamp in dashboard layout
Vic-Nas Jul 27, 2026
c6a0f23
Clarify participant work status
Vic-Nas Jul 27, 2026
92b5d2b
Log participant status transitions
Vic-Nas Jul 27, 2026
6be3b97
Reduce peer discovery log noise
Vic-Nas Jul 27, 2026
4218d75
Add participant status badge
Vic-Nas Jul 27, 2026
cea1ebc
Track participant auth acknowledgements
Vic-Nas Jul 27, 2026
64c6820
Log and validate pool job delivery
Vic-Nas Jul 27, 2026
62b41c8
Stop persisting mining mode/pool settings across restarts
claude Jul 27, 2026
b00bba9
Add explicit Relay mode as the new startup default
claude Jul 27, 2026
f3b8b65
Announce pool changes immediately instead of waiting up to 60s
claude Jul 27, 2026
4e4df8a
Give each pool miner a distinct extranonce2 so jobs no longer overlap
claude Jul 27, 2026
bec097d
Fix debug.log never being written on the real Windows build
claude Jul 27, 2026
960f7b0
Reduce base UI font size one more step (16px -> 14px)
claude Jul 27, 2026
054f3a4
Remove Start/Stop Mining button; mining state follows selected mode
Vic-Nas Jul 27, 2026
3b20827
Fix participant miner stuck waiting for notify after buffered multi-l…
Vic-Nas Jul 27, 2026
46b5e0a
Fix mining.submit rejecting every share due to wrong param-count check
Vic-Nas Jul 27, 2026
c6f60f8
Fix mining.submit rejecting legitimate shares that weren't also winni…
Vic-Nas Jul 27, 2026
3118f7e
Fix dead-peer dial priority: freshness sort was undone by full shuffle
Vic-Nas Jul 27, 2026
bc73dcd
Batch-resolve .btf descriptors to stop hammering public relays during…
Vic-Nas Jul 27, 2026
c3c17d4
Stop reconnecting to relays constantly: pool one persistent connectio…
Vic-Nas Jul 27, 2026
566c64c
Fix wallet crash on rejected send; remove legacy IP-based peer discovery
Vic-Nas Jul 28, 2026
fe7fedd
Raise peer connection target and add dial diversity; fix IPv4-only re…
Vic-Nas Jul 28, 2026
21838f5
Remove accidentally committed build binary; ignore src/bitflash
Vic-Nas Jul 28, 2026
f2307ef
Fix pool participants getting stuck after the first job
Vic-Nas Jul 28, 2026
02e360d
Diversify Nostr discovery relay list
Vic-Nas Jul 28, 2026
e0e4c30
Fix data race in RebuildJob: chain-state reads weren't holding cs_main
Vic-Nas Jul 28, 2026
366d9b0
add operator fee
Vic-Nas Jul 28, 2026
f923b5d
Add categorized, burst-collapsing logging for pool/worker/payout flow
Vic-Nas Jul 28, 2026
46d3b0c
Fix two bugs causing worker stuck + log bloat
Vic-Nas Jul 28, 2026
ece6e01
Fix log bloat, em-dashes, dead code, status bar, Connected/Detected p…
Vic-Nas Jul 28, 2026
c5c2495
Rewrite gui.cpp: proper fixed status bar, scrollable content child
Vic-Nas Jul 28, 2026
e0ed04a
Fix blocking bugs, dead code, pool/participant flow correctness
Vic-Nas Jul 28, 2026
8476e4d
Pool/participant: fix recv blocking, BroadcastJob mutex, listener spa…
Vic-Nas Jul 28, 2026
18ac6ff
Rewrite pool server: single event loop, no per-miner threads
Vic-Nas Jul 28, 2026
b06cd59
Thorough logging and correctness fixes across the full pool/participa…
Vic-Nas Jul 28, 2026
e5a7b06
Fix build error: ImGuiWindowFlags_NoBringToDisplayFront -> NoBringToF…
Vic-Nas Jul 28, 2026
a3aad3c
Remove duplicate status logging from SetParticipantMiningStatus
Vic-Nas Jul 28, 2026
7fa0c04
Implement vardiff: stable share rate instead of fixed difficulty
Vic-Nas Jul 28, 2026
30f2eb3
Fix share target mismatch: pool rejected shares it should have accepted
Vic-Nas Jul 28, 2026
955d7b3
Fix double broadcast, correct block reward calculation, improve payou…
Vic-Nas Jul 28, 2026
89d6df4
Fix 6 bugs found in full flow re-read
Vic-Nas Jul 28, 2026
e87a905
Fix share-target scale mismatch and dead pool hashrate reporting
Vic-Nas Jul 28, 2026
85b2218
Remove stale wxWidgets-era build files and orphaned assets
Vic-Nas Jul 28, 2026
c8e9493
Mine with RandomX fast (2GB dataset) mode instead of light mode forever
Vic-Nas Jul 28, 2026
311caac
Add vardiff stall watchdog: force difficulty down on zero shares, not…
Vic-Nas Jul 28, 2026
b29c4c7
Fix PrintException rethrow killing the whole node on any transient ex…
Vic-Nas Jul 28, 2026
792eb23
Push a fresh job immediately after any difficulty change, not just on…
Vic-Nas Jul 28, 2026
8d0a798
Build RandomX dataset before stratum handshake, not after
Vic-Nas Jul 28, 2026
02cb38b
Reset round shares on externally-found blocks, not just our own
Vic-Nas Jul 28, 2026
8f2cf7c
Show pool hashrate in participant view; show immature coinbase value …
Vic-Nas Jul 28, 2026
ebac203
Persist pending payouts to disk -- survive operator restarts
Vic-Nas Jul 28, 2026
836d930
Fix log escapes, stall timeout 90->45s, save-before-exec ordering, Im…
Vic-Nas Jul 28, 2026
2dd5ed9
Sort transactions by nTimeReceived not chain median time -- new txs a…
Vic-Nas Jul 28, 2026
7f4487e
Sort txs by chain depth not nTimeReceived -- survives resync, unconfi…
Vic-Nas Jul 28, 2026
779719c
Fix orphan block false-positive payout; meaningful tx status instead …
Vic-Nas Jul 28, 2026
f95d3c8
Show Orphaned status in red for orphaned coinbases; distinguish from …
Vic-Nas Jul 28, 2026
0eb58bc
Always reset round shares on new block -- external block left gHaveJo…
Vic-Nas Jul 28, 2026
65977eb
Connect to miners as p2p peers on authorize; send btf address as work…
Vic-Nas Jul 28, 2026
aa43d0e
Fix build: include btfaddr.h for btf::ParseAddress in rpc.cpp
Vic-Nas Jul 28, 2026
2d9c087
Participant connects to operator as p2p peer using already-resolved d…
Vic-Nas Jul 28, 2026
ca94295
Fix relay conflict: pool stratum waits when p2p node holds same relay…
Vic-Nas Jul 28, 2026
1307120
Remove duplicate pool announcement from ThreadNostrSeed -- ThreadBtfP…
Vic-Nas Jul 28, 2026
392913a
Fix relay conflict: ThreadBtfAccept yields to pool stratum in operato…
Vic-Nas Jul 28, 2026
372530e
Fix root cause: relay queues multiple registrations per pubkey (FIFO)…
Vic-Nas Jul 28, 2026
f57fef9
AcceptOneFn skips relay held by ThreadBtfAccept -- clean partition, n…
Vic-Nas Jul 28, 2026
9274b98
Fix stuck miners: ThreadBtfAccept pauses in operator mode, AcceptOneF…
Vic-Nas Jul 28, 2026
816f23a
Remove broken miner-initiated p2p connect -- shared pubkey relay can'…
Vic-Nas Jul 28, 2026
7fe6f5b
Add 15s startup delay to ThreadBtfAccept so pool sets gPoolRunning be…
Vic-Nas Jul 28, 2026
52de2c0
Security: fix OP_RETURN spend bypass, unbounded opcodes, duplicate-tx…
Vic-Nas Jul 28, 2026
5313bf0
nostr: fix relay connect stalls and CDN handshake rejections
Vic-Nas Jul 29, 2026
25dd532
util: rotate debug.log at 20MB instead of growing it forever
Vic-Nas Jul 29, 2026
6603fe8
nostr: shrink dead-peer visibility window instead of tracking failure…
Vic-Nas Jul 29, 2026
3b721c5
nostr: expire stale announcements on-relay, reject private-IP relay a…
Vic-Nas Jul 29, 2026
8ce24a4
util: widen log dedup window from 3s to 5min -- it wasn't collapsing …
Vic-Nas Jul 29, 2026
29c9232
net/rpc: merge p2p and pool accept into one shared pipeline
Vic-Nas Jul 29, 2026
cfa3580
main: restore participant-as-p2p-peer connect (816f23a), now safe
Vic-Nas Jul 29, 2026
2dbc418
review pass: fix a bottleneck I introduced, a misleading GUI number, …
Vic-Nas Jul 29, 2026
6578bd5
add 'make test': targeted tests for peer/pool accept logic
Vic-Nas Jul 29, 2026
d89705b
nostr: fix missing TLS certificate verification (was fully MITM-able)
Vic-Nas Jul 29, 2026
bc619bd
remove make test -- only covered logic, not the network behavior it n…
Vic-Nas Jul 29, 2026
c9aed6b
net: bind listen socket to 0.0.0.0 instead of gethostname-derived addr
Vic-Nas Jul 29, 2026
6de9115
nostr: ship a CA bundle so Windows TLS verification actually works
Vic-Nas Jul 29, 2026
5c068b9
net: legacy direct-IP listener off by default, real single-instance lock
Vic-Nas Jul 29, 2026
689e535
net: remove the direct-IP listener entirely (superseded by prior gating)
Vic-Nas Jul 29, 2026
d6dd806
nostr: replace hand-rolled WebSocket/TLS client with libwebsockets
Vic-Nas Jul 29, 2026
9bc3b81
build: auto-install MSYS2/UCRT64 dependencies before building
Vic-Nas Jul 29, 2026
4d816c4
build: fix the real Windows/Linux dep lists, remove dead build.sh
Vic-Nas Jul 29, 2026
0e69677
relay: harden btfrv.cpp, fix client-side timeout gap, deduplicate rel…
Vic-Nas Jul 29, 2026
a7189f0
util: route error() through the same dedup as LogPrint
Vic-Nas Jul 29, 2026
3f93155
net: compact block relay (BIP152-style), backward compatible with old…
Vic-Nas Jul 29, 2026
7d952b2
windows: package vendored cacert.pem into release zip
Vic-Nas Jul 29, 2026
37fd815
build: single VERSION file drives release filenames + embedded app ve…
Vic-Nas Jul 29, 2026
c0309d1
updater: mandatory-repo GitHub self-update + release automation workflow
Vic-Nas Jul 29, 2026
7d962d7
release: bump version to 1.2.3
Vic-Nas Jul 29, 2026
1e8e65f
build: make UPDATE_REPO mandatory (REPO=owner/repo), no silent default
Vic-Nas Jul 29, 2026
7284876
fix: actually apply the snprintf/nlohmann fix to update.cpp (was only…
Vic-Nas Jul 29, 2026
3109fd5
release: name build artifacts after the repo (APPNAME), not hardcoded…
Vic-Nas Jul 29, 2026
a8c0fb3
build: self-install pillow if missing, don't rely on a separate CI step
Vic-Nas Jul 29, 2026
7a7172c
release: bump version to 1.2.4
Vic-Nas Jul 29, 2026
fa4fd13
main: cap orphan transactions held in memory (#16)
Bitflash-sh Jul 28, 2026
799f4b2
serialize: grow strings as data arrives, not to the declared length (…
Bitflash-sh Jul 28, 2026
9b05b4c
rpc: bound and guard the Stratum surface (#19)
Bitflash-sh Jul 28, 2026
4d9e550
main: cap signature operations per block (#20)
Bitflash-sh Jul 28, 2026
463683f
security: verify Ed25519 signature on downloaded update before instal…
Vic-Nas Jul 29, 2026
4b3d29d
ci: install zip in MSYS2 — windows target needs it to package the rel…
Vic-Nas Jul 29, 2026
1b2a6c1
fix: resolve cacert.pem relative to the exe's own directory, not CWD
Vic-Nas Jul 29, 2026
80e0f24
gui: wire up the auto-updater with an explicit consent dialog
Vic-Nas Jul 29, 2026
eea9a82
release: bump version to 1.2.5
Vic-Nas Jul 29, 2026
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 .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
136 changes: 136 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Release

# Fires when VERSION changes on main. workflow_dispatch is also enabled so
# the pipeline can be test-run without bumping the version.
on:
push:
branches: [main]
paths:
- VERSION
workflow_dispatch: {}

permissions:
contents: write

jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
should_release: ${{ steps.v.outputs.should_release }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: v
run: |
VERSION=$(cat VERSION | tr -d '[:space:]')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should_release=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "Tag v$VERSION already exists, skipping release."
echo "should_release=false" >> "$GITHUB_OUTPUT"
else
echo "should_release=true" >> "$GITHUB_OUTPUT"
fi

build-linux:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install AppImage icon dependency
run: pip install --break-system-packages pillow
- name: Build AppImage
run: make linux REPO=${{ github.repository }}
- uses: actions/upload-artifact@v4
with:
name: linux-build
path: "*-*-x86_64.AppImage"

build-windows:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
base-devel
git
zip
- name: Build (MSYS2 UCRT64)
run: make windows REPO=${{ github.repository }}
- uses: actions/upload-artifact@v4
with:
name: windows-build
path: "*-*-windows.zip"

release:
needs: [check-version, build-linux, build-windows]
if: needs.check-version.outputs.should_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Build short changelog
id: notes
run: |
PREV_TAG=$(git tag --sort=-creatordate | head -n1 || true)
if [ -n "$PREV_TAG" ]; then
RANGE="$PREV_TAG..HEAD"
else
RANGE="HEAD"
fi
{
echo "notes<<EOF"
echo "Top changes in this release:"
git log $RANGE --no-merges --pretty=format:'%H %s' | \
while read -r hash subject; do
n=$(git show --numstat --pretty=format: "$hash" | awk '{s+=$1+$2} END{print s+0}')
echo "$n|- $subject"
done | sort -t'|' -k1,1 -rn | head -n 8 | cut -d'|' -f2
echo "EOF"
} >> "$GITHUB_OUTPUT"

- name: Sign release assets
env:
UPDATE_SIGNING_KEY: ${{ secrets.UPDATE_SIGNING_KEY }}
run: |
if [ -z "$UPDATE_SIGNING_KEY" ]; then
echo "::error::UPDATE_SIGNING_KEY secret is not set — cannot sign release assets. Auto-update will refuse to install this release."
exit 1
fi
echo "$UPDATE_SIGNING_KEY" > /tmp/update_signing_key.pem
for f in artifacts/*-*-x86_64.AppImage artifacts/*-*-windows.zip; do
[ -f "$f" ] || continue
openssl pkeyutl -sign -rawin -inkey /tmp/update_signing_key.pem -in "$f" -out "$f.sig"
done
rm -f /tmp/update_signing_key.pem

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-version.outputs.version }}
name: ${{ github.event.repository.name }} v${{ needs.check-version.outputs.version }}
body: ${{ steps.notes.outputs.notes }}
files: |
artifacts/*-*-x86_64.AppImage
artifacts/*-*-windows.zip
artifacts/*.sig
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ dist/
# Editor/OS cruft
.DS_Store
Thumbs.db
src/bitflash
162 changes: 162 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Bitflash — top-level build
#
# make linux build Bitflash-*-x86_64.AppImage
# make windows build Bitflash-*-windows.zip (from MSYS2 UCRT64)
# make clean remove build artifacts

ROOT := $(shell pwd)
NPROC := $(shell nproc 2>/dev/null || echo 2)
SUDO := $(shell [ "$$(id -u)" = "0" ] && echo "" || echo "sudo")
VERSION := $(shell cat VERSION)

ifndef REPO
$(error REPO is not set. Build with: make linux REPO=owner/repo (or make windows REPO=owner/repo))
endif

# Release filenames are derived from the repo name (not hardcoded "Bitflash"),
# so a fork built with REPO=you/your-fork produces distinct filenames from
# the canonical repo's releases.
APPNAME := $(word 2,$(subst /, ,$(REPO)))

# ---- Linux ----------------------------------------------------------------

linux: deps-linux
$(MAKE) -C src -f Makefile -j$(NPROC) VERSION=$(VERSION) REPO=$(REPO)
strip src/bitflash
$(MAKE) -f Makefile appimage

deps-linux: deps-apt deps-secp256k1 deps-randomx

deps-apt:
@if command -v apt-get >/dev/null 2>&1; then \
$(SUDO) apt-get install -y build-essential cmake git pkg-config autoconf \
libtool libssl-dev libdb5.3++-dev libsodium-dev nlohmann-json3-dev \
libboost-system-dev libglfw3-dev libgl-dev libwebsockets-dev libcurl4-openssl-dev; \
else \
echo "Not an apt system — install: g++ cmake git autoconf libtool"; \
echo " libssl libdb++ libsodium nlohmann-json boost glfw3 opengl libwebsockets"; \
fi

deps-secp256k1:
@if [ ! -f /usr/local/lib/libsecp256k1.a ]; then \
echo "==> building libsecp256k1"; \
rm -rf $(ROOT)/secp256k1-build; \
git clone --depth 1 https://github.com/bitcoin-core/secp256k1 $(ROOT)/secp256k1-build; \
cd $(ROOT)/secp256k1-build && ./autogen.sh && \
./configure --enable-module-schnorrsig --enable-module-extrakeys \
--disable-shared --with-pic --disable-benchmark --disable-tests && \
make -j$(NPROC) && $(SUDO) make install && $(SUDO) ldconfig; \
echo "==> libsecp256k1 done"; \
else \
echo "==> libsecp256k1 already installed"; \
fi

deps-randomx:
@if [ ! -f $(HOME)/RandomX/build/librandomx.a ]; then \
echo "==> building RandomX"; \
rm -rf $(HOME)/RandomX; \
git clone --depth 1 https://github.com/tevador/RandomX $(HOME)/RandomX; \
mkdir -p $(HOME)/RandomX/build; \
cd $(HOME)/RandomX/build && cmake .. -DCMAKE_BUILD_TYPE=Release && \
make -j$(NPROC) randomx; \
echo "==> RandomX done"; \
else \
echo "==> RandomX already built"; \
fi

appimage: src/bitflash
@echo "==> building AppImage"
@if [ ! -x /tmp/appimagetool ]; then \
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" \
-O /tmp/appimagetool && chmod +x /tmp/appimagetool; \
fi
@rm -rf /tmp/bitflash.AppDir
@mkdir -p /tmp/bitflash.AppDir/usr/bin \
/tmp/bitflash.AppDir/usr/lib \
/tmp/bitflash.AppDir/usr/share/applications \
/tmp/bitflash.AppDir/usr/share/icons/hicolor/256x256/apps
@cp src/bitflash /tmp/bitflash.AppDir/usr/bin/bitflash
@printf '#!/bin/sh\nHERE="$$(dirname "$$(readlink -f "$$0")")"\nexport LD_LIBRARY_PATH="$$HERE/usr/lib:$$LD_LIBRARY_PATH"\nexec "$$HERE/usr/bin/bitflash" "$$@"\n' \
> /tmp/bitflash.AppDir/AppRun && chmod +x /tmp/bitflash.AppDir/AppRun
@printf '[Desktop Entry]\nName=Bitflash\nExec=bitflash\nIcon=bitflash\nType=Application\nCategories=Finance;\n' \
> /tmp/bitflash.AppDir/bitflash.desktop
@cp /tmp/bitflash.AppDir/bitflash.desktop \
/tmp/bitflash.AppDir/usr/share/applications/
@python3 -c "import PIL" 2>/dev/null || pip install --break-system-packages --quiet pillow
@python3 -c "\
from PIL import Image; \
ico = Image.open('src/rc/bitcoin.ico'); \
img = ico.convert('RGBA'); \
img.save('/tmp/bitflash.AppDir/bitflash.png'); \
import shutil; shutil.copy('/tmp/bitflash.AppDir/bitflash.png', \
'/tmp/bitflash.AppDir/usr/share/icons/hicolor/256x256/apps/bitflash.png')"
@for lib in libsodium.so.23 libdb_cxx-5.3.so libglfw.so.3; do \
path=$$(ldconfig -p | grep " $$lib " | awk '{print $$NF}' | head -1); \
[ -z "$$path" ] && path=$$(find /usr/lib /lib -name "$$lib" 2>/dev/null | head -1); \
[ -n "$$path" ] && cp -L "$$path" /tmp/bitflash.AppDir/usr/lib/ && echo " bundled $$lib" || echo " missing $$lib"; \
done
@ARCH=x86_64 /tmp/appimagetool --no-appstream /tmp/bitflash.AppDir \
$(ROOT)/$(APPNAME)-$(VERSION)-x86_64.AppImage 2>&1 | grep -E "^Built|^Error" || true
@echo "Built: $(APPNAME)-$(VERSION)-x86_64.AppImage"

# ---- Windows (MSYS2 UCRT64) -----------------------------------------------

deps-windows:
pacman -S --noconfirm --needed \
mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-make \
mingw-w64-ucrt-x86_64-glfw \
mingw-w64-ucrt-x86_64-openssl \
mingw-w64-ucrt-x86_64-db \
mingw-w64-ucrt-x86_64-libsodium \
mingw-w64-ucrt-x86_64-nlohmann-json \
mingw-w64-ucrt-x86_64-boost \
mingw-w64-ucrt-x86_64-libwebsockets \
mingw-w64-ucrt-x86_64-curl \
mingw-w64-ucrt-x86_64-cmake \
autoconf automake libtool
@if [ ! -f deps/lib/libsecp256k1.a ]; then \
rm -rf secp256k1-build; \
git clone --depth 1 https://github.com/bitcoin-core/secp256k1 secp256k1-build; \
cd secp256k1-build && ./autogen.sh && \
./configure --prefix=$(ROOT)/deps \
--enable-module-schnorrsig --enable-module-extrakeys \
--disable-shared --with-pic --disable-benchmark --disable-tests && \
make install; \
echo "==> secp256k1 done"; \
else \
echo "==> secp256k1 already built"; \
fi
@if [ ! -f RandomX/build/librandomx.a ]; then \
rm -rf RandomX; \
git clone --depth 1 https://github.com/tevador/RandomX; \
mkdir -p RandomX/build; \
cd RandomX/build && cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \
make randomx; \
echo "==> RandomX done"; \
else \
echo "==> RandomX already built"; \
fi

windows: deps-windows
cd src && make -f makefile.mingw VERSION=$(VERSION) REPO=$(REPO)
@rm -rf $(APPNAME)-$(VERSION)-windows
@mkdir -p $(APPNAME)-$(VERSION)-windows
@cp src/bitflash.exe $(APPNAME)-$(VERSION)-windows/$(APPNAME).exe
@ldd src/bitflash.exe | grep ucrt64 | awk '{print $$3}' | \
xargs -I{} cp {} $(APPNAME)-$(VERSION)-windows/ 2>/dev/null || true
@test -f src/cacert.pem && cp src/cacert.pem $(APPNAME)-$(VERSION)-windows/ \
|| echo "WARNING: src/cacert.pem missing, Windows zip will lack a CA bundle (Nostr TLS will fail)"
@zip -r $(APPNAME)-$(VERSION)-windows.zip $(APPNAME)-$(VERSION)-windows/
@echo "Built: $(APPNAME)-$(VERSION)-windows.zip"

# ---- Clean ----------------------------------------------------------------

clean:
$(MAKE) -C src -f Makefile clean 2>/dev/null || true
cd src && make -f makefile.mingw clean 2>/dev/null || true
rm -f *-*.AppImage *-*-windows.zip
rm -rf *-*-windows

.PHONY: linux windows clean appimage \
deps-linux deps-windows deps-apt deps-secp256k1 deps-randomx
Loading