Skip to content

Comments

feat(miner): Add JSON output mode to clawrtc mine#352

Open
Tianlin0725 wants to merge 1 commit intoScottcjn:mainfrom
Tianlin0725:feature/json-output-mode
Open

feat(miner): Add JSON output mode to clawrtc mine#352
Tianlin0725 wants to merge 1 commit intoScottcjn:mainfrom
Tianlin0725:feature/json-output-mode

Conversation

@Tianlin0725
Copy link

Summary

Add --json flag to the universal miner that makes the miner output structured JSON instead of human-readable text. This lets other tools and scripts parse miner output programmatically.

Changes

  • Add --json and --dry-run flags to argparse
  • Create emit() helper method that outputs either JSON (JSONL format) or human-readable text based on json_mode flag
  • Update attestation and mining loop to use emit() instead of print()

Expected Behavior

# Normal output (unchanged)
$ clawrtc mine --wallet test
RustChain Universal Miner v2.3.0
Miner ID:    ...
Wallet:      ...
[12:34:56] Attestation: success

# JSON output (new)
$ clawrtc mine --wallet test --json --dry-run
{"event":"startup","timestamp":1234567890,"wallet":"test","node":"https://50.28.86.131","hardware":{"arch":"x86_64","family":"modern"}}
{"event":"ready","status":"dry-run complete"}

Related Issue

Closes #346 (GOOD FIRST ISSUE)

Add --json flag to enable structured JSON output (JSONL format) instead of
human-readable text. This enables integration with monitoring dashboards,
automated alerting, and data analysis tools.

Changes:
- Add --json and --dry-run flags to argparse
- Create emit() helper method that outputs either JSON or human text
- Update attestation and mining loop to use emit() instead of print()

Closes Scottcjn#346
@github-actions github-actions bot added the size/M PR: 51-200 lines label Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR: 51-200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GOOD FIRST ISSUE] Add JSON output mode to clawrtc mine (10 RTC)

1 participant