Stellar:自动化 XLM 交易和跨境支付 - Openclaw Skills

作者:互联网

2026-03-28

AI教程

什么是 Stellar?

Stellar 技能提供了一个强大的框架,用于通过 AI 代理与 Stellar 网络进行交互。它简化了复杂的区块链任务,例如管理交易所存款的备忘录 (memo) 要求、处理最低账户储备金以及执行多操作交易。通过将其集成到 Openclaw Skills 库中,开发人员可以高精度地自动化与原生 XLM 资产以及如 USDC 等琺幣支持代币的交互。

此技能旨在处理 Stellar 共识协议 (SCP) 的技术细节,包括快速终局性和低成本操作。它确保用户遵守关键的安全实践,例如在利用联合地址和多路复用地址进行易读且高效的路由时,绝不共享私钥。

下载入口:https://github.com/openclaw/skills/tree/main/skills/ivangdavila/stellar

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install stellar

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 stellar。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Stellar 应用场景

  • 自动化向中心化交易所转移 XLM,确保包含正确的备忘录字段以防止资金损失。
  • 管理账户激活和信任线储备,以便接收锚点发行的新资产。
  • 利用自动化路径支付和琺幣支持的锚点促进跨境支付通道。
  • 通过限价单坚控并执行去中心化交易所 (DEX) 交易。
  • 将多个操作批处理到单个交易中,以实现高效的链上活动。
Stellar 工作原理
  1. 在 Openclaw Skills 生态系统中初始化该技能,以授予代理访问 Stellar 网络协议的权限。
  2. 验证目标地址,区分公钥、联合地址和多路复用格式。
  3. 验证账户要求,确保维持至少 1 XLM 的余额以用于激活。
  4. 为发往中心化服务的交易配置强制性备忘录字段(文本、ID 或哈希)。
  5. 为 USDC 或 yXLM 等非原生资产建立必要的信任线,锁定所需的 0.5 XLM 储备金。
  6. 将交易广播到网络,并坚控 3-5 秒的终局性或序列号对齐情况。

Stellar 配置指南

要将此技能集成到您的工作流中,请按照以下配置步骤操作:

# 将 Stellar 技能添加到本地环境
openclaw install stellar

# 设置您的公共网络密钥(严禁在明文中使用您的私钥)
export STELLAR_PUBLIC_KEY="G..."

# 如果使用 Soroban 智能合约,请初始化基于 Rust 的环境
stellar network add --rpc-url https://horizon.stellar.org --network-passphrase "Public Global Stellar Network ; September 2015"

Stellar 数据架构与分类体系

该技能使用以下分类法组织 Stellar 特定的数据,以确保交易准确性:

属性 格式/规则 描述
公钥 G... (56 字符) Stellar 账户的标准公共标识符
备忘录 文本, ID, 或 哈希 交易所存款所需的关键元数据
基础储备 1.0 XLM 保持账户激活所需的最低余额
信任线 0.5 XLM 储备 每持有一种非原生资产所需的锁定金额
XDR Base64 字符串 用于预签名验证的交易包格式
name: Stellar
description: Assist with Stellar XLM transactions, anchors, memo requirements, and cross-border payments.
metadata: {"clawdbot":{"emoji":"??","os":["linux","darwin","win32"]}}

Memo Field (Critical)

  • Exchanges require memo for deposits — sending without memo loses funds
  • Memo can be text, ID, or hash — use exactly what exchange provides
  • Memo is NOT optional for exchanges — different from self-custody wallets
  • Personal wallets don't need memo — only centralized services
  • Verify memo type matches — text memo vs ID memo are different

Account Requirements

  • Minimum balance: 1 XLM base reserve — required to activate account
  • Each trustline adds 0.5 XLM reserve — locked, not spendable
  • Sending to new account must include 1+ XLM — creates the account
  • Merging account recovers reserve — must remove all trustlines first

XLM Token

  • Native asset of Stellar network — used for fees and reserves
  • Extremely low fees — 0.00001 XLM per operation (~$0.000001)
  • Fast finality — 3-5 seconds
  • No mining — Stellar Consensus Protocol (SCP)

Trustlines

  • Must trust an issuer before receiving their tokens — explicit opt-in
  • Trustline costs 0.5 XLM reserve — locked until removed
  • Remove trustlines to recover reserve — must have zero balance first
  • Scam tokens can't be forced on you — trustlines required

Anchors and Assets

  • Anchors issue fiat-backed tokens — USDC, yXLM (yield), various fiats
  • Stellar has native USDC — issued by Circle directly
  • Verify anchor reputation — not all are trustworthy
  • Path payments convert automatically — send USD, receive EUR

Addresses

  • Public keys start with "G" — 56 characters
  • Secret keys start with "S" — never share
  • Federated addresses: user*domain.com — human-readable, resolves to G address
  • Muxed addresses encode account + memo — M prefix, newer format

Transaction Features

  • Multiple operations per transaction — batch actions
  • Sequence number like Ethereum nonce — must be sequential
  • Time bounds optional — transactions can expire
  • Fee bumping available — increase fee on pending transaction

DEX and Trading

  • Built-in decentralized exchange — native to protocol
  • Order book model — limit orders, not AMM
  • Path payments find best route — automatic conversion
  • Swap aggregators exist — StellarX, Lobstr markets

Wallets

  • Lobstr — most popular, mobile and web
  • StellarTerm — web-based trading
  • Solar Wallet — Keybase team, desktop
  • Ledger support — hardware wallet via compatible apps
  • Freighter — browser extension for dApps

Common Issues

  • "Destination account does not exist" — account not created, needs 1+ XLM
  • "Missing memo" — exchange requires memo, transaction may be lost
  • "Insufficient balance" — must keep minimum reserve
  • "Trustline not established" — must add trustline before receiving token
  • Transaction stuck — rare on Stellar, usually instant

Cross-Border Payments

  • Designed for remittances — fast and cheap
  • Anchor network for fiat on/off ramps — varies by country
  • MoneyGram partnership — cash pickup locations
  • USDC corridors — stablecoin transfers between countries

Soroban (Smart Contracts)

  • Smart contract platform on Stellar — newer addition
  • Different from traditional Stellar operations — Rust-based contracts
  • Expanding Stellar capabilities — DeFi, NFTs becoming possible
  • Still maturing — ecosystem growing

Security

  • Seed phrase standard — 24 words
  • Multisig available — require multiple signatures
  • Sep-10 authentication — standard for web auth
  • Verify transaction details — XDR can be decoded before signing