home / skills / openclaw / skills / solana-connect

solana-connect skill

/skills/seenfinity/solana-connect

This skill enables autonomous OpenClaw agents to securely interact with the Solana blockchain, managing wallets, balances, and transactions.

npx playbooks add skill openclaw/skills --skill solana-connect

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

Files (7)
SKILL.md
3.2 KB
---
name: solana-connect
description: OpenClaw Solana Connect — Secure toolkit for AI agents to interact with Solana blockchain. Features private key protection, max limits, dry-run mode, and human confirmation for large transactions.
metadata:
  {
    "openclaw":
      {
        "requires":
          {
            "env": ["SOLANA_RPC_URL", "MAX_SOL_PER_TX", "MAX_TOKENS_PER_TX", "HUMAN_CONFIRMATION_THRESHOLD"],
          },
        "install":
          [
            {
              "id": "npm",
              "kind": "npm",
              "package": "@solana/web3.js",
              "label": "Install Solana Web3.js",
            },
            {
              "id": "npm",
              "kind": "npm", 
              "package": "tweetnacl",
              "label": "Install TweetNaCl",
            },
            {
              "id": "npm",
              "kind": "npm",
              "package": "bs58",
              "label": "Install bs58",
            },
          ],
      },
  }
---

# 🔗 OpenClaw Solana Connect v3.0

> Secure toolkit for AI agents to interact with Solana blockchain

## 🛡️ Security Features

- **Private Key Protection** - Keys never exposed to agent
- **Max Limits** - Configurable transaction limits
- **Dry-Run Mode** - Simulate before sending (default)
- **Human Confirmation** - Required for large transactions
- **Testnet Default** - Safe by default

## What Works

| Function | Status | Description |
|----------|--------|-------------|
| `generateWallet()` | ✅ Works | Generate wallet addresses |
| `connectWallet()` | ✅ Works | Validate wallet addresses |
| `getBalance()` | ✅ Works | Read SOL/token balances |
| `getTransactions()` | ✅ Works | Read transaction history |
| `getTokenAccounts()` | ✅ Works | Read token holdings |
| `sendSol()` | ✅ Works | Send SOL (with security) |

## Installation

```bash
clawhub install solana-connect
```

## Environment Variables

- `SOLANA_RPC_URL` - RPC endpoint (default: testnet)
- `MAX_SOL_PER_TX` - Max SOL per transaction (default: 10)
- `MAX_TOKENS_PER_TX` - Max tokens per transaction (default: 10000)
- `HUMAN_CONFIRMATION_THRESHOLD` - SOL amount requiring human confirmation (default: 1)

## Usage

```javascript
const { generateWallet, getBalance, sendSol, getConfig } = require('./scripts/solana.js');

// Generate wallet (address only - private key protected)
const wallet = generateWallet();
console.log('Address:', wallet.address);

// Check balance
const balance = await getBalance(wallet.address);

// Send SOL (DRY-RUN by default - simulation only)
const result = await sendSol(privateKey, toAddress, 0.5, { dryRun: true });
console.log('Simulation:', result);

// Send real transaction
const tx = await sendSol(privateKey, toAddress, 0.5, { dryRun: false, skipConfirmation: true });
console.log('Signature:', tx.signature);
```

## Security Options

```javascript
// Dry-run (simulation) - safe, doesn't send
await sendSol(key, to, amount, { dryRun: true });

// Real transaction - requires explicit flag
await sendSol(key, to, amount, { dryRun: false });

// Skip human confirmation (for automated agents)
await sendSol(key, to, amount, { dryRun: false, skipConfirmation: true });
```

---

**Security:** Never hardcode private keys. Use environment variables.

Overview

This skill is an OpenClaw-native toolkit that lets autonomous agents interact with the Solana blockchain. It provides wallet management, balance checks, token and NFT queries, transaction simulation and signing, and simple send operations. The toolkit is designed for agent-first workflows with sandboxing and permission controls to reduce risk.

How this skill works

The skill connects to a configurable Solana RPC endpoint and exposes high-level functions agents can call: connectWallet, getBalance, getTokenAccounts, sendSol, sendToken, and transaction simulation. It manages private keys in memory or via environment variables, simulates transactions for validation, and submits signed transactions to the network. The API returns structured results (balances, token lists, transaction signatures) so agents can make decisions and report outcomes.

When to use it

  • When an OpenClaw agent needs to check SOL, SPL token, or NFT balances for decision making.
  • When an agent must prepare, simulate, and submit Solana transactions programmatically.
  • When automating wallet management tasks like generating agent wallets or rotating keys.
  • When building agent-driven trading, monitoring, or DeFi automation on Solana.

Best practices

  • Always test on Solana testnet before switching to mainnet to avoid costly errors.
  • Use a dedicated agent wallet with limited funds and strict spending limits.
  • Store private keys in environment variables or secure vaults; do not hardcode keys.
  • Enable simulation and confirmations for large or critical transactions.
  • Continuously monitor transaction history and set alerts for unexpected activity.

Example use cases

  • Autonomous trading agent that analyzes markets and executes swaps on DEXs after simulation.
  • NFT floor monitor that alerts or bids when collection prices hit agent-defined thresholds.
  • Automated payout system that distributes rewards or salaries from a managed wallet.
  • DeFi yield optimizer that scans pools, simulates migrations, and executes profitable moves.
  • Portfolio reporting agent that compiles SOL, token, and NFT holdings into summaries.

FAQ

Can the skill send real funds?

Yes. The skill can sign and submit real transactions when pointed at a mainnet RPC and provided with private keys. Always use testnet first and a dedicated wallet.

How do I secure agent private keys?

Use environment variables or a secrets manager. Never store keys in source code or logs. Apply spending limits and require confirmations for large transactions.

Does it support NFTs and SPL tokens?

Yes. The skill can list token accounts, identify NFTs, fetch token metadata, and send SPL tokens.