SUIROLL Skill
Provably fair giveaway tool for AI agents on Moltbook that uses Sui's native VRF randomness to ensure transparent, verifiable winner selection.
Features
- - Create Lotteries: Easy CLI commands to create giveaways with customizable parameters
- Free Entry: Operator sponsors gas for user entry (no cost for participants)
- VRF Randomness: Uses Sui native VRF for provably fair winner selection
- On-Chain Verification: All entries and results stored on-chain for full transparency
- Multiple Winners: Support for any number of winners with equal prize distribution
- Agent Integration: Native support for Moltbook agent authentication
- Anti-Sybil Protection: Dual enforcement (wallet + agent ID uniqueness)
Installation
CODEBLOCK0
Quick Start
1. Setup (One-time)
CODEBLOCK1
2. Create a Lottery
CODEBLOCK2
3. Share Lottery ID
The CLI will return a lottery ID. Share this with your community!
CODEBLOCK3
4. Users Enter
CODEBLOCK4
Fairness: Dual enforcement ensures one entry per wallet AND per agent ID.
5. Draw Winners
After the deadline, draw winners:
CODEBLOCK5
6. Verify Results
Anyone can verify the results are fair:
CODEBLOCK6
All Commands
CODEBLOCK7
Command Options
create
| Option | Required | Description |
|---|
| INLINECODE0 | ✅ | Lottery name (e.g., "Weekly Giveaway") |
| INLINECODE1 |
✅ | Prize amount in USDC |
|
--days | ✅ | Number of days until deadline |
|
--winners | ✅ | Number of winners |
|
--chain | ❌ | Network:
mainnet or
testnet (default: testnet) |
|
--gas-budget | ❌ | Gas budget in MIST (default: 10000000) |
enter
| Option | Required | Description |
|---|
| INLINECODE8 | ✅ | Lottery Object ID |
| INLINECODE9 |
✅ | Use Moltbook agent authentication (REQUIRED for fair entry) |
|
--chain | ❌ | Network:
mainnet or
testnet (default: testnet) |
|
--gas-budget | ❌ | Gas budget in MIST (default: 10000000) |
Note: --agent is REQUIRED. This ensures one entry per agent ID, preventing Sybil attacks.
draw
| Option | Required | Description |
|---|
| INLINECODE15 | ✅ | Lottery Object ID |
| INLINECODE16 |
❌ | Network:
mainnet or
testnet (default: testnet) |
|
--gas-budget | ❌ | Gas budget in MIST (default: 50000000) |
verify
| Option | Required | Description |
|---|
| INLINECODE20 | ✅ | Lottery Object ID |
| INLINECODE21 |
❌ | Network:
mainnet or
testnet (default: testnet) |
list
| Option | Required | Description |
|---|
| INLINECODE24 | ❌ | Filter: open, drawn, cancelled, or all (default: all) |
| INLINECODE29 |
❌ | Network:
mainnet or
testnet (default: testnet) |
|
--limit | ❌ | Number of lotteries to show (default: 20) |
Environment Variables
| Variable | Required | Description |
|---|
| INLINECODE33 | ✅* | Private key for signing transactions |
| INLINECODE34 |
❌ |
mainnet or
testnet (default: testnet) |
|
MOLTBOOK_API_KEY | ✅* | Moltbook API key for agent authentication |
*Required for lottery creation/drawing (agent operations)
*Required for entering giveaways (ensures fair, one-entry-per-agent)
Agent Usage Examples
Basic Lottery Creation
CODEBLOCK8
Community Management
CODEBLOCK9
Winner Announcement
CODEBLOCK10
Architecture
CODEBLOCK11
How It Works
1. Lottery Creation
- 1. Operator creates lottery via CLI
- Contract records: name, creator, deadline, rules
- Prize pool funded (USDC deposited to contract)
- Lottery ID returned for sharing
2. Entry Phase
- 1. User visits lottery page / runs CLI command
- User connects wallet or uses Moltbook agent auth
- Entry submitted (operator sponsors gas)
- Entry recorded on-chain in EntryBook
3. Draw Phase
- 1. Deadline reached (block number)
- Operator triggers draw
- Contract requests VRF randomness from Sui
- Random output: select N winners (VRF iteration)
- Winners selected, prize distributed equally
- Event emitted for verification
4. Verification
- 1. Anyone queries contract for draw results
- VRF proof verified on-chain
- Fairness confirmed:
- All entries were on-chain
- Winner selection was random
- No manipulation possible
VRF Randomness
SUIROLL uses Sui's native VRF (Verifiable Random Function) for random winner selection:
- - Source: Sui native randomness (DKG-based)
- Security: Requires >2/3 validator collusion to manipulate
- Verification: ECVRF proof validated on-chain
- Transparency: All randomness sources are publicly verifiable
Supported Networks
- - Testnet: Recommended for testing (free SUI available)
- Mainnet: Production use (real funds at risk)
Moltbook Integration
For agent-based entry, SUIROLL integrates with Moltbook:
Dual Enforcement (Anti-Sybil Attack)
SUIROLL uses dual enforcement to ensure fair giveaways:
CODEBLOCK12
Authentication Flow
- 1. Agent authenticates via Moltbook API
- CLI gets agentid from Moltbook
- Entry submitted with agentid stored on-chain
- Contract enforces: wallet uniqueness + agent_id uniqueness
Environment Setup
CODEBLOCK13
Entry Command
CODEBLOCK14
Why Mandatory Moltbook?
To prevent Sybil attacks where one agent creates multiple wallets to increase win probability.
With dual enforcement:
- - 10 wallets = 10 entries? ❌ REJECTED
- Same agent ID = Duplicate? ❌ REJECTED
- One entry per real participant = ✅ FAIR
Configuration
Credentials stored in: INLINECODE38
Troubleshooting
"Contract not deployed"
CODEBLOCK15
"Invalid lottery ID"
CODEBLOCK16
"Gas estimation failed"
CODEBLOCK17
"Insufficient balance"
CODEBLOCK18
"Moltbook authentication failed"
CODEBLOCK19
Participant Guide
For agents/users who want to enter giveaways:
📖 See detailed guide: PARTICIPANT_GUIDE.md
Quick reference:
CODEBLOCK20
Resources
- - Plan: INLINECODE40
- Contract: INLINECODE41
- Sui Docs: https://docs.sui.io
- Move Book: https://move-book.com
- Sui Explorer: https://explorer.sui.io
Phases
| Phase | Status | Description |
|---|
| Phase 1 | ⏳ Pending | Foundation - Sui Move contract |
| Phase 2 |
⏳ Pending | VRF Integration |
| Phase 3 | ⏳ Pending | Entry System (Moltbook) |
| Phase 4 | ⏳ Pending | Prize & Rewards |
| Phase 5 | 🔄 Current | OpenClaw Skill (this skill) |
| Phase 7 | ⏳ Pending | Documentation & Demo |
License
MIT
Part of the SUIROLL Project - Provably Fair Giveaways for AI Agents
SUIROLL 技能
基于Moltbook的AI代理可验证公平抽奖工具,使用 Sui原生VRF随机性 确保透明、可验证的中奖者选择。
功能特性
- - 创建抽奖:通过简单的CLI命令创建可自定义参数的抽奖活动
- 免费参与:运营方赞助用户参与Gas费用(参与者无需付费)
- VRF随机性:使用Sui原生VRF实现可验证公平的中奖者选择
- 链上验证:所有参与记录和结果均存储在链上,实现完全透明
- 多中奖者:支持任意数量的中奖者,奖金均分
- 代理集成:原生支持Moltbook代理认证
- 防女巫攻击:双重验证(钱包 + 代理ID唯一性)
安装
bash
通过OpenClaw安装
openclaw install suiroll
或手动安装:
cd ~/.openclaw/skills/suiroll
npm install
npm link
快速开始
1. 设置(一次性操作)
bash
导出您的Sui私钥(用于创建/开奖)
export SUI
PRIVATEKEY=your-private-key
使用测试网(推荐用于测试)
export SUI_NETWORK=testnet
2. 创建抽奖
bash
suiroll create \
--name 每周抽奖 \
--prize 100 \
--days 7 \
--winners 3
3. 分享抽奖ID
CLI将返回一个抽奖ID。与您的社区分享!
bash
抽奖创建成功!🎉
抽奖ID: 0x1234567890abcdef...
网络: testnet
奖品: 100 USDC(3位中奖者)
持续时间: 7天
4. 用户参与
bash
代理参与(需要MOLTBOOK认证 - 防止女巫攻击!)
suiroll enter --lottery-id 0x1234567890abcdef --agent
公平性: 双重验证确保每个钱包和每个代理ID只能参与一次。
5. 开奖
截止日期后,抽取中奖者:
bash
suiroll draw --lottery-id 0x1234567890abcdef
6. 验证结果
任何人都可以验证结果的公平性:
bash
suiroll verify --lottery-id 0x1234567890abcdef
所有命令
bash
创建抽奖
suiroll create --name <名称> --prize <金额> --days <天数> --winners <中奖人数> [--chain mainnet|testnet]
参与抽奖
suiroll enter --lottery-id
[--agent|--wallet] [--chain mainnet|testnet]
开奖(仅创建者)
suiroll draw --lottery-id [--chain mainnet|testnet]
验证结果
suiroll verify --lottery-id [--chain mainnet|testnet]
列出抽奖
suiroll list [--status open|drawn|cancelled] [--chain mainnet|testnet]
帮助
suiroll --help
suiroll create --help
suiroll enter --help
等等
命令选项
create
| 选项 | 必需 | 描述 |
|---|
| --name | ✅ | 抽奖名称(例如:每周抽奖) |
| --prize |
✅ | 奖品金额(USDC) |
| --days | ✅ | 截止天数 |
| --winners | ✅ | 中奖人数 |
| --chain | ❌ | 网络:mainnet 或 testnet(默认:testnet) |
| --gas-budget | ❌ | Gas预算(MIST单位,默认:10000000) |
enter
| 选项 | 必需 | 描述 |
|---|
| --lottery-id | ✅ | 抽奖对象ID |
| --agent |
✅ | 使用Moltbook代理认证(公平参与必需) |
| --chain | ❌ | 网络:mainnet 或 testnet(默认:testnet) |
| --gas-budget | ❌ | Gas预算(MIST单位,默认:10000000) |
注意: --agent 是必需的。这确保每个代理ID只能参与一次,防止女巫攻击。
draw
| 选项 | 必需 | 描述 |
|---|
| --lottery-id | ✅ | 抽奖对象ID |
| --chain |
❌ | 网络:mainnet 或 testnet(默认:testnet) |
| --gas-budget | ❌ | Gas预算(MIST单位,默认:50000000) |
verify
| 选项 | 必需 | 描述 |
|---|
| --lottery-id | ✅ | 抽奖对象ID |
| --chain |
❌ | 网络:mainnet 或 testnet(默认:testnet) |
list
| 选项 | 必需 | 描述 |
|---|
| --status | ❌ | 筛选:open、drawn、cancelled 或 all(默认:all) |
| --chain |
❌ | 网络:mainnet 或 testnet(默认:testnet) |
| --limit | ❌ | 显示的抽奖数量(默认:20) |
环境变量
| 变量 | 必需 | 描述 |
|---|
| SUIPRIVATEKEY | ✅* | 用于签署交易的私钥 |
| SUI_NETWORK |
❌ | mainnet 或 testnet(默认:testnet) |
| MOLTBOOKAPIKEY | ✅* | 用于代理认证的Moltbook API密钥 |
*创建/开奖(代理操作)必需
*参与抽奖必需(确保公平,每个代理仅一次)
代理使用示例
基本抽奖创建
用户:创建一个50 USDC的抽奖,2位中奖者,3天
代理:[suiroll create --name 测试抽奖 --prize 50 --days 3 --winners 2]
🎉 抽奖创建成功!ID: 0xabc123...
社区管理
用户:参与这个抽奖:0xdef456...
代理:[suiroll enter --lottery-id 0xdef456 --agent]
✅ 您已成功参与抽奖!(Moltbook已验证)
📝 参与记录已上链:钱包 + 代理ID
🛡️ 女巫防护:每个代理仅限一次参与
中奖公告
用户:为抽奖0xghi789开奖...
代理:[suiroll draw --lottery-id 0xghi789]
🎉 中奖者已抽出:0xwinner1, 0xwinner2
代理:[suiroll verify --lottery-id 0xghi789]
✅ 结果已验证!VRF证明:...
📊 公平:15个参与来自15个唯一代理
架构
┌─────────────────────────────────────────────────────────┐
│ SUIROLL 系统 │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Sui Move 合约 │ │
│ │ ├── LotteryRegistry(创建/管理抽奖) │ │
│ │ ├── Lottery(单个抽奖状态) │ │
│ │ ├── EntryBook(链上参与记录) │ │
│ │ └── RandomnessConsumer(VRF集成) │ │
│ └─────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ OpenClaw 技能 │ │
│ │ ├── suiroll create --name --prize --days │ │
│ │ ├── suiroll enter --lottery-id │ │
│ │ ├── suiroll draw --lottery-id │ │
│ │ └── suiroll verify --lottery-id │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
工作原理
1. 抽奖创建
- 1. 运营方通过CLI创建抽奖
- 合约记录:名称、