/api/coins/break-isolated
POST FULLY IMPLEMENTEDIsolated break coins troubleshooting workflow with extensive step-by-step logging to identify break coin failures.
✅ TROUBLESHOOTING WORKFLOW
This is an isolated implementation created specifically for troubleshooting break coin failures.
Key features:
- ✓ Completely isolated from existing break code (no modifications to working systems)
- ✓ Extensive logging to console and main.log at every step
- ✓ Per-RAIDA success/failure tracking (shows exactly which RAIDAs succeeded/failed)
- ✓ Histogram-based SN consensus analysis with detailed display
- ✓ Up to 10 iterations to ensure exact change is available
- ✓ Automatic grading when workflow completes
Use this endpoint when: Regular break operations are failing and you need detailed diagnostics to identify the failure point.
Description
This endpoint implements a completely isolated break coins workflow designed for troubleshooting. When regular break operations fail, this workflow provides extensive logging at every step to help identify exactly where and why the failure occurs.
The workflow attempts to make exact change for a target amount by:
- Checking if exact change can be made with existing coins (greedy algorithm)
- If not, finding a coin to break (largest denomination needed)
- Getting 10 available serial numbers from RAIDA (Get SNs 0x5B command)
- Breaking the coin into 10 smaller pieces (Break 0x5C command)
- Writing new coins to Grade folder with POWN strings
- Repeating until exact change is available (max 10 iterations)
- Running Grade command to move coins to final folders
Workflow Steps (Logged in Detail)
Step-by-Step Execution
=== [Step 1] Checking if breaks needed ===
Target amount: 250.000000 units (250000000 microunits)
Scanning Bank and Fracked folders...
→ Exact change available: NO
→ Need to break denomination: 6 (1000000 units)
=== [Step 2] Finding coin to break ===
Looking for denomination: 6
→ Found coin: 1000.bin
=== [Step 3] Getting available serial numbers ===
Original coin: SN=12345, Denom=6
Session ID: abc123...
Sending Get SNs requests to 25 RAIDAs...
→ RAIDA 0: 50 SNs available - SUCCESS
→ RAIDA 1: 50 SNs available - SUCCESS
[... per-RAIDA results ...]
→ 25 RAIDAs responded, building consensus histogram...
→ Top 10 SNs selected (13+ RAIDA agreement required)
=== [Step 4] Breaking coin into 10 pieces ===
Original: SN=12345, Denom=6 → 10 coins Denom=5
Sending Break requests to 25 RAIDAs...
→ RAIDA 0: SUCCESS (copied PAN→AN)
→ RAIDA 1: SUCCESS (copied PAN→AN)
[... per-RAIDA results ...]
→ 25/25 RAIDAs succeeded
=== [Step 5] Writing coins to Grade folder ===
Writing 10 new coins...
→ Coin 1: SN=54321, POWN=ppppppppppppppppppppppppp
[... all 10 coins ...]
### Iteration 1 complete - checking if exact change available...
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
wallet_path |
string | Yes | Absolute path to wallet directory (e.g., D:/Data/Wallets/Default or E:\Data\Wallets\MyWallet). The wallet must have Bank and Fracked folders with coins. |
amount |
number | Yes | Target amount in CloudCoin units (e.g., 250 for 250 CC). The workflow will break coins until this exact amount can be made. Converted to microunits internally (1 unit = 1,000,000 microunits). |
Response
Success Response
200 OK
{
"success": true,
"operation": "coins-break-isolated",
"message": "Isolated break workflow completed successfully",
"wallet_path": "D:/Data/Wallets/Default",
"target_amount": 250.0,
"note": "Check main.log for detailed step-by-step logging"
}
Error Response
400 Bad Request
{
"error": true,
"operation": "coins-break-isolated",
"message": "Isolated break workflow failed",
"wallet_path": "D:/Data/Wallets/Default",
"target_amount": 250.0,
"error_code": 450,
"note": "Check main.log for detailed error information"
}
Examples
cURL Example
curl -X POST "http://localhost:8080/api/coins/break-isolated?wallet_path=D:/Data/Wallets/Default&amount=250"
JavaScript (fetch) Example
const walletPath = 'D:/Data/Wallets/Default';
const targetAmount = 250;
fetch(`http://localhost:8080/api/coins/break-isolated?wallet_path=${encodeURIComponent(walletPath)}&amount=${targetAmount}`, {
method: 'POST'
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('Break workflow completed successfully');
console.log('Check main.log for detailed logging');
} else {
console.error('Break workflow failed:', data.message);
}
});
Logging Output
All execution details are logged to:
- Console: Real-time progress with section headers (
===) and iteration markers (###) - main.log: Complete step-by-step details including:
- Greedy algorithm decisions
- Per-RAIDA request/response status
- Histogram consensus analysis
- Serial number selection details
- POWN string building process
- File write operations
Notes
- This is a troubleshooting-only endpoint - use regular
/api/coins/breakfor production - Maximum 10 iterations - if exact change cannot be made after 10 breaks, the workflow fails
- Original coins are moved to Change folder (not deleted) for safety
- New coins are written to Grade folder, then graded automatically
- All RAIDA operations use parallel thread pool (1-2 seconds for 25 RAIDAs)
- Requires 13+ RAIDA consensus for serial number selection
- Check
Data/main.logfor complete diagnostic information