Skip to content

Krishna2918/rustchain-export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

RustChain Data Export Tool

Export attestation and reward data from RustChain to standard formats (CSV, JSON, JSONL) for analysis, reporting, and compliance.

Installation

# Clone the repository
git clone https://github.com/Krishna2918/rustchain-export.git
cd rustchain-export

# Install dependencies
pip install httpx

# Optional: Install rustchain-sdk for better integration
pip install git+https://github.com/Krishna2918/rustchain-sdk.git

Usage

Basic Export

# Export all data to CSV
python rustchain_export.py --format csv --output ./data

# Export to JSON
python rustchain_export.py --format json --output ./data

# Export to JSONL (one record per line)
python rustchain_export.py --format jsonl --output ./data

Date Range Filtering

# Export data from a specific date range
python rustchain_export.py --format csv --from 2025-12-01 --to 2026-02-01

Selective Export

# Export only miners
python rustchain_export.py --miners-only

# Export only balances
python rustchain_export.py --balances-only

# Export specific tables
python rustchain_export.py --tables miners,balances,epochs

Custom Node

# Use a different RustChain node
python rustchain_export.py --node https://custom-node.com --format csv

Output Files

File Description
miners.csv All miner IDs, architectures, last attestation, total earnings
epochs.csv Epoch number, timestamp, pot size, settlement status
rewards.csv Per-miner per-epoch reward amounts
attestations.csv Attestation log (miner, timestamp, device info)
balances.csv Current RTC balances

Example Output

miners.csv

miner_id,hardware_type,multiplier,last_seen,blocks_mined
eafc6f14...,PowerPC G4 (Vintage),2.5,1770078232,100
modern-sophia...,x86-64 (Modern),0.8,1770078201,50

epochs.json

[
  {
    "epoch": 62,
    "started_at": "2026-02-01T00:00:00Z",
    "ends_at": "2026-02-08T00:00:00Z",
    "block_height": 15000
  }
]

Features

  • ✅ Multiple output formats: CSV, JSON, JSONL
  • ✅ Date range filtering
  • ✅ Works with RustChain SDK or standalone
  • ✅ Handles self-signed SSL certificates
  • ✅ Streaming export for large datasets
  • ✅ Proper CSV escaping and headers

API vs Database Mode

This tool operates in API mode by default, fetching data from the public RustChain node API. This is sufficient for most use cases.

For full database access (all historical data), you would need direct SQLite access to the node.

Requirements

  • Python 3.8+
  • httpx (or rustchain-sdk)

License

MIT License

Links

About

RustChain Data Export Tool - CSV/JSON/JSONL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages