home / skills / cuyoconnect / stellar / stellar-skills

stellar-skills skill

/skills/stellar-skills

This skill helps you develop Stellar and Soroban dApps by guiding wallet integration, contract deployment, and RPC usage across networks.

npx playbooks add skill cuyoconnect/stellar --skill stellar-skills

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
6.9 KB
---
name: stellar-skills
description: Stellar blockchain and Soroban smart contract development. SDKs, wallets, DeFi protocols, and ecosystem tools. Use when building dApps on Stellar, writing Soroban contracts, integrating wallets, or working with Horizon/Soroban RPC.
---

# Stellar & Soroban Development

## Quick Reference

### Networks

| Network | Horizon | Soroban RPC | Explorer |
|---------|---------|-------------|----------|
| **Mainnet** | `horizon.stellar.org` | `soroban-rpc.mainnet.stellar.gateway.fm` | stellar.expert |
| **Testnet** | `horizon-testnet.stellar.org` | `soroban-testnet.stellar.org` | stellar.expert/explorer/testnet |
| **Futurenet** | `horizon-futurenet.stellar.org` | `rpc-futurenet.stellar.org` | stellarchain.io |

### Faucet (Testnet)

```bash
curl "https://friendbot.stellar.org?addr=YOUR_PUBLIC_KEY"
```

---

## CLIs & Scaffolds

| Tool | Use |
|------|-----|
| **stellar CLI** | Build, deploy, invoke contracts, generate TS bindings |
| **Scaffold Stellar** | Full project (Soroban + frontend + local network) → scaffoldstellar.org |
| **Stellar Lab** | Web tool for network experiments → lab.stellar.org |

---

## SDKs

| Library | Purpose |
|---------|---------|
| `@stellar/stellar-sdk` | Official JS/TS SDK (classic + Soroban) |
| `soroban-sdk` (Rust) | Write Soroban smart contracts |
| `@stellar/freighter-api` | Direct Freighter wallet integration |
| `@creit.tech/stellar-wallets-kit` | Multi-wallet abstraction → stellarwalletskit.dev |

---

## Workflows

### Workflow 1: Connect Wallet (Stellar Wallets Kit)

```typescript
import { StellarWalletsKit, WalletNetwork, allowAllModules } from '@creit.tech/stellar-wallets-kit';

const kit = new StellarWalletsKit({
  network: WalletNetwork.TESTNET,
  selectedWalletId: 'freighter',
  modules: allowAllModules(),
});

// Open modal to select wallet
await kit.openModal({
  onWalletSelected: async (option) => {
    kit.setWallet(option.id);
    const { address } = await kit.getAddress();
    console.log('Connected:', address);
  }
});
```

### Workflow 2: Deploy Contract (stellar CLI)

```bash
# Build contract
stellar contract build

# Deploy to testnet
stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/my_contract.wasm \
  --source alice \
  --network testnet

# Generate TypeScript bindings
stellar contract bindings typescript \
  --contract-id CXXXXX... \
  --output-dir ./src/contracts/my-contract \
  --network testnet
```

### Workflow 3: Invoke Contract

```typescript
import * as StellarSdk from '@stellar/stellar-sdk';

const server = new StellarSdk.SorobanRpc.Server('https://soroban-testnet.stellar.org');
const contract = new StellarSdk.Contract('CXXXXX...');

// Build transaction
const tx = new StellarSdk.TransactionBuilder(account, { fee: '100' })
  .addOperation(contract.call('method_name', ...args))
  .setTimeout(30)
  .build();

// Simulate
const simulated = await server.simulateTransaction(tx);

// Sign with wallet kit
const { signedTxXdr } = await kit.signTransaction(tx.toXDR());

// Submit
const result = await server.sendTransaction(
  StellarSdk.TransactionBuilder.fromXDR(signedTxXdr, StellarSdk.Networks.TESTNET)
);
```

### Workflow 4: Sign & Submit with Wallet Kit

```typescript
// For Soroban transactions that need simulation
const signedTx = await kit.signTransaction(tx.toXDR(), {
  networkPassphrase: StellarSdk.Networks.TESTNET,
});

// Submit and poll for result
const sendResponse = await server.sendTransaction(
  StellarSdk.TransactionBuilder.fromXDR(signedTx.signedTxXdr, StellarSdk.Networks.TESTNET)
);

if (sendResponse.status === 'PENDING') {
  let result = await server.getTransaction(sendResponse.hash);
  while (result.status === 'NOT_FOUND') {
    await new Promise(r => setTimeout(r, 1000));
    result = await server.getTransaction(sendResponse.hash);
  }
}
```

---

## OpenZeppelin Contracts (Soroban)

Audited contracts. **Check before writing custom logic.**

| Category | Includes |
|----------|----------|
| **Tokens** | Fungible, NFT, RWAs, Stablecoin, Vault (SEP-56) |
| **Access** | Ownable, Role-Based Access Control |
| **Utils** | Pausable, Upgradeable, Merkle Distributor |

Wizard: https://wizard.openzeppelin.com
Docs: https://docs.openzeppelin.com/stellar-contracts

---

## Security

| Tool | Use |
|------|-----|
| **Scout Audit** | Static analysis for Soroban → github.com/CoinFabrik/scout-soroban |
| **scout-actions** | GitHub Action for PR checks |

```bash
# Run Scout locally
cargo install scout-audit
scout-audit --path ./contracts
```

---

## Ecosystem

### DeFi & Protocols

| Project | What |
|---------|------|
| **Soroswap** | AMM/DEX → soroswap.finance |
| **Defindex** | Yield aggregator → defindex.io |
| **Allbridge** | Cross-chain bridge → allbridge.io |
| **Reflector** | Oracles (SEP-40) → reflector.network |

### Infrastructure & Services

| Project | What |
|---------|------|
| **Trustless Work** | Programmable escrows → trustlesswork.com |
| **Mercury** | Custom indexer (Retroshades, Zephyr) → mercurydata.app |
| **Horizon API** | Official API for network queries |
| **Anchor Platform** | On/off-ramps (SEP-10, SEP-24, SEP-31) |
| **Stellar Disbursement Platform** | Mass payouts infrastructure |
| **MoneyGram Ramps** | USDC on/off-ramp at retail locations |

### Block Explorers

| Explorer | Networks |
|----------|----------|
| **StellarExpert** | Mainnet, Testnet → stellar.expert |
| **StellarChain** | Mainnet, Testnet, Futurenet → stellarchain.io |
| **Stellar Explorer** | All networks |

### RPC Providers

| Provider | Notes |
|----------|-------|
| SDF (public) | Default, rate limited |
| Validation Cloud | Free + premium |
| Ankr | Horizon + Soroban RPC |
| QuickNode | Performance tiers |

---

## SEPs (Stellar Ecosystem Proposals)

| SEP | Purpose |
|-----|---------|
| **SEP-10** | Web Authentication |
| **SEP-24** | Interactive deposits/withdrawals |
| **SEP-41** | Soroban token interface |
| **SEP-56** | Tokenized Vault Standard |

All SEPs: github.com/stellar/stellar-protocol/tree/master/ecosystem

---

## Decision Framework

```
What are you building?
│
├─ **Smart Contract** (Soroban)
│  ├─ Token? → Check OpenZeppelin first
│  ├─ DeFi? → Integrate with Soroswap/Defindex
│  └─ Custom logic → Use soroban-sdk + Scout audit
│
├─ **Frontend dApp**
│  ├─ Wallet connection → Stellar Wallets Kit
│  ├─ Contract interaction → @stellar/stellar-sdk
│  └─ Full scaffold → Scaffold Stellar
│
├─ **Backend/Indexing**
│  ├─ Simple queries → Horizon API
│  ├─ Custom indexing → Mercury
│  └─ Real-time → Soroban RPC subscriptions
│
└─ **Payments/Ramps**
   ├─ On/off-ramp → Anchor Platform
   └─ Mass payouts → Stellar Disbursement Platform
```

---

## Docs

- https://developers.stellar.org
- https://soroban.stellar.org/docs
- https://stellarwalletskit.dev

**Principle**: Check for existing tools/protocols before writing custom code.

Overview

This skill packages practical guidance and tools for building on the Stellar blockchain and writing Soroban smart contracts. It consolidates network endpoints, CLIs, SDKs, wallet integration patterns, and common workflows for deploying, invoking, and signing Soroban contracts. Use it to accelerate dApp development, integrate wallets, or set up local and test networks for rapid iteration. It emphasizes audited libraries and security tooling to reduce risk in production deployments.

How this skill works

The skill maps common developer tasks to concrete commands, SDK calls, and recommended providers: Horizon and Soroban RPC endpoints for each network, the stellar CLI for building and deploying contracts, and SDK examples for simulation, signing, and submission. It describes wallet connection flows via Stellar Wallets Kit and shows how to generate TypeScript bindings and run static security checks with Scout. The content also points to OpenZeppelin Soroban contracts and ecosystem services when a ready-made solution exists.

When to use it

  • Building Soroban smart contracts (token, DeFi, or custom logic).
  • Developing frontend dApps that need wallet connection and transaction signing.
  • Deploying and testing contracts on testnet or futurenet before mainnet release.
  • Integrating payments, on/off-ramps, or mass payout systems.
  • Setting up backend indexing or real-time subscription services for contract events.

Best practices

  • Check OpenZeppelin audited contracts before writing custom token or access-control logic.
  • Always simulate Soroban transactions before signing and submission to catch runtime errors.
  • Use Scout static analysis and CI actions to run security checks on contract code.
  • Use wallet abstraction libraries (Stellar Wallets Kit) to support multiple wallet providers.
  • Prefer public RPC providers with SLAs for production; plan for rate limits and fallbacks.

Example use cases

  • Create and deploy a SEP-41 compliant token using OpenZeppelin Soroban contracts and generate TS bindings for your frontend.
  • Build a web dApp that connects to Freighter or other wallets via Stellar Wallets Kit, simulates transactions, and submits signed XDR.
  • Integrate Anchor Platform and Stellar Disbursement Platform for fiat on/off-ramps and mass payouts.
  • Run Scout audit and CI checks on a Soroban contract before deploying to testnet and mainnet.
  • Index custom contract events with Mercury or a custom indexer and serve data for analytics dashboards.

FAQ

Which network endpoints should I use for testing and production?

Use soroban-testnet.stellar.org and horizon-testnet.stellar.org for test development, and soroban-rpc.mainnet.stellar.gateway.fm with horizon.stellar.org for production. Futurenet endpoints exist for network-wide experiments.

How do I get test XLM for deployments?

Use the Testnet Friendbot: curl "https://friendbot.stellar.org?addr=YOUR_PUBLIC_KEY" to fund accounts on testnet.