Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 5 additions & 74 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ New to RustChain? Get 10 RTC for your **first merged PR** — even for small imp

## What Gets Merged

- Code that works against the live node (`https://rustchain.org`)
- Code that works against the live node (`https://50.28.86.131`)
- Tests that actually test something meaningful
- Documentation that a human can follow end-to-end
- Security fixes with proof of concept
Expand All @@ -80,82 +80,13 @@ python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# Test against live node
curl -sk https://rustchain.org/health
curl -sk https://rustchain.org/api/miners
curl -sk https://rustchain.org/epoch
curl -sk https://50.28.86.131/health
curl -sk https://50.28.86.131/api/miners
curl -sk https://50.28.86.131/epoch
```

## Live Infrastructure

| Endpoint | URL |
|----------|-----|
| Node Health | `https://rustchain.org/health` |
| Active Miners | `https://rustchain.org/api/miners` |
| Current Epoch | `https://rustchain.org/epoch` |
| Block Explorer | `https://rustchain.org/explorer` |
| wRTC Bridge | `https://bottube.ai/bridge` |

## RTC Payout Process

1. PR gets reviewed and merged
2. We comment asking for your wallet address
3. RTC is transferred from the community fund
4. Bridge RTC to wRTC (Solana) via [bottube.ai/bridge](https://bottube.ai/bridge)
5. Trade on [Raydium](https://raydium.io/swap/?inputMint=sol&outputMint=12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X)


## Documentation Quality Checklist

Before opening a docs PR, please verify:

- [ ] Instructions work exactly as written (commands are copy-pastable).
- [ ] OS/architecture assumptions are explicit (Linux/macOS/Windows).
- [ ] New terms are defined at first use.
- [ ] Broken links are removed or corrected.
- [ ] At least one `example` command/output is updated if behavior changed.
- [ ] File and section names follow existing naming conventions.

## Common Troubleshooting Entries

If you changed setup or CLI docs, add at least one section covering common failures, for example:

- `Command not found`: verify PATH and virtualenv activation.
- `Permission denied` on scripts: ensure execute bit and shell compatibility.
- `Connection error to live node`: include curl timeout/retry guidance and fallback endpoint checks.

This keeps bounty-quality docs usable by new contributors and operators.

## Code Style

- Python 3.8+ compatible
- Type hints appreciated but not yet enforced
- Keep PRs focused — one issue per PR
- Test against the live node, not just local mocks

## BCOS (Beacon Certified Open Source)

RustChain uses BCOS checks to keep contributions auditable and license-clean without forcing rewrites of legacy code.

- **Tier label required (non-doc PRs)**: Add `BCOS-L1` or `BCOS-L2` (also accepted: `bcos:l1`, `bcos:l2`).
- **Doc-only exception**: PRs that only touch `docs/**`, `*.md`, or common image/PDF files do not require a tier label.
- **SPDX required (new code files only)**: Newly added code files must include an SPDX header near the top, e.g. `# SPDX-License-Identifier: MIT`.
- **Evidence artifacts**: CI uploads `bcos-artifacts` (SBOM, license report, hashes, and a machine-readable attestation JSON).

When to pick a tier:
- `BCOS-L1`: normal features, refactors, non-sensitive changes.
- `BCOS-L2`: security-sensitive changes, transfer/wallet logic, consensus/rewards, auth/crypto, supply-chain touching changes.

## Start Mining

Don't just code — mine! Install the miner and earn RTC while you contribute:

```bash
pip install clawrtc
clawrtc --wallet YOUR_NAME
```

Vintage hardware (PowerPC G4/G5, POWER8) earns **2-2.5x** more than modern PCs.

## Questions?

Open an issue or join the community. We're friendly.
| Node Health | `https://50.28.86.131/health` |
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
[![CI](https://github.com/Scottcjn/Rustchain/actions/workflows/ci.yml/badge.svg)](https://github.com/Scottcjn/Rustchain/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Stars](https://img.shields.io/github/stars/Scottcjn/Rustchain?style=flat&color=gold)](https://github.com/Scottcjn/Rustchain/stargazers)
[![Nodes](https://img.shields.io/badge/Nodes-5%20Active-brightgreen)](https://rustchain.org/explorer/)
[![Nodes](https://img.shields.io/badge/Nodes-5%20Active-brightgreen)](https://rustchain.org/explorer)
[![DePIN](https://img.shields.io/badge/DePIN-Vintage%20Hardware-8B4513)](https://rustchain.org)
[![Proof of Antiquity](https://img.shields.io/badge/Consensus-Proof%20of%20Antiquity-DAA520)](docs/RustChain_Whitepaper_Flameholder_v0.97-1.pdf)
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.19442753.svg)](https://doi.org/10.5281/zenodo.19442753)

A PowerBook G4 from 2003 earns **2.5x** more than a modern Threadripper.
A Power Mac G5 earns **2.0x**. A 486 with rusty serial ports earns the most respect of all.

[Explorer](https://rustchain.org/explorer/) · [Machines Preserved](https://rustchain.org/preserved.html) · [Install Miner](#quickstart) · [Beginner Guide](docs/QUICKSTART.md) · [Manifesto](https://rustchain.org/manifesto.html) · [Whitepaper](docs/RustChain_Whitepaper_Flameholder_v0.97-1.pdf)
[Explorer](https://rustchain.org/explorer) · [Machines Preserved](https://rustchain.org/preserved.html) · [Install Miner](#quickstart) · [Beginner Guide](docs/QUICKSTART.md) · [Manifesto](https://rustchain.org/manifesto.html) · [Whitepaper](docs/RustChain_Whitepaper_Flameholder_v0.97-1.pdf)

</div>

Expand Down Expand Up @@ -244,7 +244,7 @@ curl -sk https://rustchain.org/epoch # Current epoch

| Fact | Proof |
|------|-------|
| 5 nodes across 3 continents (NA ×3, Asia ×1, Local ×1) | [Live explorer](https://rustchain.org/explorer/) |
| 5 nodes across 3 continents (NA ×3, Asia ×1, Local ×1) | [Live explorer](https://rustchain.org/explorer) |
| 26+ miners attesting | `curl -sk https://rustchain.org/api/miners` |
| 44 BCOS certificates issued | [Certified repos](https://rustchain.org/bcos/) |
| 6 hardware fingerprint checks per machine | [Fingerprint docs](docs/attestation_fuzzing.md) |
Expand Down Expand Up @@ -303,7 +303,7 @@ Epoch: 10 minutes | Pool: 1.5 RTC/epoch | Split by antiquity weight

G4 Mac (2.5x): 0.30 RTC ████████████████████
G5 Mac (2.0x): 0.24 RTC ████████████████
Modern PC (1.0x): 0.12 RTC ████████
Modern PC (0.8x): 0.12 RTC ████████
```

### Anti-VM Enforcement
Expand Down
2 changes: 1 addition & 1 deletion docs/QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ hardware's **antiquity multiplier** -- older hardware gets a bigger slice.
| RISC-V | 1.4x | Open hardware, the future |
| Apple Silicon (M1-M4) | 1.2x | Modern but welcome |
| Modern x86 (AMD/Intel) | 0.8x | Baseline |
| ARM NAS/SBC | 0.0005x | Too cheap, too farmable |
| ARM NAS/SBC | 0.0005x | Low attestation weight, easily replicated |

**Got a PowerBook G4 gathering dust in a closet?** Plug it in. It earns 2.5x what your
gaming PC does.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ curl -sk https://rustchain.org/epoch | jq .
```
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Vintage Miner │────▶│ Attestation Node │────▶│ Ergo Anchor │
│ (G4/G5/SPARC) │ │ (50.28.86.131) │ │ (Immutability) │
│ (G4/G5/SPARC) │ │ (https://rustchain.org) │ │ (Immutability) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
│ Hardware Fingerprint │ Epoch Settlement
Expand Down
Binary file removed docs/RustChain_Whitepaper_Flameholder_v0.97.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ CYAN='\033[0;36m'
NC='\033[0m' # No Color

INSTALL_DIR="$HOME/.rustchain"
MINER_URL="https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/rustchain_universal_miner.py"
FINGERPRINT_URL="https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/fingerprint_checks.py"
MINER_URL="https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/linux/rustchain_linux_miner.py"
FINGERPRINT_URL="https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/linux/fingerprint_checks.py"
NODE_URL="https://50.28.86.131"
VERSION="1.0.0"

Expand Down
10 changes: 8 additions & 2 deletions node/rustchain_p2p_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,14 +883,20 @@ def _handle_get_state(self, msg: GossipMessage) -> Dict:
# Uses the Phase A signed-content shape (msg_type:sender_id:payload)
# so verify_message() on the requester side accepts it.
payload = {"state": state_data}
content = self._signed_content(MessageType.STATE.value, self.node_id, payload)
# FIX #2288: _signed_content requires 5 args (msg_type, sender_id, msg_id, ttl, payload)
state_msg_id = hashlib.sha256(
f"STATE:{self.node_id}:{json.dumps(payload, sort_keys=True)}:{time.time()}".encode()
).hexdigest()[:24]
content = self._signed_content(MessageType.STATE.value, self.node_id, state_msg_id, 0, payload)
signature, timestamp = self._sign_message(content)
return {
"status": "ok",
"state": state_data,
"signature": signature,
"timestamp": timestamp,
"sender_id": self.node_id
"sender_id": self.node_id,
"msg_id": state_msg_id,
"ttl": 0
}

def _handle_state(self, msg: GossipMessage) -> Dict:
Expand Down
148 changes: 148 additions & 0 deletions rustchain_telegram_bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# RustChain Telegram Bot

A Telegram bot for checking RustChain wallet balances and miner status.

## Features

- `/balance <wallet_id>` - Query wallet balance
- `/miners` - List active miners
- `/epoch` - Show current epoch
- `/price` - Show RTC/USD price ($0.10)
- `/help` - List available commands
- Rate limiting: 1 request per 5 seconds per user
- Error handling for offline nodes

## Configuration

Edit `bot.py` and set your values:

```python
BOT_TOKEN = "YOUR_BOT_TOKEN_HERE" # Telegram bot token from @BotFather
NODE_BASE_URL = "http://localhost:8080" # RustChain node URL
RTC_USD_PRICE = 0.10 # RTC price in USD
RATE_LIMIT_SECONDS = 5 # Rate limit per user
```

## Local Development

```bash
# Install dependencies
pip install -r requirements.txt

# Set environment variables or edit bot.py
export BOT_TOKEN="your_bot_token_here"

# Run the bot
python bot.py
```

## Deployment

### Railway

1. Create a new Railway project
2. Connect your GitHub repository
3. Add environment variables:
- `BOT_TOKEN` = your Telegram bot token
- `NODE_BASE_URL` = your RustChain node URL
4. Railway auto-detects Python and installs from `requirements.txt`
5. Set the start command: `python bot.py`

### Fly.io

1. Install flyctl: `curl -L https://fly.io/install.sh | sh`
2. Login: `fly auth login`
3. Create `fly.toml`:

```toml
app = "rustchain-telegram-bot"
primary_region = "iad"

[build]
builder = "python"

[deploy]
release_command = "pip install -r requirements.txt"

[processes]
app = "python bot.py"

[env]
PORT = "8080"

[http_service]
internal_port = 8080
force_https = true
```

4. Deploy: `fly launch && fly deploy`

### systemd Service

1. Create the service file:

```ini
[Unit]
Description=RustChain Telegram Bot
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/opt/rustchain-telegram-bot
Environment=BOT_TOKEN=your_bot_token_here
Environment=NODE_BASE_URL=http://localhost:8080
ExecStart=/usr/bin/python3 bot.py
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
```

2. Install:

```bash
sudo cp rustchain-telegram-bot.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable rustchain-telegram-bot
sudo systemctl start rustchain-telegram-bot
sudo journalctl -u rustchain-telegram-bot -f
```

## Docker

```dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY bot.py .
CMD ["python", "bot.py"]
```

```bash
docker build -t rustchain-bot .
docker run -d \
--name rustchain-bot \
-e BOT_TOKEN=your_token \
-e NODE_BASE_URL=http://node:8080 \
rustchain-bot
```

## API Endpoints

The bot expects these RustChain node endpoints:

| Endpoint | Description |
|----------|-------------|
| `GET /health` | Node health check |
| `GET /wallet/balance?miner_id=<id>` | Wallet balance |
| `GET /api/miners` | List of active miners |
| `GET /epoch` | Current epoch info |

## License

MIT
Loading