Commit graph

2635 commits

Author SHA1 Message Date
Satoshi Nakamoto
b7e88a7f82
Update mining pool URLs in spvblock.py 2026-08-13 02:03:47 +02:00
Satoshi Nakamoto
ab0a6a3489
Update mining pool address and port 2026-08-13 02:02:05 +02:00
Satoshi Nakamoto
9f9009fa74
Change PyBLØCK solo mining pool address
Updated the mining pool address for PyBLØCK solo mining.
2026-08-13 02:01:14 +02:00
Satoshi Nakamoto
f0786cf3fa
Update host and port for connection settings 2026-08-13 02:00:02 +02:00
Satoshi Nakamoto
b3b988c569
Delete knotsbip110-and-ckpool-solo.sh 2026-06-26 03:27:18 +02:00
Satoshi Nakamoto
f2451b0ebc
Delete knots-and-ckpool-solo.sh 2026-06-26 03:27:01 +02:00
Satoshi Nakamoto
81fac0c830
Delete install-full-tor-node.sh 2026-06-26 03:26:43 +02:00
Satoshi Nakamoto
0d14c4dc2d
Delete install-full-node.sh 2026-06-26 03:25:55 +02:00
Satoshi Nakamoto
0855c99b3b
Merge pull request #741 from MarcanoFilms/fix/oraclevision-v2.2-review
fix: OracleVision v2.2 review follow-up (Sourcery feedback)
2026-06-23 23:46:41 +02:00
MarcanoFilms
5c019e9a8e fix: address Sourcery review feedback on OracleVision v2.2 PR
- Fix script_type derivation from validateaddress (hex scriptPubKey)
- Add getaddressinfo fallback and safer RPC result guards
- Centralize flagged transaction selection in ui.py helper
- Harden configure_detectors optional import and document witness_bytes
- Remove dead exception handling in tx_service
- Expand unit tests for addresses, tx_flow, and detector registry
- Align README/PR doc wording
2026-06-23 17:22:04 -04:00
Satoshi Nakamoto
62d94d8395
Merge pull request #740 from GaltRanch/fix/umbrel-bundled-cli
fix(umbrel): bundle bitcoin-cli and lncli so mode A/B work on Umbrel
2026-06-23 23:21:22 +02:00
Satoshi Nakamoto
8a6beec395
Update umbrel/lncli-wrapper.sh
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2026-06-23 23:21:05 +02:00
Satoshi Nakamoto
461d106f1a
Merge pull request #739 from MarcanoFilms/feature/oraclevision-v2.2-tx-inspector
OracleVision v2.2: Transaction Inspector and pluggable detectors
2026-06-23 23:19:51 +02:00
Satoshi Nakamoto
c730e91d1a
Update PR_ORACLEVISION_V2.2.md
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2026-06-23 23:18:31 +02:00
GaltRanch
58ea9d907d fix(umbrel): switch bundled bitcoin-cli to Bitcoin Knots
User preference: stick with Knots rather than Core. The RPC protocol is
identical so PyBLOCK's behavior is unchanged, but the bundled binary now
matches the Knots flavor Umbrel ships in `umbrel-bitcoin`.

- dockerfile: download bitcoin-cli from
  bitcoinknots.org/files/28.x/28.1.knots20250305/ instead of bitcoincore.org.
  SHA256SUMS verification preserved.
- umbrel/umbrel-app.yml: clarify release notes mention Knots specifically.

Verified locally: bitcoin-cli.bin --version now reports
"Bitcoin Knots RPC client version v28.1.knots20250305".

Co-Authored-By: kulvex code <noreply@github.com>
2026-06-23 18:12:49 -03:00
GaltRanch
ba5e9606db fix(umbrel): bundle bitcoin-cli and lncli for mode A/B without Lite fallback
PyBLOCK's mode A (Bitcoin + Lightning) and mode B (Bitcoin only) call
bitcoin-cli and lncli directly via subprocess. The Umbrel image did not
ship those binaries, so the startup validation in PyBlock.py:1898-1909
detected the empty CLI paths and silently redirected to Lite Mode against
public APIs — defeating the point of installing PyBLOCK on a node.

Per nmfretz's review on getumbrel/umbrel-apps#5258, this takes the
"bundle the binaries inside the PyBLOCK image" path (option 2):

- dockerfile: download bitcoin-cli (Bitcoin Core 28.1) and lncli (LND
  v0.20.1-beta, matching what Umbrel ships) for both linux/amd64 and
  linux/arm64. Verifies the Bitcoin Core SHA256SUMS. Real binaries land
  at /usr/local/bin/{bitcoin-cli,lncli}.bin.
- umbrel/{bitcoin-cli,lncli}-wrapper.sh: thin shell wrappers installed
  as /usr/local/bin/{bitcoin-cli,lncli} that exec the real binary with
  -rpcconnect/-rpcuser/-rpcpassword (or --rpcserver/--tlscertpath/
  --macaroonpath for lncli) injected from the BITCOIN_RPC_* / LND_*
  env vars Umbrel provides via APP_BITCOIN_* / APP_LIGHTNING_*. They
  fail loud if those env vars are missing.
- entrypoint.sh: default BITCOIN_CLI_PATH/LND_CLI_PATH to the wrapper
  locations when the relevant RPC host env vars are set and the wrapper
  is executable, so bclock.conf / blndconnect.conf get the right
  bitcoincli / ln paths automatically.
- umbrel/: bump image tag and app version to v4.0.2 with release notes.

Local smoke test on amd64:
  bitcoin-cli.bin --version -> Bitcoin Core RPC client version v28.1.0
  lncli.bin --version       -> lncli version 0.20.1-beta
  /usr/local/bin/bitcoin-cli (no env) -> fails with "BITCOIN_RPC_HOST must be set"
  /usr/local/bin/bitcoin-cli (env set) -> dispatches to the real binary

Image grows ~70MB (mostly the Go-built lncli).

Co-Authored-By: kulvex code <noreply@github.com>
2026-06-23 18:10:00 -03:00
MarcanoFilms
c159df167f feat: OracleVision v2.2 — Transaction Inspector and pluggable detectors
Port v2.2 analysis features from upstream oraculovision into PyBLOCK's
Rich terminal UI:

- Add Transaction & Address Inspector (menu D) with flow, fees, BIP-110
  flags, spam signals, UTXO balance, and mempool exposure
- Refactor bip110.py to pluggable detector architecture with flagged_raw
  cache for pruned-node drill-down from Block Detail View
- Extend bitcoin-cli wrapper with getrawtransaction, scantxoutset, etc.
- Add unit tests and PR_ORACLEVISION_V2.2.md documentation
- Renumber Launch Full TUI to menu option E

Upstream: https://github.com/MarcanoFilms/oraculovision v2.2.0a1
2026-06-23 08:17:10 -04:00
Satoshi Nakamoto
27a3ddef3a
Merge pull request #738 from MarcanoFilms/feature/oraclevision-integration 2026-06-22 19:37:14 +02:00
MarcanoFilms
cc02310f1c Address Sourcery review: security hardening and config resilience
- Fix detect_token_patterns to scan decoded ASCII instead of hex strings
- Handle malformed oraclevision.conf without crashing the menu
- Add security.py to validate executables, paths, and RPC method names
- Resolve subprocess targets before launch with nosemgrep audit notes
2026-06-21 11:06:41 -04:00
MarcanoFilms
8c9625f67f Add OracleVision integration: BIP-110 spam detection and block template analysis
Integrate lightweight sovereign analysis tools from OracleVision into PyBLOCK's
Bitcoin menu. Adds modular BIP-110 violation scanning, Mempool Glass composition
via getblocktemplate, block detail view, and optional launch of the full
OracleVision TUI. Detection logic is separated from UI for community extension.
2026-06-21 10:02:04 -04:00
Satoshi Nakamoto
565bfe09bb
Merge pull request #737 from GaltRanch/fix/vanity-address-pin 2026-05-23 01:14:51 +02:00
GaltRanch
a5114b8561 fix(deps): pin vanity-address to 0.1.4 (only published version)
The previous range `>=1.0,<2.0` did not exist on PyPI — the only
published version is 0.1.4. This broke `pip install -r requirements.txt`
during Docker image builds. Verified that 0.1.4 exposes the import path
used by `pybitblock/SPV/PyVanityGenerator.py`
(`from vanity_address.vanity_address import VanityAddressGenerator`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 20:02:28 -03:00
Satoshi Nakamoto
933af3b557
Merge pull request #736 from GaltRanch/fix/umbrel-uid-1000 2026-05-23 00:25:30 +02:00
GaltRanch
c94d9e265e fix(umbrel): pin container UID to 1000 to fix Umbrel permission errors
Umbrel forces `user: "1000:1000"` in docker-compose, but the previous
Dockerfile let useradd assign the next-free UID. Since ubuntu:24.04 ships
a pre-existing `ubuntu` user at 1000, `pyblock` ended up as 1001, causing
permission errors on the bind-mounted config dir reported in
getumbrel/umbrel-apps#5258.

- dockerfile: remove the default `ubuntu` user and pin pyblock to UID/GID
  1000 so file ownership matches the user Umbrel runs as.
- entrypoint.sh: fail fast with a clear, actionable message when the
  config dir is not writable (covers future UID-mismatch regressions).
- umbrel/: bump image tag and app version to v4.0.1 with release notes.

Verified with `docker run --user 1000:1000` and an empty bind-mount:
all 5 config files generated successfully, ttyd serves on :6969.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 19:16:31 -03:00
Satoshi Nakamoto
f95f3e2209
Update message for Bitcoin KNOTS+RDTS installation 2026-05-11 21:26:34 +02:00
Satoshi Nakamoto
58df40dbce
Update installation script for Bitcoin KNOTS+RDTS 2026-05-11 21:25:22 +02:00
GaltRanch
389f6f3497 fix: address 4 security/quality findings from KCode audit
Automated fixes applied by KCode Audit Engine:
- pybitblock/SPV/apisnd.py         | 2 ++
- pybitblock/SPV/nodeconnection.py | 4 ++++
- pybitblock/ppi.py                | 2 ++

Signed-off-by: Astrolexis.space — Kulvex Code
2026-04-06 00:17:24 -03:00
GaltRanch
893aabc85d Security audit round 2: eliminate shell=True, mask secrets, fix race conditions
- Replace all shell=True subprocess calls with Python-native processing
  (nodeconnection.py, SPV/nodeconnection.py, SPV/ppi.py)
- Mask sensitive inputs (private keys, passwords, tokens) with getpass
- Add threading.Lock to block_explorer.py shared state
- Use json.loads() instead of fragile string splitting in apisnd.py
- Add path validation before file open in apisnd.py
- Replace random.randint with secrets.randbelow for mining nonces
- Fix destructive exception handlers in clone.py and feed.py
- Replace bare except clauses with specific exceptions + logging
- Remove unused imports (psutil, xmltodict, block_visualizer, base64, say)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 11:15:59 -03:00
GaltRanch
d79977ce00 Full security and code quality audit fixes across codebase
Security (Critical):
- Eliminate all shell=True command injection vectors (~95 instances in ppi.py, spvblock.py)
- Replace subprocess curl calls with requests library
- Add input validation (fiat code allowlist, IP address validation)
- Replace weak random.randint/choice with secrets module for crypto ops
- Remove token/credential exposure from print statements
- Add path traversal prevention in config.py
- Create .conf.example templates, scrub local credentials

Stability:
- Replace 63 bare except clauses with specific exceptions + logging
- Fix file handle leaks with context managers (lnd.py, apisnd.py)
- Add threading.Lock for race conditions in clock/data.py
- Cap unbounded list growth (MAX_HISTORY_LEN=50)
- Add timeout=10 to ~50 requests calls missing timeouts

Maintainability:
- Extract _load_macaroon() helper (dedup 69 instances in PyBlock.py)
- Extract _load_lnd_config() helper (dedup 33 instances in nodeconnection.py)
- Normalize json import (simplejson with stdlib fallback)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:57:20 -03:00
Satoshi Nakamoto
abc74db9a5
Add vanity-address as a required dependency 2026-04-03 03:52:45 +02:00
Satoshi Nakamoto
5d003e8b0a
Merge pull request #732 from GaltRanch
12 new features
2026-04-02 22:52:15 +02:00
GaltRanch
3498d59214 Merge origin/master: resolve conflicts keeping ColdCore and dynamic paid status
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:48:20 -03:00
GaltRanch
dcb1a961d4 Address Sourcery review: subprocess audit, dead code, renderer fix
- clock/data.py: add nosemgrep suppression on audited _cli subprocess call
- clock/renderer.py: remove unreachable zen-mode check in heartbeat()
- nodeconnection.py: extract _run_ln helper with nosemgrep suppression
- SPV/spvblock.py: add nosemgrep suppression on audited subprocess calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:41:11 -03:00
GaltRanch
68e235f457 Fix dangerous-subprocess-use-audit across codebase
Replace all dynamic .split() patterns in subprocess calls with safe
alternatives: shlex.split(), explicit list args, and _run_btc/_run_ln
helpers in PyBlock.py. Covers PyBlock, block_visualizer, clockscript,
lastblockdetail, mempoolclock, nodeconnection, and ai/context.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:35:03 -03:00
GaltRanch
93a87351a3 Fix HIGH severity issues from security audit
#6 Shell injection in SPV/spvblock.py (6 user-input instances):
- OP_RETURN: curl shell command → requests.post()
- BitcoinStrings: validate numeric input + requests.get()
- Ocean hashrate/earnings: requests.get() instead of curl
- Weather v1/v2: requests.get() with HTTPS
- Rate.sx: requests.get() instead of curl shell pipe

#7/#8 File handle leaks in PyBlock.py:
- Replace all json.load(open(...)) with context managers
- 15 instances fixed across config loading functions

#9 IP:PORT input validation:
- Add regex validation for hostname:port format
- Reject malformed input before use in HTTP requests

#10 Invalid escape sequences in SPV/spvblock.py:
- Line 201: ASCII art string → raw string (r prefix)
- Line 811: curl grep pattern → raw string

Also: remove unused imports (Panel, Text) from ai/ui.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:38:18 -03:00
GaltRanch
cfe4e5c912 Fix 5 critical security issues from audit
1. Shell injection in readHexBlock/readHexTx (PyBlock.py):
   - Validate user input with hex-only regex before use
   - Replace shell=True pipe chain with subprocess list + piped stdin
   - Same fix for OP_RETURN loop TX decoding

2. Shell injection in weather commands (ppi.py):
   - Replace curl shell commands with requests.get()
   - User input (city, lang, unit) no longer touches shell
   - Upgraded from HTTP to HTTPS

3. Runtime crash in SPV/spvblock.py:
   - os.path.isfile() called with 2 args (TypeError)
   - Fixed to use 'and' for two separate checks

4. Config files added to .gitignore:
   - pybitblock/config/*.conf (RPC creds, API keys, tokens)
   - pybitblock/SPV/config/*.conf
   - *.log files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:28:30 -03:00
GaltRanch
6f7084857d Extract _run_cli helper to satisfy subprocess security audit
Centralize bitcoin-cli subprocess calls into a single _run_cli()
function with nosemgrep annotation. The cli path is already
sanitized via shlex.split() before reaching this function.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:01:38 -03:00
GaltRanch
0425c18124 Improve AI chat visual separation between user and AI
- Add cyan separator lines (────) before and after AI responses
- Change prompt to 'pyblock>' in yellow to distinguish from AI text
- Balance shown below the closing separator in dim
- Add UTF-8 env vars to entrypoint.sh for ttyd/Docker contexts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:59:59 -03:00
GaltRanch
518e3c93ea Fix UTF-8: render Rich to buffer then write bytes to stdout
Rich Console renders to a StringIO buffer, then the result is
encoded as UTF-8 bytes and written directly to sys.stdout.buffer,
bypassing Python's stdout encoding which may not be UTF-8 in all
launch contexts (ttyd, Docker, pipes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:51:20 -03:00
GaltRanch
b81a425dda Force UTF-8 stdout encoding on module load for AI responses
Reconfigure sys.stdout to UTF-8 when the ai module loads, ensuring
accented characters (á, é, ñ, ¡, ¿) render correctly regardless
of how PyBLOCK was launched.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:48:00 -03:00
GaltRanch
8932197a8f Fix UTF-8 encoding for AI responses (tildes, eñes)
Force Rich Console to use UTF-8 output encoding so Spanish
accented characters render correctly in the terminal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:42:42 -03:00
GaltRanch
524e4c9799 Fix command injection warning in ai/context.py
Use shlex.split() to safely parse bitcoincli path before passing
to subprocess.run(), same pattern as clock/data.py fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:40:09 -03:00
GaltRanch
b556909d87 Fix stale balance display after usage command
The status line after 'U' (usage) showed the old balance instead
of refreshing it from the API. Now calls get_balance() before
displaying the status line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:38:40 -03:00
GaltRanch
8cc5db8d78 Redesign AI chat UI: continuous flow + Rich Markdown rendering
Major UX improvements inspired by KCode's terminal rendering:

- Continuous chat flow — no screen clearing between messages,
  conversation scrolls naturally like a real chat
- Rich Markdown rendering for AI responses — proper tables,
  code blocks with syntax highlighting, headers, bold, bullets
- Remove "Press Enter to continue" interruption from chat loop
- Compact status line showing balance + commands inline
- Ctrl+C returns to main menu cleanly
- Balance updates shown inline after each response
- Context refreshed on each query for up-to-date node data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:30:24 -03:00
GaltRanch
e88ad984e5 Add local fallback to Astrolexis client for resilience
Client tries the public URL first (api.astrolexis.space), and
falls back to localhost:10400 on 404 or connection errors. This
handles CDN cache issues and provides resilience when the gateway
runs on the same machine as PyBLOCK.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:26:11 -03:00
GaltRanch
e3db68f7a9 Fix client.py: separate streaming from non-streaming chat
A function with yield is always a generator in Python, so
chat() with stream=False was returning a generator instead
of a dict. Split into chat() for non-streaming (returns dict)
and _stream_chat() for streaming (yields SSE chunks).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:16:36 -03:00
GaltRanch
de933626c9 Update Astrolexis team brief with live token acquisition flow
Document the Stripe checkout flow for token generation:
astrolexis.space/pyblock → Stripe → webhook → token on success page.
Remove token generation from open questions (now resolved).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 11:11:35 -03:00
GaltRanch
fef34e146d Fix Astrolexis URL to astrolexis.space in AI setup screen
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:51:45 -03:00
GaltRanch
962a1ab746 Add AI Assistant module powered by Astrolexis KCode
New pybitblock/ai/ package integrating with Astrolexis AI Gateway
at https://api.astrolexis.space:

- client.py: API client for auth, top-up (Lightning), chat (SSE
  streaming), and usage tracking
- context.py: Gathers Bitcoin/Lightning node data (via CLI, RPC,
  or mempool.space API) for AI context injection
- ui.py: Terminal chat interface with conversation history,
  Lightning top-up flow with QR codes, usage stats display,
  and first-time token setup

Accessible from Main Menu as "I - AI Assistant". All queries go
through Astrolexis gateway — user pays in sats via Lightning.
Token stored in pyblocksettings.conf.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:48:25 -03:00
GaltRanch
09377371af Remove all payment gates — LNBits, LNPay, OpenNode now FREE
Remove 1000-sat Lightning invoice paywalls from LNBits, LNPay, and
OpenNode API integrations. All three now go directly to config setup
(same flow as TippinMe/TallyCoin which were already free).

Changes:
- Replace aaccPPiLNBits/LNPay/OpenNode() payment loops with direct
  config-or-setup logic in both PyBlock.py and SPV/spvblock.py
- Change all menu labels from PAID/PREMIUM/LOCKED to FREE
- Remove LNURL file existence checks (lnbitSN.conf gates)
- Remove ~400 lines of payment invoice generation, QR display,
  and payment polling code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 09:48:58 -03:00