# rustchain-client
A Rust HTTP client library for the [RustChain](https://rustchain.org) Proof-of-Antiquity blockchain API.
RustChain is the first blockchain that rewards vintage hardware (PowerPC G4, IBM POWER8, Pentium 4, etc.) for being old — not fast. This crate provides a typed, async Rust client for querying the RustChain node API.
## Features
- **Node Health** — check node status, uptime, version, and peer count
- **Epoch Info** — get current epoch number, duration, reward pool, and attestation count
- **Miners** — list active miners with hardware architecture and antiquity multipliers
- **Wallet Balance** — check any wallet's RTC balance and earnings history
- **Attestation** — submit hardware fingerprint attestations
- **Governance** — list proposals, get details, and submit signed votes
- **Agent Economy** — list open jobs from the RIP-302 Agent Economy marketplace
- **Self-signed certs** — supports nodes using self-signed TLS certificates
- **No OpenSSL** — uses `rustls` for TLS, works on all platforms without system dependencies
## Quick Start
Add to your `Cargo.toml`:
```toml
[dependencies]
rustchain-client = "0.1"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```
### Example: Check Node Health and List Miners
```rust
use rustchain_client::RustChainClient;
#[tokio::main]
async fn main() -> Result<(), rustchain_client::Error> {
// Connect to the main RustChain node
let client = RustChainClient::new("https://rustchain.org")?;
// Check node health
let health = client.health().await?;
println!("Status: {}", health.status);
if let Some(v) = &health.version {
println!("Version: {}", v);
}
// Get current epoch
let epoch = client.epoch().await?;
println!("Epoch: {} (reward pool: {:?} RTC)", epoch.epoch, epoch.reward_pool);
// List active miners
let miners = client.miners().await?;
for miner in &miners {
println!(
" {} — {} ({}×)",
miner.wallet,
miner.architecture.as_deref().unwrap_or("unknown"),
miner.multiplier.unwrap_or(1.0)
);
}
Ok(())
}
```
### Example: Check Wallet Balance
```rust
use rustchain_client::RustChainClient;
# async fn example() -> Result<(), rustchain_client::Error> {
let client = RustChainClient::new("https://rustchain.org")?;
let balance = client.wallet_balance("nox-ventures").await?;
println!("Balance: {} RTC", balance.balance);
# Ok(())
# }
```
### Example: List Agent Economy Jobs
```rust
use rustchain_client::RustChainClient;
# async fn example() -> Result<(), rustchain_client::Error> {
let client = RustChainClient::new("https://50.28.86.131")?;
let jobs = client.agent_jobs().await?;
println!("Open jobs: {}", jobs.jobs.len());
for job in &jobs.jobs {
println!(" {} — {:?} RTC", job.job_id, job.reward_rtc);
}
# Ok(())
# }
```
### Example: List Governance Proposals
```rust
use rustchain_client::RustChainClient;
# async fn example() -> Result<(), rustchain_client::Error> {
let client = RustChainClient::new("https://rustchain.org")?;
let proposals = client.proposals().await?;
for p in &proposals {
println!("#{}: {} ({})", p.id, p.title, p.status.as_deref().unwrap_or("unknown"));
}
# Ok(())
# }
```
## API Coverage
| `/health` | GET | `health()` |
| `/epoch` | GET | `epoch()` |
| `/api/miners` | GET | `miners()` |
| `/wallet/balance` | GET | `wallet_balance(wallet)` |
| `/attest/submit` | POST | `submit_attestation(attestation)` |
| `/governance/proposals` | GET | `proposals()` |
| `/governance/proposal/{id}` | GET | `proposal(id)` |
| `/governance/vote` | POST | `vote(vote)` |
| `/agent/jobs` | GET | `agent_jobs()` |
## Node URLs
| Primary | `https://rustchain.org` | Main node + explorer |
| Direct IP | `https://50.28.86.131` | Same node, direct IP |
| Ergo Anchor | `https://50.28.86.153` | Ergo anchoring node |
## License
MIT — see [LICENSE](LICENSE) for details.
## Links
- [RustChain Website](https://rustchain.org)
- [Block Explorer](https://rustchain.org/explorer)
- [Bounties](https://github.com/Scottcjn/rustchain-bounties/issues)
- [GitHub](https://github.com/Scottcjn/Rustchain)
- [wRTC on Raydium](https://raydium.io/swap/?inputMint=sol&outputMint=12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X)