A clean, pip-installable Python SDK for interacting with the RustChain Proof-of-Antiquity blockchain network.
RustChain rewards real vintage hardware (PowerPC G4/G5, 68K Macs, SPARC, etc.) with higher mining multipliers than modern machines.
# From GitHub
pip install git+https://github.com/krishnadogra/rustchain-sdk.git
# Or clone and install locally
git clone https://github.com/krishnadogra/rustchain-sdk.git
cd rustchain-sdk
pip install -e .from rustchain import RustChainClient
# Connect to RustChain node
client = RustChainClient("https://50.28.86.131")
# Check node health
health = client.health()
print(f"Node status: {health.status}")
# Get all active miners
miners = client.get_miners()
for miner in miners:
print(f"{miner.miner_id}: {miner.hardware_type} (x{miner.multiplier})")
# Check wallet balance
balance = client.get_balance("your-wallet-id")
print(f"Balance: {balance.balance} RTC")
# Get current epoch
epoch = client.get_epoch()
print(f"Current epoch: {epoch.epoch}")
# Check lottery eligibility
eligibility = client.check_eligibility("your-wallet-id")
if eligibility.eligible:
print("You're eligible for the lottery! π")
# Clean up
client.close()from rustchain import RustChainClient
with RustChainClient("https://50.28.86.131") as client:
miners = client.get_miners()
print(f"Active miners: {len(miners)}")import asyncio
from rustchain import AsyncRustChainClient
async def main():
async with AsyncRustChainClient("https://50.28.86.131") as client:
# All methods are async
health = await client.health()
miners = await client.get_miners()
# Concurrent requests
balance, epoch = await asyncio.gather(
client.get_balance("wallet-1"),
client.get_epoch()
)
print(f"Balance: {balance.balance} RTC")
print(f"Epoch: {epoch.epoch}")
asyncio.run(main())from rustchain import RustChainClient
with RustChainClient("https://50.28.86.131") as client:
result = client.transfer(
from_wallet="your-wallet",
to_wallet="recipient-wallet",
amount=10.0,
private_key="your-private-key"
)
if result.success:
print(f"Transfer complete! TX: {result.tx_hash}")
else:
print(f"Transfer failed: {result.message}")from rustchain import RustChainClient
with RustChainClient("https://50.28.86.131") as client:
result = client.submit_attestation({
"miner_id": "your-miner-id",
"hardware_proof": "...",
"timestamp": "2026-02-02T19:00:00Z"
})
if result.success:
print(f"Attestation ID: {result.attestation_id}")The SDK includes a command-line interface:
# Check node health
rustchain-cli health
# List all miners
rustchain-cli miners
# Get wallet balance
rustchain-cli balance your-wallet-id
# Get current epoch
rustchain-cli epoch
# Check lottery eligibility
rustchain-cli eligibility your-wallet-id
# Use different node
rustchain-cli --node https://other-node.com miners
# JSON output
rustchain-cli --json minersclient = RustChainClient(
base_url="https://50.28.86.131",
verify_ssl=False, # Disable SSL verification (self-signed certs)
timeout=30.0, # Request timeout in seconds
max_retries=3, # Number of retry attempts
retry_delay=1.0, # Initial retry delay (exponential backoff)
)The default RustChain node uses a self-signed certificate. SSL verification is disabled by default. To enable:
client = RustChainClient("https://node.com", verify_ssl=True)| Method | Description | Returns |
|---|---|---|
health() |
Get node health status | HealthStatus |
get_miners() |
List all active miners | List[Miner] |
get_balance(miner_id) |
Get wallet balance | WalletBalance |
get_epoch() |
Get current epoch info | EpochInfo |
check_eligibility(miner_id) |
Check lottery eligibility | EligibilityStatus |
submit_attestation(payload) |
Submit attestation | AttestationResult |
transfer(from, to, amount, key) |
Transfer tokens | TransferResult |
HealthStatus: status, version, uptimeMiner: miner_id, hardware_type, multiplier, blocks_mined, balanceWalletBalance: miner_id, balance, pendingEpochInfo: epoch, started_at, ends_at, block_heightEligibilityStatus: miner_id, eligible, reasonAttestationResult: success, attestation_id, messageTransferResult: success, tx_hash, message
# Install dev dependencies
pip install -e ".[dev]"
# Run unit tests
pytest tests/ -v
# Run integration tests (requires live node)
pytest tests/ -v -m integration
# Run all tests with coverage
pytest tests/ -v --cov=rustchain- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
MIT License - see LICENSE for details.
- RustChain Network: https://50.28.86.131/explorer
- Main Repository: https://github.com/Scottcjn/Rustchain
- Bounties: https://github.com/Scottcjn/rustchain-bounties
Built with β€οΈ for the RustChain community