Skip to content
Closed
Show file tree
Hide file tree
Changes from 12 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
6 changes: 3 additions & 3 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
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