Commit graph

2534 commits

Author SHA1 Message Date
GaltRanch
458b60fbbc Add status bar with mode, block height, and BTC price to main menus
- PyBlock.py MainMenu(): fetch BTC price from mempool.space API,
  display status_bar() showing mode/block/price before menu header
- SPV/spvblock.py MainMenuCROPPED(): same status_bar integration
- Import shared.ui utilities in both files

The status bar shows at a glance: active mode (Local/Remote/Lite),
current block height, and USD price of Bitcoin.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:09:21 -03:00
GaltRanch
04c0e33efc Rename 'Cropped' mode to 'Lite Mode' in user-facing text
- PyBlock.py: Update intro screen text and option label
- SPV/spvblock.py: Change all n="CROPPED" display labels to "LITE MODE"
- Internal config value 'cropped' in intro.conf unchanged for backward compat

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:07:21 -03:00
GaltRanch
915da7a1d5 Add shared/ui.py with status bar, spinner, error display, and input validation
Foundation module for Level 1 frontend improvements:
- status_bar(): persistent header showing mode, block height, BTC price
- show_error/warning/success(): visible user-facing messages
- Spinner: context manager for loading animations on API calls
- prompt_menu(): input validation with back-button support
- ANSI color constants for consistent styling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:06:17 -03:00
GaltRanch
42623cfc53 Convert download/install shell chains to list-based subprocess in SPV/spvblock.py
Replace 21 mkdir/cd/wget/tar/unzip/git-clone/chmod shell chains with
os.makedirs() + list-based subprocess.run(cwd=) calls:
- Nostr console 5 platform installers + seed/QR tools
- Mempool-cli x86/ARM installers
- CroppedMiner x86/ARM, Luxor, TinySeed
- Bija, bpytop, Cashu, ColdCore, Warden, Resurrection wallet
- Satellite and terminal_matrix git clones

Replace chmod 777 * with chmod +x on specific binaries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:51:48 -03:00
GaltRanch
455cb986ce Convert download/install shell chains to list-based subprocess in PyBlock.py
Replace 27 mkdir/cd/wget/tar/unzip/git-clone/chmod shell chains with
os.makedirs() + list-based subprocess.run(cwd=) calls:
- Mempool-cli x86/ARM installers
- Phoenix wallet 4 platform installers
- Nostr console 5 platform installers + seed tools
- SatSale, Warden, Bija, Coldcore, Cashu, bpytop, Luxor, UTXOracle

4 remaining shell=True are legitimate pipe chains (bitcoincli|xxd, jq).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:51:41 -03:00
GaltRanch
757b38d3de Convert curl API calls to requests library in SPV/ppi.py
Replace 30 subprocess curl API calls with native Python requests:
- LNBits: invoice create/check/pay, paywall CRUD, LNURL withdraw (11)
- OpenNode: balance, charges, withdrawals, status RSS (7)
- TallyCoin: payment requests (2)
- LNPay: invoice status and decode (2)
- Simple GETs: PGP key, bwt banner, weather, rate.sx (5+)

9 remaining shell=True are pipe chains requiring shell processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:32:55 -03:00
GaltRanch
cf69861dcf Convert LNBits, OpenNode, and TallyCoin curl calls to requests library
Replace 23 subprocess curl API calls with native Python requests:
- LNBits: create/check invoice, pay invoice, paywall CRUD, LNURL withdraw
- OpenNode: create charge, list funds, list payments, initiate withdrawal,
  check status (RSS), decode invoice
- TallyCoin: payment requests (2 functions)

Remaining shell=True in ppi.py are pipe chains (curl|grep|html2text)
that require shell for processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:27:41 -03:00
GaltRanch
c0b40e91f7 Convert simple subprocess shell=True to list format with cwd
Replace cd-and-run shell patterns with list-based subprocess.run()
using cwd parameter for directory context:

- Phoenix macOS ARM installer
- Luxor CLI help
- Mempool CLI (2 instances)
- SatSale, Cashu, Warden, bpytop launchers
- Bija docker-compose
- Both SPV/spvblock.py and PyBlock.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:21:08 -03:00
GaltRanch
935cf809de Eliminate all user-input shell injection vectors in spvblock.py
Convert every remaining subprocess call that interpolates user input
(responseC/D/E, invoice, private keys) from shell=True f-strings to
safe list-based subprocess.run() with cwd parameter:

- Miners (CroppedMiner x86/ARM): user address, password, threads
- Foreman Pickaxe: apiKey and clientId
- LND decodepayreq: invoice string (2 instances)
- TinySeed: seed words
- Nostr console (5 platform variants): private key
- Nostr seed/QR seed: hex input

Zero user-input + shell=True patterns remain in the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:19:36 -03:00
GaltRanch
0a70a7260a Eliminate all star imports across the entire codebase
Replace every `from X import *` with explicit named imports:
- SPV/spvblock.py: 11 star imports resolved
- SPV/ppi.py: 4 star imports resolved, duplicate import removed
- SPV/nodeconnection.py, SPV/sysinf.py, SPV/apisnd.py, SPV/donation.py
- mempoolclock.py, sysinf.py, apisnd.py, donation.py

Removed unused imports (art, nodeconnection in donation, logos in apisnd).
Zero star imports remain in the project.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:13:33 -03:00
GaltRanch
273d806d37 Rename shadowed builtin 'list' variable to 'cmd'
Replace all uses of 'list' as a variable name for shell command strings
with 'cmd' to avoid shadowing Python's built-in list type.
Affects ppi.py, PyBlock.py, SPV/ppi.py, and SPV/spvblock.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:10:49 -03:00
GaltRanch
465826c152 Harden Dockerfile and improve ignore files
- Pin Ubuntu base image by SHA256 digest for reproducibility
- Pin ttyd to release tag 1.7.7 with --depth 1
- Add --no-cache-dir to pip install to reduce image size
- Expand .dockerignore with .env, .pickle, cache dirs, logs
- Expand .gitignore with IDE files, OS files, debug logs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:06:48 -03:00
GaltRanch
00f39014bd Fix unclosed sockets and add __main__ guard in SHS.py
- Wrap socket operations in try/finally to ensure sock.close() on errors
- Add if __name__ == '__main__' guard to prevent execution on import
- Applied to both pybitblock/SHS.py and pybitblock/SPV/SHS.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:06:00 -03:00
GaltRanch
a746b36420 Replace star imports with explicit imports in core files
- PyBlock.py: Replace 14 star imports with explicit named imports,
  remove unused `from art import *` and `from SPV.spvblock import *`
- ppi.py: Replace star imports, remove unused art/nodeconnection imports,
  remove duplicate `import requests` and dead lnpay_py comments
- nodeconnection.py: Replace star imports, remove unused art import

This improves code clarity, prevents namespace pollution, and makes
dependencies between modules explicit and traceable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:03:52 -03:00
GaltRanch
9886c66d4e Harden GitHub Actions workflow security
- Replace pipe-to-shell Poetry install with download-then-execute pattern
- Remove --password flag that exposed PyPI token in logs
- Use POETRY_PYPI_TOKEN_PYPI env var instead (Poetry reads it natively)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:59:47 -03:00
GaltRanch
3c7eb44030 Fix mutable default argument bug in all rpc() functions
Replace params=[] with params=None pattern to prevent shared state
between calls. Affects PyBlock.py, nodeconnection.py,
SPV/nodeconnection.py, and clockscriptREMOTE.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:59:22 -03:00
GaltRanch
12ccdd5c19 Harden pickle deserialization with SafeUnpickler in migrate_config.py
Replace raw pickle.load() with a restricted SafeUnpickler that only
allows basic Python types (dict, list, str, int, etc.), blocking
arbitrary code execution from tampered pickle files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:58:49 -03:00
GaltRanch
6304b7a42a Fix shell injection vulnerabilities in spvblock.py
- Replace user input in subprocess f-strings with safe alternatives:
  - Phoenix CLI: use list-based subprocess.run() with cwd parameter
  - PhoenixD API: replace curl shell commands with requests library
  - Bitaxe API: replace curl shell commands with requests library
  - Luxor CLI: use list-based subprocess.run() with cwd parameter
- Convert Phoenix download/install from shell=True to list-based commands
- Add shlex import for safe argument splitting
- Collapse repeated input/subprocess blocks into loops

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:54:42 -03:00
GaltRanch
cdfb258e95 Harden file handling, exception specificity, and API key management
- Replace open() without context managers with `with` statements across all modified files
- Change bare `except:` to `except Exception:` for safer exception handling
- Move Whale Alert API key from hardcoded to environment variable
- Use raw strings for ASCII art to prevent escape sequence issues
- Simplify image file handling in nodeconnection.py
- Convert unsafe shell subprocess calls to list-based format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:52:26 -03:00
GaltRanch
7366e9fe9c Refactor architecture: config singleton, logging, menu system, dependencies
Major improvements across 7 areas:

- Add centralized Config singleton (config.py) replacing ~176 config
  reloads per session with a single cached load
- Add logging framework (log.py) with RotatingFileHandler, replacing
  silent except Exception: pass blocks with structured logging
- Refactor menu system (menu.py) with data-driven color selection,
  eliminating ~1,370 lines of duplicate menu functions
- Create shared/ modules extracting 7 utility functions duplicated
  between PyBlock.py and SPV/spvblock.py
- Clean dependencies: pin all versions, remove stdlib packages
  (asyncio, threading), remove unused imports
- Improve Docker: pin ubuntu:24.04, add non-root user, use venv
- Improve CI: update to actions v4/v5, add test job before publish
- Fix entry point: wrap main loop in def main(), proper module import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:58:24 -03:00
GaltRanch
0224cfe230 Fix critical security vulnerabilities across the codebase
Replace insecure patterns that exposed the application to command injection,
arbitrary code execution, and data interception attacks.

- Replace os.popen/os.system with subprocess.run using argument lists
- Migrate pickle config serialization to JSON format
- Replace bare except: blocks with specific exception types
- Fix insecure HTTP URLs to HTTPS (opreturnbot.com, ascii.live)
- Replace shell curl commands with requests library calls
- Add migrate_config.py script for pickle-to-JSON config migration
- Convert existing SPV config files to JSON format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:24:47 -03:00
Satoshi Nakamoto
75d0843bfb
Update labels for Bitcoin and Lightning Network 2026-03-21 04:20:00 +01:00
Satoshi Nakamoto
db8a30f584
Update menu options for Bitcoin and Lightning 2026-03-21 04:18:19 +01:00
Satoshi Nakamoto
61e88d049a
Update print statement for Bitcoin Node connection 2026-03-21 04:13:53 +01:00
Satoshi Nakamoto
0ec47b8a92
Update ppi.py 2026-03-21 04:13:11 +01:00
Satoshi Nakamoto
2118b24d22
Update print statement for Bitcoin Node connection 2026-03-21 04:10:09 +01:00
Satoshi Nakamoto
f5261e75f9
Update README to simplify Bitcoin references 2026-03-21 04:05:47 +01:00
Satoshi Nakamoto
ea71e0aec3
Delete .github/workflows/test.yml 2026-03-15 05:53:23 +01:00
Satoshi Nakamoto
67e2503173
Update README.md
Removed two Twitter handles from the list.
2026-02-20 04:14:42 +01:00
Satoshi Nakamoto
39783265a9
Update BIP-110 version. 2026-02-20 04:12:25 +01:00
Satoshi Nakamoto
a8f8cfe882
Update warning message for blockchain synchronization 2026-01-22 03:58:32 +01:00
Satoshi Nakamoto
0b640a839c
Update prompt message for assumevalid block hash 2026-01-19 23:57:34 +01:00
Satoshi Nakamoto
caf17401f3
Clean up download commands in the script 2026-01-19 20:19:39 +01:00
Satoshi Nakamoto
2c828ea44e
Update download links for SHA256SUMS files 2026-01-19 20:04:03 +01:00
Satoshi Nakamoto
0837433ba3
Replace curl with wget for downloading files 2026-01-19 19:39:32 +01:00
Satoshi Nakamoto
f7a0283944
Update blockchain data download warning to 800GB 2026-01-19 17:21:47 +01:00
Satoshi Nakamoto
1947f40035
Script for Bitcoin KNOTS+BIP110 + CKPool installation 2026-01-19 16:43:49 +01:00
Satoshi Nakamoto
94c91af01f
Change mining pool port from 3333 to 4444 2025-12-12 20:18:43 +01:00
Satoshi Nakamoto
3c09d96531
Change mining pool port from 3333 to 4444 2025-12-12 20:17:20 +01:00
Satoshi Nakamoto
ce6caa6143
Change port number from 3333 to 4444 2025-12-12 20:15:58 +01:00
Satoshi Nakamoto
92cd470e62
Change solo mining pool address to port 4444
Updated the mining pool address for solo mining.
2025-12-12 20:15:10 +01:00
Satoshi Nakamoto
72e1f4d69b
Update Dockerfile to install pyblock from GitHub 2025-11-29 00:01:51 +01:00
Satoshi Nakamoto
8960931af9
Remove unused import 'jq' from spvblock.py
Removed unused import statement for 'jq'.
2025-11-28 23:54:12 +01:00
Satoshi Nakamoto
e775426be3
Remove unused import for jq in PyBlock.py 2025-11-28 23:53:34 +01:00
Satoshi Nakamoto
db7a76cb2f
README.md 2025-10-11 15:51:34 +02:00
Satoshi Nakamoto
a771f3244c
v29.2.knots20251010 2025-10-11 05:25:32 +02:00
Satoshi Nakamoto
9681e96070
Update install-full-tor-node.sh 2025-09-11 23:07:16 +02:00
Satoshi Nakamoto
3d8be3ab27
Update install-full-node.sh 2025-09-11 23:06:21 +02:00
Satoshi Nakamoto
a8fb7e6893
Knots 29.1.knots20250903 2025-09-05 22:22:20 +02:00
Satoshi Nakamoto
85c6726b3d
Update install-full-tor-node.sh
Knots 29.1.knots20250903
2025-09-05 22:19:44 +02:00