Skip to content

Comments

feat: Add --json flag for JSONL output mode (Issue #346)#351

Closed
Tianlin0725 wants to merge 1 commit intoScottcjn:mainfrom
Tianlin0725:main
Closed

feat: Add --json flag for JSONL output mode (Issue #346)#351
Tianlin0725 wants to merge 1 commit intoScottcjn:mainfrom
Tianlin0725:main

Conversation

@Tianlin0725
Copy link

Summary

Added --json flag to the RustChain miner that enables JSONL (JSON Lines) output format. This allows other tools and scripts to parse miner output programmatically.

Changes

  • Added --json command line argument to rustchain_linux_miner.py
  • Added emit() function that handles both human-readable and JSON output modes
  • Key events now emit JSON objects:
    • startup: Wallet, node, serial info
    • fingerprint: Check status and results
    • attestation: Success/failure with details
    • balance: Current balance
    • mining: Start, progress, and stop events
    • cycle: Cycle number and timestamp

Example Usage

# Normal output (human-readable)
python3 rustchain_linux_miner.py --wallet test

# JSON output
python3 rustchain_linux_miner.py --wallet test --json
# Output:
# {"event": "startup", "wallet": "...", "node": "...", "serial": "..."}
# {"event": "fingerprint", "status": "running", "total_checks": 6}
# {"event": "fingerprint", "status": "passed", "checks_passed": 6, "checks_total": 6}

Benefits

  • Enables integration with monitoring dashboards
  • Allows automated alerting based on miner events
  • Facilitates data analysis of mining patterns
  • Supports integration with other tools and scripts

/claim #346

- Added --json command line flag to enable JSONL output
- Added emit() function to handle both human-readable and JSON output
- Key events now emit JSON: startup, fingerprint, attestation, balance, mining progress
- Each JSON line is a valid JSON object for easy parsing by other tools

Implements: Scottcjn#346
@github-actions github-actions bot added the size/M PR: 51-200 lines label Feb 22, 2026
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Your PR has a BCOS-L1 or BCOS-L2 label
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@sophiaeagent-beep
Copy link
Owner

Closing as duplicate — you submitted the same feature in #352 which is the better version. Please focus on #352.

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.

2 participants