SplitXCH Royalty Split Builder
Create complex XCH royalty distribution addresses from natural language descriptions.
How It Works
SplitXCH creates special Chia blockchain addresses that automatically split incoming payments to multiple recipients based on configured percentages. The API computes a puzzle address; any XCH sent to that address gets distributed automatically on-chain.
Workflow
- 1. Parse the user's plain-language split description into recipients with percentages
- Convert percentages to basis points (scale to 9850 total, API adds 150 bps / 1.5% fee)
- For nested splits (splits-of-splits), build bottom-up: create leaf splits first, then use their addresses as recipients in parent splits
- Call the SplitXCH API via
scripts/splitxch.sh or direct curl - Return the generated split address and a summary
Basis Points Conversion
- - 10,000 bps = 100%. API fee = 150 bps (1.5%). Recipients get 9,850 bps total.
- Formula: INLINECODE1
- Adjust last recipient so points sum to exactly 9850.
Example: "Split 60/40 between Alice and Bob"
- - Alice: round(0.60 * 9850) = 5910
- Bob: 9850 - 5910 = 3940
Building the API Payload
CODEBLOCK0
Save to a temp file and run:
CODEBLOCK1
Nested Splits (>128 recipients or hierarchies)
When the user describes groups within groups:
- 1. Create each leaf-level split first via the API
- Use the returned
address as a recipient in the parent split - Each split level incurs its own 150 bps fee
Example: "Team A (Alice 50%, Bob 50%) gets 70%, Charlie gets 30%"
- 1. Create Team A split: Alice 4925 + Bob 4925 = 9850 → returns INLINECODE3
- Create parent split: TeamA address 6895 + Charlie 2955 = 9850
Validation Rules
- - All addresses must start with
xch1 and be valid bech32m - Max 128 recipients per split
- All addresses unique within a split
- Each recipient's points > 0
- Points must sum to exactly 9850
Output Format
After creating a split, present:
- 1. Split Address: The generated
xch1... address - Summary Table: Each recipient's name, address (truncated), and percentage
- Fee Note: "SplitXCH takes a 1.5% platform fee per split level"
- Usage: "Send XCH to this address and it will automatically distribute to all recipients"
If nested, show the full tree structure.
API Reference
For detailed API docs, validation rules, and error handling, see references/api.md.
Important Notes
- - The user MUST provide valid XCH wallet addresses for all recipients. If addresses are missing, ask for them before calling the API.
- If the user only provides names and percentages without addresses, list what's needed and ask.
- For dry runs / previews, show the calculated basis points without calling the API.
SplitXCH 版税分配构建器
根据自然语言描述创建复杂的XCH版税分配地址。
工作原理
SplitXCH创建特殊的Chia区块链地址,能够根据配置的百分比自动将收到的付款分配给多个接收方。该API计算谜题地址;发送到该地址的任何XCH都会在链上自动分配。
工作流程
- 1. 将用户的纯文本分配描述解析为带有百分比的接收方
- 将百分比转换为基点(总计缩放到9850,API额外增加150个基点/1.5%费用)
- 对于嵌套分配(分配中的分配),采用自底向上构建:先创建叶子分配,然后将其地址用作父分配中的接收方
- 通过scripts/splitxch.sh或直接curl调用SplitXCH API
- 返回生成的分配地址和摘要
基点转换
- - 10,000个基点 = 100%。API费用 = 150个基点(1.5%)。接收方总计获得9,850个基点。
- 公式:点数 = 取整(百分比 / 100 * 9850)
- 调整最后一个接收方,使点数总和恰好为9850。
示例:在Alice和Bob之间按60/40分配
- - Alice:取整(0.60 * 9850) = 5910
- Bob:9850 - 5910 = 3940
构建API负载
json
{
recipients: [
{name: Alice, address: xch1..., points: 5910, id: 1},
{name: Bob, address: xch1..., points: 3940, id: 2}
]
}
保存到临时文件并运行:
bash
bash /scripts/splitxch.sh /tmp/split-payload.json
嵌套分配(超过128个接收方或层级结构)
当用户描述组内分组时:
- 1. 首先通过API创建每个叶子级分配
- 将返回的address用作父分配中的接收方
- 每个分配层级产生其自身的150个基点费用
示例:A组(Alice 50%,Bob 50%)获得70%,Charlie获得30%
- 1. 创建A组分配:Alice 4925 + Bob 4925 = 9850 → 返回xch1teamA...
- 创建父分配:TeamA地址6895 + Charlie 2955 = 9850
验证规则
- - 所有地址必须以xch1开头且为有效的bech32m格式
- 每次分配最多128个接收方
- 同一分配内所有地址必须唯一
- 每个接收方的点数必须大于0
- 点数总和必须恰好为9850
输出格式
创建分配后,展示:
- 1. 分配地址:生成的xch1...地址
- 摘要表:每个接收方的名称、地址(截断)和百分比
- 费用说明:SplitXCH对每个分配层级收取1.5%的平台费用
- 使用说明:向此地址发送XCH,它将自动分配给所有接收方
如果是嵌套分配,显示完整的树形结构。
API参考
有关详细的API文档、验证规则和错误处理,请参见references/api.md。
重要说明
- - 用户必须为所有接收方提供有效的XCH钱包地址。如果缺少地址,请在调用API之前询问。
- 如果用户仅提供名称和百分比而没有地址,请列出所需信息并询问。
- 对于模拟运行/预览,显示计算出的基点而不调用API。