stellar-dev

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Stellar Development Skill (Soroban-first)

Stellar 开发技能(优先使用 Soroban)

What this Skill is for

本技能适用场景

Use this Skill when the user asks for:
  • Soroban smart contract development (Rust)
  • Stellar dApp frontend work (React / Next.js / Node.js)
  • Wallet connection + signing flows (Freighter, etc.)
  • Transaction building / sending / confirmation
  • Stellar Asset issuance and management
  • Client SDK usage (JavaScript, Python, Go, Rust)
  • Zero-knowledge proof verification (where supported by target network/protocol)
  • Privacy-preserving applications (privacy pools, confidential tokens)
  • Local testing and deployment
  • Security hardening and audit-style reviews
当用户询问以下内容时使用本技能:
  • Soroban智能合约开发(Rust)
  • Stellar dApp前端开发(React / Next.js / Node.js)
  • 钱包连接与签名流程(Freighter等)
  • 交易构建/发送/确认
  • Stellar资产发行与管理
  • 客户端SDK使用(JavaScript、Python、Go、Rust)
  • 零知识证明验证(目标网络/协议支持的情况下)
  • 隐私保护应用(隐私池、保密代币)
  • 本地测试与部署
  • 安全加固与审计式评审

What this Skill is NOT for

本技能不适用场景

  • Bitcoin, Ethereum, Solana, or other non-Stellar blockchain development
  • Stellar node/validator operation (see validators docs)
  • General Rust programming unrelated to Soroban
  • Stellar protocol governance or CAP authoring
  • Bitcoin、Ethereum、Solana或其他非Stellar区块链开发
  • Stellar节点/验证器运维(请查看验证器文档
  • 与Soroban无关的通用Rust编程
  • Stellar协议治理或CAP撰写

Default stack decisions (opinionated)

默认技术栈决策(主观推荐)

1. Smart Contracts: Soroban (Rust)

1. 智能合约:Soroban(Rust)

  • Use Soroban SDK (
    soroban-sdk
    crate) for all smart contract development
  • Contracts compile to WebAssembly (WASM)
  • Use
    #![no_std]
    - standard library not available
  • 64KB contract size limit - use release optimizations
  • Prefer Stellar Assets over custom token contracts when possible
  • 所有智能合约开发均使用Soroban SDK(
    soroban-sdk
    crate)
  • 合约编译为WebAssembly(WASM)
  • 使用
    #![no_std]
    - 标准库不可用
  • 合约大小限制为64KB - 需使用发布版本优化
  • 尽可能优先使用Stellar资产而非自定义代币合约

2. Client SDK: stellar-sdk (JavaScript) first

2. 客户端SDK:优先使用stellar-sdk(JavaScript)

  • Use
    @stellar/stellar-sdk
    for browser and Node.js applications
  • Supports both Stellar RPC and legacy Horizon API
  • Full transaction building, signing, and submission
  • Soroban contract deployment and invocation
  • 浏览器和Node.js应用使用
    @stellar/stellar-sdk
  • 同时支持Stellar RPC和传统Horizon API
  • 完整的交易构建、签名与提交功能
  • Soroban合约部署与调用

3. API Access: Stellar RPC first (Horizon legacy-focused)

3. API访问:优先使用Stellar RPC(Horizon专注于传统场景)

  • Prefer Stellar RPC for new projects (JSON-RPC, real-time state)
  • Horizon API remains available for legacy compatibility and historical-query workflows
  • RPC: 7-day history for most methods;
    getLedgers
    queries back to genesis (Infinite Scroll)
  • Use Hubble/Galexie for comprehensive historical data beyond RPC
  • 新项目优先使用Stellar RPC(JSON-RPC,实时状态)
  • Horizon API仍可用于兼容性需求和历史查询工作流
  • RPC:多数方法支持7天历史数据;
    getLedgers
    可查询至创世区块(无限滚动)
  • 如需超出RPC范围的全面历史数据,请使用Hubble/Galexie

4. Token Strategy: Stellar Assets first

4. 代币策略:优先使用Stellar资产

  • Prefer Stellar Assets (classic issuance + trustlines) for fungible tokens
  • Built-in ecosystem support (wallets, exchanges, anchors)
  • Stellar Asset Contracts (SAC) provide Soroban interoperability
  • Use custom Soroban tokens only for complex logic requirements
  • 优先使用Stellar资产(经典发行+信任线)作为 fungible代币
  • 内置生态系统支持(钱包、交易所、锚点)
  • Stellar资产合约(SAC)提供Soroban互操作性
  • 仅在需要复杂逻辑时使用自定义Soroban代币

5. Testing

5. 测试

  • Local: Use Stellar Quickstart Docker for local network
  • Testnet: Use Testnet with Friendbot for funding
  • Unit tests: Compile to native for fast iteration
  • Integration tests: Deploy to local/testnet
  • 本地测试:使用Stellar Quickstart Docker搭建本地网络
  • 测试网:使用带Friendbot的测试网获取资金
  • 单元测试:编译为原生代码以加快迭代速度
  • 集成测试:部署至本地/测试网

6. Wallet Integration

6. 钱包集成

  • Freighter is the primary browser wallet
  • Use Stellar Wallets Kit for multi-wallet support
  • Wallet Standard for consistent connection patterns
  • Freighter是首选浏览器钱包
  • 使用Stellar Wallets Kit实现多钱包支持
  • 采用Wallet Standard确保一致的连接模式

7. Freshness policy

7. 时效性策略

  • Verify volatile facts (protocol support, RPC endpoints, CAP/SEP status, SDK API changes) against official docs before asserting them as current.
  • 在断言当前状态前,需对照官方文档验证易变信息(协议支持、RPC端点、CAP/SEP状态、SDK API变更)。

Operating procedure (how to execute tasks)

操作流程(任务执行方式)

1. Classify the task layer

1. 任务分层分类

  • Smart contract layer (Soroban/Rust)
  • Client SDK/scripts layer (JS/Python/Go)
  • Frontend/wallet layer
  • Asset management layer (issuance, trustlines)
  • Testing/CI layer
  • Infrastructure (RPC/Horizon/indexing)
  • 智能合约层(Soroban/Rust)
  • 客户端SDK/脚本层(JS/Python/Go)
  • 前端/钱包层
  • 资产管理层(发行、信任线)
  • 测试/CI层
  • 基础设施层(RPC/Horizon/索引)

Quick routing

快速路由

  • Need custom on-chain logic? → contracts-soroban.md
  • Building a frontend/dApp? → frontend-stellar-sdk.md
  • Issuing or managing tokens? → stellar-assets.md
  • Zero-knowledge proofs or privacy? → zk-proofs.md
  • Setting up tests/CI? → testing.md
  • Querying chain data or indexing? → api-rpc-horizon.md (also see Data Docs)
  • Security review? → security.md
  • Hit an error? → common-pitfalls.md
  • Need upgrade/factory/governance/DeFi architecture patterns? → advanced-patterns.md
  • Need SEP/CAP guidance and standards links? → standards-reference.md
  • 需要自定义链上逻辑?→ contracts-soroban.md
  • 开发前端/dApp?→ frontend-stellar-sdk.md
  • 发行或管理代币?→ stellar-assets.md
  • 零知识证明或隐私相关?→ zk-proofs.md
  • 设置测试/CI?→ testing.md
  • 查询链上数据或索引?→ api-rpc-horizon.md(另请查看数据文档
  • 安全评审?→ security.md
  • 遇到错误?→ common-pitfalls.md
  • 需要升级/工厂/治理/DeFi架构模式?→ advanced-patterns.md
  • 需要SEP/CAP指南及标准链接?→ standards-reference.md

2. Pick the right building blocks

2. 选择合适的构建模块

  • Contracts: Soroban Rust SDK + Stellar CLI
  • Frontend: stellar-sdk (JS) + Freighter/Wallets Kit
  • Backend: stellar-sdk (JS/Python/Go) + RPC
  • Assets: Classic operations or SAC for Soroban interop
  • Testing: Quickstart (local) or Testnet
  • 合约:Soroban Rust SDK + Stellar CLI
  • 前端:stellar-sdk(JS) + Freighter/Wallets Kit
  • 后端:stellar-sdk(JS/Python/Go) + RPC
  • 资产:经典操作或SAC(用于Soroban互操作)
  • 测试:Quickstart(本地)或测试网

3. Implement with Stellar-specific correctness

3. 遵循Stellar特定规范实现

Always be explicit about:
  • Network passphrase (Mainnet vs Testnet vs local)
  • Source account + sequence number
  • Fee + resource limits (for Soroban)
  • Authorization requirements
  • Trustline status for assets
  • Contract storage types (temporary vs persistent vs instance)
始终明确以下内容:
  • 网络密码(主网 vs 测试网 vs 本地)
  • 源账户+序列号
  • 手续费+资源限制(针对Soroban)
  • 授权要求
  • 资产的信任线状态
  • 合约存储类型(临时 vs 持久 vs 实例)

4. Add tests

4. 添加测试

  • Unit tests: Native compilation with
    #[test]
  • Integration tests: Local Quickstart or Testnet
  • Contract tests: Use
    Env
    from soroban-sdk
  • Frontend tests: Mock wallet/RPC interactions
  • 单元测试:使用
    #[test]
    进行原生编译
  • 集成测试:部署至本地Quickstart或测试网
  • 合约测试:使用soroban-sdk中的
    Env
  • 前端测试:模拟钱包/RPC交互

5. Deliverables expectations

5. 交付物要求

When you implement changes, provide:
  • Exact files changed + diffs
  • Commands to install/build/test/deploy
  • Network configuration (passphrase, RPC endpoint)
  • Risk notes for signing/fees/storage/authorization
当你实现变更时,请提供:
  • 具体修改的文件+差异内容
  • 安装/构建/测试/部署的命令
  • 网络配置(密码、RPC端点)
  • 签名/手续费/存储/授权相关的风险说明

Progressive disclosure (read when needed)

渐进式披露(按需阅读)

  • Smart contracts: contracts-soroban.md
  • Frontend + wallets: frontend-stellar-sdk.md
  • Testing strategy: testing.md
  • Stellar Assets: stellar-assets.md
  • Zero-knowledge proofs: zk-proofs.md
  • API access (RPC/Horizon): api-rpc-horizon.md
  • Security checklist: security.md
  • Common pitfalls: common-pitfalls.md
  • Advanced architecture patterns: advanced-patterns.md
  • SEP/CAP standards map: standards-reference.md
  • Ecosystem projects: ecosystem.md
  • Reference links: resources.md
  • 智能合约:contracts-soroban.md
  • 前端+钱包:frontend-stellar-sdk.md
  • 测试策略:testing.md
  • Stellar资产:stellar-assets.md
  • 零知识证明:zk-proofs.md
  • API访问(RPC/Horizon):api-rpc-horizon.md
  • 安全检查清单:security.md
  • 常见陷阱:common-pitfalls.md
  • 高级架构模式:advanced-patterns.md
  • SEP/CAP标准映射:standards-reference.md
  • 生态系统项目:ecosystem.md
  • 参考链接:resources.md

Keywords

关键词

stellar, soroban, xlm, smart contracts, rust, wasm, webassembly, rpc, horizon, freighter, stellar-sdk, soroban-sdk, stellar-cli, trustline, anchor, sep, passkey, smart wallet, sac, stellar asset contract, defi, token, nft, scaffold stellar, constructor, upgrade, factory, governance, standards, zero-knowledge, zk, zk-snark, groth16, bn254, poseidon, pairing, privacy, confidential, noir, risc zero, privacy pool, merkle tree
stellar, soroban, xlm, smart contracts, rust, wasm, webassembly, rpc, horizon, freighter, stellar-sdk, soroban-sdk, stellar-cli, trustline, anchor, sep, passkey, smart wallet, sac, stellar asset contract, defi, token, nft, scaffold stellar, constructor, upgrade, factory, governance, standards, zero-knowledge, zk, zk-snark, groth16, bn254, poseidon, pairing, privacy, confidential, noir, risc zero, privacy pool, merkle tree