6 Commits

Author SHA1 Message Date
ncantu
970b06ee8f Fix: Automatic UTXO provisioning on each Bitcoin anchor transaction
**Motivations:**
- Fix insufficient UTXO amount error in anchor API
- Ensure continuous availability of usable UTXOs for anchor transactions
- Improve anchor transaction reliability and efficiency

**Root causes:**
- UTXO selection logic was too restrictive, rejecting UTXOs larger than needed
- No automatic provisioning of new usable UTXOs when existing ones were not suitable
- Algorithm prevented efficient use of available UTXOs

**Correctifs:**
- Refactored createAnchorTransaction() to provision 7 UTXOs of 2500 sats on each anchor
- Use single large UTXO to create 1 anchor output + 7 provisioning outputs + change
- Simplified UTXO selection: single large UTXO per transaction instead of multiple small ones
- Added UTXO provisioning logic in signet-dashboard
- Enhanced Bitcoin RPC methods in both api-anchorage and signet-dashboard
- Added documentation in fixKnowledge/api-anchorage-utxo-provisioning.md

**Evolutions:**
- Enhanced signet-dashboard with new pages (hash-list, utxo-list, join-signet, api-docs)
- Improved Bitcoin RPC client with better error handling and UTXO management
- Added cache files for hash and UTXO lists
- Updated api-faucet with improved server configuration
- Enhanced anchor count tracking

**Pages affectées:**
- api-anchorage/src/bitcoin-rpc.js: Complete refactor of createAnchorTransaction()
- api-anchorage/src/routes/anchor.js: Enhanced anchor route
- api-anchorage/src/server.js: Server configuration updates
- signet-dashboard/src/bitcoin-rpc.js: Added comprehensive Bitcoin RPC client
- signet-dashboard/src/server.js: Enhanced server with new routes
- signet-dashboard/public/: Added new HTML pages and updated app.js
- api-faucet/src/server.js: Server improvements
- api-faucet/README.md: Documentation updates
- fixKnowledge/api-anchorage-utxo-provisioning.md: New documentation
- anchor_count.txt, hash_list.txt, utxo_list.txt: Tracking files
2026-01-25 14:25:49 +01:00
ncantu
b3973ddc41 Add transaction statistics endpoints and systemd services
**Motivations:**
- Add transaction statistics endpoints (avg-fee, avg-amount) for dashboard display
- Fix difficulty parsing issue when Bitcoin RPC returns string instead of number
- Add systemd service files for proper service management
- Update dashboard UI to display transaction statistics

**Root causes:**
- Bitcoin RPC can return difficulty as string, causing type issues
- Missing API endpoints for transaction statistics in dashboard

**Correctifs:**
- Fix difficulty parsing to handle both string and number types
- Add proper type conversion for blockchainInfo.difficulty

**Evolutions:**
- Add /api/transactions/avg-fee endpoint returning fixed 1200 sats fee
- Add /api/transactions/avg-amount endpoint returning fixed 1000 sats amount
- Add systemd service files for api-faucet and signet-dashboard
- Enhance dashboard UI with transaction statistics display
- Update anchor_count.txt

**Pages affectées:**
- signet-dashboard/src/server.js
- signet-dashboard/public/app.js
- signet-dashboard/public/index.html
- signet-dashboard/signet-dashboard.service
- api-faucet/faucet-api.service
- anchor_count.txt
2026-01-25 03:55:26 +01:00
ncantu
21438530a1 Update anchor count, API anchorage, mempool submodule and signet dashboard
**Motivations:**
- Update anchor count tracking
- Improve API anchorage Bitcoin RPC handling
- Update mempool submodule
- Enhance signet dashboard functionality and UI

**Root causes:**
- N/A (evolutions and updates)

**Correctifs:**
- N/A

**Evolutions:**
- Updated anchor count tracking
- Enhanced Bitcoin RPC handling in API anchorage
- Updated mempool submodule to latest version
- Added new features and improvements to signet dashboard (app.js, server.js)
- Enhanced signet dashboard UI (index.html, styles.css)

**Pages affectées:**
- anchor_count.txt
- api-anchorage/src/bitcoin-rpc.js
- api-anchorage/src/bitcoin-rpc.js.backup
- mempool (submodule)
- signet-dashboard/public/app.js
- signet-dashboard/public/index.html
- signet-dashboard/public/styles.css
- signet-dashboard/src/server.js
2026-01-25 02:37:58 +01:00
ncantu
e34b6ee43a Fix UTXO selection and race condition in anchorage API
**Motivations:**
- Resolve insufficient UTXO amount errors when wallet has many small UTXOs
- Prevent race conditions when multiple anchor requests arrive simultaneously
- Improve signet dashboard functionality and documentation

**Root causes:**
- API tried to find a single UTXO large enough instead of combining multiple UTXOs
- No mutex mechanism to prevent concurrent transactions from using the same UTXOs
- UTXOs in mempool still appear as available in listunspent before block confirmation

**Correctifs:**
- Implement coin selection algorithm to combine multiple UTXOs when needed
- Add mutex-based locking mechanism to serialize UTXO access
- Filter locked UTXOs during selection to prevent double spending
- Properly handle change output when combining multiple UTXOs
- Lock UTXOs during transaction creation and unlock after mempool broadcast

**Evolutions:**
- Enhance signet dashboard with improved Bitcoin RPC integration
- Update mempool documentation
- Add comprehensive fix documentation in fixKnowledge/

**Pages affectées:**
- api-anchorage/src/bitcoin-rpc.js
- signet-dashboard/src/bitcoin-rpc.js
- signet-dashboard/src/server.js
- signet-dashboard/public/app.js
- signet-dashboard/public/index.html
- signet-dashboard/public/styles.css
- signet-dashboard/start.sh
- docs/MEMPOOL.md
- fixKnowledge/api-anchorage-insufficient-utxo.md (new)
- fixKnowledge/api-anchorage-utxo-race-condition.md (new)
- anchor_count.txt (new)
- mempool (submodule update)
2026-01-25 01:21:18 +01:00
ncantu
dde1ccbb07 fix: Improve .env loading and add backup/startup scripts
**Motivations:**
- Fix 401 error on anchorage API due to .env not being loaded correctly
- Fix 502 error on dashboard due to service not running
- Add backup script for mining keys and wallet descriptors
- Improve service management with startup scripts and systemd services

**Root causes:**
- dotenv.config() was called without explicit path, causing .env to be loaded from wrong directory
- Services were not started automatically, causing 502 errors
- No backup mechanism for critical keys and wallet data

**Correctifs:**
- Improved .env loading in api-anchorage/src/server.js with explicit path
- Improved .env loading in signet-dashboard/src/server.js with explicit path
- Added backups/ directory to .gitignore to prevent committing sensitive data
- Created export-backup.sh script for backing up mining keys and wallet descriptors

**Evolutions:**
- Added api-anchorage/start.sh script for proper service startup
- Added api-anchorage/anchorage-api.service systemd service file
- Added fixKnowledge/api-anchorage-401-error.md documentation
- Added fixKnowledge/dashboard-502-error.md documentation
- Updated mempool submodule

**Pages affectées:**
- .gitignore (added backups/)
- api-anchorage/src/server.js (improved .env loading)
- api-anchorage/start.sh (new)
- api-anchorage/anchorage-api.service (new)
- signet-dashboard/src/server.js (improved .env loading)
- export-backup.sh (new)
- fixKnowledge/api-anchorage-401-error.md (new)
- fixKnowledge/dashboard-502-error.md (new)
- mempool (submodule updated)
2026-01-24 03:17:48 +01:00
ncantu
20d115a31c feat: Add APIs, dashboard, documentation and improve scripts
**Motivations:**
- Add API services for anchorage and faucet functionality
- Add dashboard interface for signet monitoring
- Improve documentation and maintenance guides
- Enhance existing scripts for better functionality

**Root causes:**
- Need for API services to interact with Bitcoin Signet
- Need for user-friendly dashboard interface
- Need for comprehensive documentation
- Scripts required improvements for better reliability

**Correctifs:**
- Updated Dockerfile with better configuration
- Improved gen-bitcoind-conf.sh and gen-signet-keys.sh scripts
- Enhanced mine.sh, miner, run.sh, and setup-signet.sh scripts
- Updated env.example with new configuration options

**Evolutions:**
- Added api-anchorage service with anchor functionality
- Added api-faucet service for testnet coin distribution
- Added signet-dashboard for monitoring and management
- Added comprehensive documentation in docs/ directory
- Added configure-nginx-proxy.sh for proxy configuration
- Added update-signet.sh for signet updates
- Added ETAT_SYSTEME.md and START_DASHBOARD_AND_FAUCET.md guides
- Added .bitcoin-version file for version tracking

**Pages affectées:**
- Dockerfile
- env.example
- gen-bitcoind-conf.sh
- gen-signet-keys.sh
- mine.sh
- miner
- run.sh
- setup-signet.sh
- api-anchorage/ (new)
- api-faucet/ (new)
- signet-dashboard/ (new)
- docs/ (new)
- configure-nginx-proxy.sh (new)
- update-signet.sh (new)
- ETAT_SYSTEME.md (new)
- START_DASHBOARD_AND_FAUCET.md (new)
- .bitcoin-version (new)
- .env (modified)
- mempool/ (added)
2026-01-24 02:40:25 +01:00