Agent Lottery - Bitcoin Solo Mining Lottery
Use CPU power to participate in Bitcoin mining lottery. Extremely low probability but zero cost entertainment - if you hit a block, you get the full 3.125 BTC reward (~$150,000+).
First-Time Setup Workflow
When user first mentions lottery mining, check if data/config.json exists:
If config.json NOT exists (first time):
- 1. Check dependencies
python3 scripts/miner.py status
If cpuminer-opt not found, run:
CODEBLOCK1
- 2. Ask user about BTC address:
> "Do you have a BTC address? If yes, we can use it directly. If no, I'll generate a new wallet for you."
Wait for user response before proceeding.
- 3. Ask user about CPU usage:
> "How much CPU would you like to use for lottery mining? Default is 10%, recommended 5-20%. Higher values may affect normal computer usage."
| Device Type | Suggested CPU |
|-------------|---------------|
| Raspberry Pi / Low-power devices | 5-10% |
| Laptop / Desktop | 10-30% |
| Dedicated server | 50-100% |
Wait for user response. Use 10% if user doesn't specify.
- 4. Configure wallet (based on step 2):
- If YES (has address):
python3 scripts/wallet.py --address THEIR_BTC_ADDRESS --pool btc.casualmine.com:20001 --cpu THEIR_CPU_PERCENT
Tell user: "Configuration complete! Mining rewards will be sent directly to this address."
- If NO (needs new wallet):
python3 scripts/wallet.py --generate --pool btc.casualmine.com:20001 --cpu THEIR_CPU_PERCENT
IMPORTANT: Show user the private key and warn them to save it!
> "Please save your private key securely! This is the only way to access this wallet."
- If user has private key (WIF or hex):
CODEBLOCK4
- 5. Start mining
nohup python3 scripts/miner.py start > /dev/null 2>&1 &
Tell user: "Mining started! Use 'lottery' command to check status. You can adjust CPU anytime with 'setcpu --cpu X'."
If config.json exists (already configured):
Just run lottery to show current status.
Platform Support
| Platform | Mining | CPU Limiting |
|---|
| Linux (x86_64, ARM) | Full | cpulimit |
| macOS (Intel, Apple Silicon) |
Full | cpulimit (via brew) |
| Windows (WSL) | Full | cpulimit |
| Windows (native) | Manual | Requires 3rd party tool |
Quick Commands
CODEBLOCK6
Statistics Tracked
- - Best Difficulty: Highest difficulty share found (closer to block diff = better)
- Total Shares: Number of lottery "tickets"
- Runtime: How long mining has been active
- CPU Usage: Current CPU limit
- Network Difficulty: Fetched in real-time from blockchain.info
Lottery Reality Check
Tell users:
- - BTC network difficulty: fetched in real-time (currently ~144T, varies)
- CPU mining produces shares with diff ~0.001 to ~10 typically
- A block requires diff matching network difficulty
- Odds: roughly 1 in 10^14+ per share
- This is entertainment, not investment
When User Asks About Lottery
Run python3 scripts/miner.py lottery and explain:
- - Their current "tickets" (shares)
- Best difficulty found
- Real-time network difficulty
- How far they are from a block (odds)
- Encourage them to keep going (or not, if unrealistic)
Installation
Linux / macOS
CODEBLOCK7
Windows
- 1. Option A: WSL (Recommended)
CODEBLOCK8
- 2. Option B: Native Windows
- Download cpuminer-opt from https://github.com/JayDDee/cpuminer-opt/releases
- Extract and add to PATH
- For CPU limiting, use BES (Battle Encoder Shirase) or Process Throttler
Dependencies
- -
cpuminer-opt: Bitcoin SHA256d miner - INLINECODE4 : CPU throttling (Linux/macOS only)
- INLINECODE5 ,
ecdsa: Python libraries for wallet
Files
CODEBLOCK9
Agent Lottery - 比特币单机挖矿彩票
使用CPU算力参与比特币挖矿彩票。概率极低但零成本的娱乐方式——如果你挖到一个区块,将获得完整的3.125 BTC奖励(约15万美元以上)。
首次设置工作流程
当用户首次提到彩票挖矿时,检查data/config.json是否存在:
如果config.json不存在(首次使用):
- 1. 检查依赖
bash
python3 scripts/miner.py status
如果未找到cpuminer-opt,运行:
bash
./scripts/install.sh
- 2. 询问用户BTC地址:
> 你有BTC地址吗?如果有,我们可以直接使用。如果没有,我将为你生成一个新钱包。
等待用户回复后再继续。
- 3. 询问用户CPU使用率:
> 你希望使用多少CPU进行彩票挖矿?默认为10%,建议5-20%。较高的数值可能会影响正常电脑使用。
| 设备类型 | 建议CPU |
|-------------|---------------|
| 树莓派/低功耗设备 | 5-10% |
| 笔记本/台式机 | 10-30% |
| 专用服务器 | 50-100% |
等待用户回复。如果用户未指定,使用10%。
- 4. 配置钱包(基于步骤2):
- 如果有地址:
bash
python3 scripts/wallet.py --address 用户BTC地址 --pool btc.casualmine.com:20001 --cpu 用户CPU百分比
告知用户:配置完成!挖矿奖励将直接发送到此地址。
- 如果需要新钱包:
bash
python3 scripts/wallet.py --generate --pool btc.casualmine.com:20001 --cpu 用户CPU百分比
重要:向用户展示私钥并警告其保存!
> 请安全保存您的私钥!这是访问此钱包的唯一方式。
- 如果用户有私钥(WIF或十六进制):
bash
python3 scripts/wallet.py --import-key 用户私钥 --pool btc.casualmine.com:20001 --cpu 用户CPU百分比
- 5. 开始挖矿
bash
nohup python3 scripts/miner.py start > /dev/null 2>&1 &
告知用户:挖矿已启动!使用lottery命令查看状态。您可以随时使用setcpu --cpu X调整CPU。
如果config.json存在(已配置):
直接运行lottery显示当前状态。
平台支持
| 平台 | 挖矿 | CPU限制 |
|---|
| Linux(x86_64, ARM) | 完整支持 | cpulimit |
| macOS(Intel, Apple Silicon) |
完整支持 | cpulimit(通过brew) |
| Windows(WSL) | 完整支持 | cpulimit |
| Windows(原生) | 手动 | 需要第三方工具 |
快速命令
bash
生成新钱包(默认CPU:10%)
python3 scripts/wallet.py --generate --pool btc.casualmine.com:20001 --cpu 10
使用现有BTC地址(无需私钥)
python3 scripts/wallet.py --address 你的BTC地址 --pool btc.casualmine.com:20001 --cpu 10
使用私钥导入现有钱包
python3 scripts/wallet.py --import-key 你的私钥
显示钱包信息
python3 scripts/wallet.py --show
开始挖矿(后台运行使用nohup)
nohup python3 scripts/miner.py start --cpu 10 > /dev/null 2>&1 &
停止挖矿
python3 scripts/miner.py stop
动态调整CPU(挖矿中或停止时均可)
python3 scripts/miner.py setcpu --cpu 20
检查状态
python3 scripts/miner.py status
彩票摘要(用户友好)
python3 scripts/miner.py lottery
统计追踪
- - 最佳难度:找到的最高难度份额(越接近区块难度越好)
- 总份额:彩票票数
- 运行时间:挖矿已运行时间
- CPU使用率:当前CPU限制
- 网络难度:从blockchain.info实时获取
彩票现实检查
告知用户:
- - BTC网络难度:实时获取(当前约144T,会变化)
- CPU挖矿产生的份额难度通常在0.001到10之间
- 一个区块需要匹配网络难度的份额
- 概率:每份额大约1 in 10^14+
- 这是娱乐,不是投资
当用户询问彩票时
运行python3 scripts/miner.py lottery并解释:
- - 他们当前的票数(份额)
- 找到的最佳难度
- 实时网络难度
- 距离挖到区块还有多远(概率)
- 鼓励他们继续(或不鼓励,如果不现实)
安装
Linux / macOS
bash
chmod +x scripts/install.sh
./scripts/install.sh
Windows
- 1. 选项A:WSL(推荐)
powershell
wsl --install
# 然后在WSL内运行install.sh
- 2. 选项B:原生Windows
- 从https://github.com/JayDDee/cpuminer-opt/releases下载cpuminer-opt
- 解压并添加到PATH
- CPU限制使用BES(Battle Encoder Shirase)或Process Throttler
依赖
- - cpuminer-opt:比特币SHA256d矿工
- cpulimit:CPU限速(仅Linux/macOS)
- base58,ecdsa:钱包的Python库
文件
agent-lottery/
├── SKILL.md # 本文件
├── scripts/
│ ├── wallet.py # 钱包管理(生成/导入/地址)
│ ├── miner.py # 挖矿控制器(启动/停止/状态/设置CPU)
│ ├── quick_status.py # 快速状态检查
│ └── install.sh # 跨平台依赖安装程序
└── data/ # 用户数据(git忽略)
├── config.json # 钱包和统计
└── miner.log # 挖矿输出