Skip to content

Commit ef2668a

Browse files
Merge pull request Scottcjn#196 from zhanglinqian/issue-157-python-sdk
Python SDK for RustChain. 100 RTC to zhanglinqian.
2 parents d1a80c0 + 534c067 commit ef2668a

File tree

15 files changed

+2015
-0
lines changed

15 files changed

+2015
-0
lines changed

README_ZH.md

Lines changed: 348 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,348 @@
1+
<div align="center">
2+
3+
# 🧱 RustChain:古董证明区块链
4+
5+
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6+
[![PowerPC](https://img.shields.io/badge/PowerPC-G3%2FG4%2FG5-orange)](https://github.com/Scottcjn/Rustchain)
7+
[![Blockchain](https://img.shields.io/badge/Consensus-Proof--of--Antiquity-green)](https://github.com/Scottcjn/Rustchain)
8+
[![Python](https://img.shields.io/badge/Python-3.x-yellow)](https://python.org)
9+
[![Network](https://img.shields.io/badge/Nodes-3%20Active-brightgreen)](https://rustchain.org/explorer)
10+
[![As seen on BoTTube](https://bottube.ai/badge/seen-on-bottube.svg)](https://bottube.ai)
11+
12+
**第一个奖励陈旧硬件的古董证明区块链,奖励的是它的老旧,而不是速度。**
13+
14+
*你的PowerPC G4比现代Threadripper赚得更多。就是这么硬核。*
15+
16+
[网站](https://rustchain.org)[实时浏览器](https://rustchain.org/explorer)[交换wRTC](https://raydium.io/swap/?inputMint=sol&outputMint=12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X)[DexScreener](https://dexscreener.com/solana/8CF2Q8nSCxRacDShbtF86XTSrYjueBMKmfdR3MLdnYzb)[wRTC快速入门](docs/wrtc.md)[wRTC教程](docs/WRTC_ONBOARDING_TUTORIAL.md)[Grokipedia参考](https://grokipedia.com/search?q=RustChain)[白皮书](docs/RustChain_Whitepaper_Flameholder_v0.97-1.pdf)[快速开始](#-快速开始)[工作原理](#-古董证明如何工作)
17+
18+
</div>
19+
20+
---
21+
22+
## 🪙 Solana上的wRTC
23+
24+
RustChain代币(RTC)现已通过BoTTube桥接器在Solana上提供**wRTC**
25+
26+
| 资源 | 链接 |
27+
|----------|------|
28+
| **交换wRTC** | [Raydium DEX](https://raydium.io/swap/?inputMint=sol&outputMint=12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X) |
29+
| **价格图表** | [DexScreener](https://dexscreener.com/solana/8CF2Q8nSCxRacDShbtF86XTSrYjueBMKmfdR3MLdnYzb) |
30+
| **桥接 RTC ↔ wRTC** | [BoTTube桥接器](https://bottube.ai/bridge) |
31+
| **快速入门指南** | [wRTC快速入门(购买、桥接、安全)](docs/wrtc.md) |
32+
| **新手教程** | [wRTC桥接器+交换安全指南](docs/WRTC_ONBOARDING_TUTORIAL.md) |
33+
| **外部参考** | [Grokipedia搜索:RustChain](https://grokipedia.com/search?q=RustChain) |
34+
| **代币铸造地址** | `12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X` |
35+
36+
---
37+
38+
## 📄 学术论文
39+
40+
| 论文 | DOI | 主题 |
41+
|-------|-----|-------|
42+
| **RustChain:一个CPU,一票** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18623592.svg)](https://doi.org/10.5281/zenodo.18623592) | 古董证明共识,硬件指纹识别 |
43+
| **非二合置换坍缩** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18623920.svg)](https://doi.org/10.5281/zenodo.18623920) | LLM注意力的AltiVec vec_perm(27-96倍优势) |
44+
| **PSE硬件熵** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18623922.svg)](https://doi.org/10.5281/zenodo.18623922) | POWER8 mftb熵用于行为差异 |
45+
| **神经形态提示翻译** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18623594.svg)](https://doi.org/10.5281/zenodo.18623594) | 情感提示提升20%视频扩散效果 |
46+
| **RAM金库** | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18321905.svg)](https://doi.org/10.5281/zenodo.18321905) | 用于LLM推理的NUMA分布式权重银行 |
47+
48+
---
49+
50+
## 🎯 RustChain的独特之处
51+
52+
| 传统工作量证明 | 古董证明 |
53+
|----------------|-------------------|
54+
| 奖励最快的硬件 | 奖励最旧的硬件 |
55+
| 新的=更好的 | 旧的=更好的 |
56+
| 浪费能源消耗 | 保护计算历史 |
57+
| 竞争到底 | 奖励数字保护 |
58+
59+
**核心原则**:存活数十年的真实古董硬件值得认可。RustChain颠覆了挖矿。
60+
61+
## ⚡ 快速开始
62+
63+
### 一键安装(推荐)
64+
```bash
65+
curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install-miner.sh | bash
66+
```
67+
68+
安装器会:
69+
- ✅ 自动检测你的平台(Linux/macOS,x86_64/ARM/PowerPC)
70+
- ✅ 创建隔离的Python虚拟环境(不污染系统)
71+
- ✅ 下载适合你硬件的正确矿工
72+
- ✅ 设置开机自启动(systemd/launchd)
73+
- ✅ 提供简单的卸载功能
74+
75+
### 带选项的安装
76+
77+
**使用特定钱包安装:**
78+
```bash
79+
curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install-miner.sh | bash -s -- --wallet my-miner-wallet
80+
```
81+
82+
**卸载:**
83+
```bash
84+
curl -sSL https://raw.githubusercontent.com/Scottcjn/Rustchain/main/install-miner.sh | bash -s -- --uninstall
85+
```
86+
87+
### 支持的平台
88+
- ✅ Ubuntu 20.04+、Debian 11+、Fedora 38+(x86_64、ppc64le)
89+
- ✅ macOS 12+(Intel、Apple Silicon、PowerPC)
90+
- ✅ IBM POWER8系统
91+
92+
### 安装后
93+
94+
**检查钱包余额:**
95+
```bash
96+
# 注意:使用-sk标志是因为节点可能使用自签名SSL证书
97+
curl -sk "https://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET_NAME"
98+
```
99+
100+
**列出活跃矿工:**
101+
```bash
102+
curl -sk https://50.28.86.131/api/miners
103+
```
104+
105+
**检查节点健康:**
106+
```bash
107+
curl -sk https://50.28.86.131/health
108+
```
109+
110+
**获取当前纪元:**
111+
```bash
112+
curl -sk https://50.28.86.131/epoch
113+
```
114+
115+
**管理矿工服务:**
116+
117+
*Linux(systemd):*
118+
```bash
119+
systemctl --user status rustchain-miner # 检查状态
120+
systemctl --user stop rustchain-miner # 停止挖矿
121+
systemctl --user start rustchain-miner # 开始挖矿
122+
journalctl --user -u rustchain-miner -f # 查看日志
123+
```
124+
125+
*macOS(launchd):*
126+
```bash
127+
launchctl list | grep rustchain # 检查状态
128+
launchctl stop com.rustchain.miner # 停止挖矿
129+
launchctl start com.rustchain.miner # 开始挖矿
130+
tail -f ~/.rustchain/miner.log # 查看日志
131+
```
132+
133+
### 手动安装
134+
```bash
135+
git clone https://github.com/Scottcjn/Rustchain.git
136+
cd Rustchain
137+
pip install -r requirements.txt
138+
python3 rustchain_universal_miner.py --wallet YOUR_WALLET_NAME
139+
```
140+
141+
## 💰 古董倍数
142+
143+
硬件的年龄决定了你的挖矿奖励:
144+
145+
| 硬件 | 时代 | 倍数 | 示例收益 |
146+
|----------|-----|------------|------------------|
147+
| **PowerPC G4** | 1999-2005 | **2.5×** | 0.30 RTC/纪元 |
148+
| **PowerPC G5** | 2003-2006 | **2.0×** | 0.24 RTC/纪元 |
149+
| **PowerPC G3** | 1997-2003 | **1.8×** | 0.21 RTC/纪元 |
150+
| **IBM POWER8** | 2014 | **1.5×** | 0.18 RTC/纪元 |
151+
| **Pentium 4** | 2000-2008 | **1.5×** | 0.18 RTC/纪元 |
152+
| **Core 2 Duo** | 2006-2011 | **1.3×** | 0.16 RTC/纪元 |
153+
| **Apple Silicon** | 2020+ | **1.2×** | 0.14 RTC/纪元 |
154+
| **现代x86_64** | 当前 | **1.0×** | 0.12 RTC/纪元 |
155+
156+
*倍数随时间衰减(15%/年)以防止永久优势。*
157+
158+
## 🔧 古董证明如何工作
159+
160+
### 1. 硬件指纹识别(RIP-PoA)
161+
162+
每个矿工必须证明他们的硬件是真实的,不是模拟的:
163+
164+
```
165+
┌─────────────────────────────────────────────────────────────┐
166+
│ 6项硬件检查 │
167+
├─────────────────────────────────────────────────────────────┤
168+
│ 1. 时钟偏差和振荡器漂移 ← 硅老化模式 │
169+
│ 2. 缓存时序指纹 ← L1/L2/L3延迟基调 │
170+
│ 3. SIMD单元标识 ← AltiVec/SSE/NEON偏好 │
171+
│ 4. 热漂移熵 ← 热曲线是唯一的 │
172+
│ 5. 指令路径抖动 ← 微架构抖动图 │
173+
│ 6. 反模拟检查 ← 检测虚拟机/模拟器 │
174+
└─────────────────────────────────────────────────────────────┘
175+
```
176+
177+
**为什么重要**:一个伪装成G4 Mac的SheepShaver虚拟机会通不过这些检查。真实的古董硅具有无法伪造的独特老化模式。
178+
179+
### 2. 1个CPU = 1票(RIP-200)
180+
181+
与工作量证明中算力=投票不同,RustChain使用**轮询共识**
182+
183+
- 每个独特的硬件设备在每个纪元正好获得1票
184+
- 奖励在所有投票者之间平均分配,然后乘以古董倍数
185+
- 运行多个线程或更快的CPU没有优势
186+
187+
### 3. 基于纪元的奖励
188+
189+
```
190+
纪元持续时间:10分钟(600秒)
191+
基础奖励池:每个纪元1.5 RTC
192+
分配:平均分配 × 古董倍数
193+
```
194+
195+
**5个矿工的示例:**
196+
```
197+
G4 Mac(2.5×): 0.30 RTC ████████████████████
198+
G5 Mac(2.0×): 0.24 RTC ████████████████
199+
现代PC(1.0×): 0.12 RTC ████████
200+
现代PC(1.0×): 0.12 RTC ████████
201+
现代PC(1.0×): 0.12 RTC ████████
202+
─────────
203+
总计: 0.90 RTC (+ 0.60 RTC返还到池中)
204+
```
205+
206+
## 🌐 网络架构
207+
208+
### 实时节点(3个活跃)
209+
210+
| 节点 | 位置 | 角色 | 状态 |
211+
|------|----------|------|--------|
212+
| **节点1** | 50.28.86.131 | 主节点+浏览器 | ✅ 活跃 |
213+
| **节点2** | 50.28.86.153 | Ergo锚点 | ✅ 活跃 |
214+
| **节点3** | 76.8.228.245 | 外部(社区) | ✅ 活跃 |
215+
216+
### Ergo区块链锚定
217+
218+
RustChain定期锚定到Ergo区块链以确保不可变性:
219+
220+
```
221+
RustChain纪元 → 承诺哈希 → Ergo交易(R4寄存器)
222+
```
223+
224+
这提供了RustChain状态在特定时间存在的密码学证明。
225+
226+
## 📊 API端点
227+
228+
```bash
229+
# 检查网络健康
230+
curl -sk https://50.28.86.131/health
231+
232+
# 获取当前纪元
233+
curl -sk https://50.28.86.131/epoch
234+
235+
# 列出活跃矿工
236+
curl -sk https://50.28.86.131/api/miners
237+
238+
# 检查钱包余额
239+
curl -sk "https://50.28.86.131/wallet/balance?miner_id=YOUR_WALLET"
240+
241+
# 区块浏览器(Web浏览器)
242+
open https://rustchain.org/explorer
243+
```
244+
245+
## 🖥️ 支持的平台
246+
247+
| 平台 | 架构 | 状态 | 说明 |
248+
|----------|--------------|--------|-------|
249+
| **Mac OS X Tiger** | PowerPC G4/G5 | ✅ 完全支持 | Python 2.5兼容矿工 |
250+
| **Mac OS X Leopard** | PowerPC G4/G5 | ✅ 完全支持 | 推荐用于古董Mac |
251+
| **Ubuntu Linux** | ppc64le/POWER8 | ✅ 完全支持 | 最佳性能 |
252+
| **Ubuntu Linux** | x86_64 | ✅ 完全支持 | 标准矿工 |
253+
| **macOS Sonoma** | Apple Silicon | ✅ 完全支持 | M1/M2/M3芯片 |
254+
| **Windows 10/11** | x86_64 | ✅ 完全支持 | Python 3.8+ |
255+
| **DOS** | 8086/286/386 | 🔧 实验性 | 仅徽章奖励 |
256+
257+
## 🏅 NFT徽章系统
258+
259+
通过挖矿里程碑获得纪念徽章:
260+
261+
| 徽章 | 要求 | 稀有度 |
262+
|-------|-------------|--------|
263+
| 🔥 **邦迪G3火焰守护者** | 在PowerPC G3上挖矿 | 稀有 |
264+
|**QuickBasic倾听者** | 从DOS机器上挖矿 | 传说 |
265+
| 🛠️ **DOS WiFi炼金术士** | 网络化DOS机器 | 神话 |
266+
| 🏛️ **万神殿先驱** | 前100名矿工 | 限量 |
267+
268+
## 🔒 安全模型
269+
270+
### 反虚拟机检测
271+
虚拟机被检测到并收到**正常奖励的十亿分之一**
272+
```
273+
真实G4 Mac: 2.5× 倍数 = 0.30 RTC/纪元
274+
模拟G4: 0.0000000025× 倍数 = 0.0000000003 RTC/纪元
275+
```
276+
277+
### 硬件绑定
278+
每个硬件指纹绑定到一个钱包。防止:
279+
- 同一硬件上的多个钱包
280+
- 硬件欺骗
281+
- 女巫攻击
282+
283+
## 📁 仓库结构
284+
285+
```
286+
Rustchain/
287+
├── rustchain_universal_miner.py # 主矿工(所有平台)
288+
├── rustchain_v2_integrated.py # 全节点实现
289+
├── fingerprint_checks.py # 硬件验证
290+
├── install.sh # 一键安装器
291+
├── docs/
292+
│ ├── RustChain_Whitepaper_*.pdf # 技术白皮书
293+
│ └── chain_architecture.md # 架构文档
294+
├── tools/
295+
│ └── validator_core.py # 区块验证
296+
└── nfts/ # 徽章定义
297+
```
298+
299+
## 🔗 相关项目和链接
300+
301+
| 资源 | 链接 |
302+
|---------|------|
303+
| **网站** | [rustchain.org](https://rustchain.org) |
304+
| **区块浏览器** | [rustchain.org/explorer](https://rustchain.org/explorer) |
305+
| **交换wRTC(Raydium)** | [Raydium DEX](https://raydium.io/swap/?inputMint=sol&outputMint=12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X) |
306+
| **价格图表** | [DexScreener](https://dexscreener.com/solana/8CF2Q8nSCxRacDShbtF86XTSrYjueBMKmfdR3MLdnYzb) |
307+
| **桥接 RTC ↔ wRTC** | [BoTTube桥接器](https://bottube.ai/bridge) |
308+
| **wRTC代币铸造地址** | `12TAdKXxcGf6oCv4rqDz2NkgxjyHq6HQKoxKZYGf5i4X` |
309+
| **BoTTube** | [bottube.ai](https://bottube.ai) - AI视频平台 |
310+
| **Moltbook** | [moltbook.com](https://moltbook.com) - AI社交网络 |
311+
| [nvidia-power8-patches](https://github.com/Scottcjn/nvidia-power8-patches) | POWER8的NVIDIA驱动程序 |
312+
| [llama-cpp-power8](https://github.com/Scottcjn/llama-cpp-power8) | POWER8上的LLM推理 |
313+
| [ppc-compilers](https://github.com/Scottcjn/ppc-compilers) | 用于古董Mac的现代编译器 |
314+
315+
## 📝 文章
316+
317+
- [古董证明:奖励古董硬件的区块链](https://dev.to/scottcjn/proof-of-antiquity-a-blockchain-that-rewards-vintage-hardware-4ii3) - Dev.to
318+
- [我在768GB IBM POWER8服务器上运行LLM](https://dev.to/scottcjn/i-run-llms-on-a-768gb-ibm-power8-server-and-its-faster-than-you-think-1o) - Dev.to
319+
320+
## 🙏 致谢
321+
322+
**一年的开发、真实的古董硬件、电费账单和一个专门的实验室投入其中。**
323+
324+
如果你使用RustChain:
325+
-**给这个仓库加星标** - 帮助其他人找到它
326+
- 📝 **在你的项目中注明** - 保持署名
327+
- 🔗 **链接回来** - 分享爱
328+
329+
```
330+
RustChain - 古董证明,作者Scott (Scottcjn)
331+
https://github.com/Scottcjn/Rustchain
332+
```
333+
334+
## 📜 许可证
335+
336+
MIT许可证 - 可免费使用,但请保留版权声明和署名。
337+
338+
---
339+
340+
<div align="center">
341+
342+
**[Elyan Labs](https://elyanlabs.ai)用⚡制作**
343+
344+
*"你的古董硬件获得奖励。让挖矿再次有意义。"*
345+
346+
**DOS机箱、PowerPC G4、Win95机器 - 它们都有价值。RustChain证明了这一点。**
347+
348+
</div>

sdk/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 RustChain Community
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

sdk/MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include README.md
2+
include LICENSE
3+
recursive-include rustchain *.py
4+
recursive-exclude * __pycache__
5+
recursive-exclude * *.py[co]

0 commit comments

Comments
 (0)