rishavmukherji

Farcaster Agent

内容创作v1.2.0
作者:rishavmukherji更新于 2026-05-18共 4 个版本 · 最新版本发布于 2026-02-04farcaster-agent@clawhub_rishavmukherji/farcaster-agent
自媒体运营

据 AlphaMoat 统计,截至 2026-09,Farcaster Agent 累计下载 3,861 次、获 10 个星标,在全部 5,078 个 AI 技能中排名第 2,702 位,在「内容创作」分类(362 个)中排名第 186 位。

累计安装
126
累计下载
3,861
星标
10
全站排名
#2,702
全站前 54% · 「内容创作」前 52%
平台累计安装累计下载星标评论
ClawHub ↗1263,861101
SkillHub ↗1243,82810—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

自动流程可能创建或使用钱包、桥接或交换资产、提交链上交易并公开发布内容;凭据可能以明文 JSON 保存。应使用仅含少量资金的专用钱包,安全管理密钥,并在授权交易或发布前核对内容与操作。 禁用明文自动保存或使用安全凭据存储,安装前审查依赖。

资料发布于 2026-10-29

可以用来做什么

  • 了解 Farcaster 账户注册和资料设置步骤
  • 审阅发布 cast 或签名交易前的安全事项

什么时候用

  • 用户明确授权创建账户或发布内容,并已审查钱包、凭据存储和链上操作时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

概述注册 Farcaster 身份和配置资料的步骤,不要创建钱包或提交交易。
发布前整理需要确认的 cast 内容、签名密钥和链上交易。

月度数据趋势

累计下载3,861
3,1333,5243,9152026-05 · 累计下载 3,1872026-06 · 累计下载 3,3222026-07 · 累计下载 3,5682026-08 · 累计下载 3,6642026-09 · 累计下载 3,86126-0526-09
星标10
910112026-05 · 星标 102026-06 · 星标 102026-07 · 星标 102026-08 · 星标 102026-09 · 星标 1026-0526-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-093,861—10
2026-083,664+2.7%10
2026-073,568+7.4%10
2026-063,322+4.2%10
2026-053,187—10

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

8.5 KB · ClawHub v1.2.0
---
name: farcaster-agent
description: Create Farcaster accounts and post casts autonomously. Official skill from the Farcaster team.
metadata: {"openclaw":{"emoji":"🟣","requires":{"bins":["node","npm"],"env":[]},"install":[{"id":"npm","kind":"shell","command":"cd {baseDir}/.. && npm install","label":"Install dependencies"}]}}
---

# Farcaster Agent

Official skill from the Farcaster team. Create and manage a Farcaster account autonomously. Register a new Farcaster identity (FID), add signing keys, set up a profile with username, and post casts to the network.
展开全部(共 300 行)
## When to Use This Skill

Use this skill when:
- You need to create a Farcaster account from scratch
- You want to post casts (messages) to Farcaster
- You need to set up a profile with username, bio, and profile picture
- You want autonomous presence on the Farcaster social network

## Prerequisites

You need approximately **$1 of ETH or USDC** on any major chain (Ethereum, Optimism, Base, Arbitrum, or Polygon). The skill handles bridging and swapping automatically.

## Complete Flow

### Step 1: Generate Wallet and Request Funding

If you don't have a funded wallet, create one first:

```javascript
const { Wallet } = require('ethers');

const wallet = Wallet.createRandom();
console.log('Address:', wallet.address);
console.log('Private Key:', wallet.privateKey);
```

**Ask your human:** "I've created a wallet. Please send ~$1 of ETH or USDC to `<address>` on any of these chains: Ethereum, Optimism, Base, Arbitrum, or Polygon. Let me know when done."

**Save the private key securely** - you'll need it for all subsequent steps.

### Step 2: Run Auto-Setup

Once funded, run the complete setup:

```bash
cd {baseDir}/..
PRIVATE_KEY=0x... node src/auto-setup.js "Your first cast text here"
```

This will:
1. Detect which chain has funds (ETH or USDC)
2. Bridge/swap to get ETH on Optimism and USDC on Base
3. Register your FID (Farcaster ID)
4. Add a signer key
5. Wait for hub synchronization
6. Post your first cast
7. **Automatically save credentials** to persistent storage

### Step 3: Credentials are Saved Automatically

Credentials are automatically saved to:
- `~/.openclaw/farcaster-credentials.json` (if OpenClaw is installed)
- `./credentials.json` (fallback)

**Security Warning:** Credentials are stored as **plain text JSON**. Anyone with access to these files can control the wallet funds and Farcaster account. For production use, implement your own secure storage.

You can verify and manage credentials:

```bash
cd {baseDir}/..

# List all stored accounts
node src/credentials.js list

# Get credentials for active account
node src/credentials.js get

# Show credentials file path
node src/credentials.js path
```

To disable auto-save, use `--no-save`:
```bash
PRIVATE_KEY=0x... node src/auto-setup.js "Your cast" --no-save
```

## Posting Casts

To post additional casts, load credentials from storage:

```javascript
const { postCast, loadCredentials } = require('{baseDir}/../src');

// Load saved credentials
const creds = loadCredentials();

const { hash } = await postCast({
  privateKey: creds.custodyPrivateKey,
  signerPrivateKey: creds.signerPrivateKey,
  fid: Number(creds.fid),
  text: 'Your cast content'
});

console.log('Cast URL: https://farcaster.xyz/~/conversations/' + hash);
```

Or via CLI with environment variables:

```bash
cd {baseDir}/..
PRIVATE_KEY=0x... SIGNER_PRIVATE_KEY=... FID=123 node src/post-cast.js "Your cast content"
```

## Setting Up Profile

To set username, display name, bio, and profile picture:

```bash
cd {baseDir}/..
PRIVATE_KEY=0x... SIGNER_PRIVATE_KEY=... FID=123 npm run profile myusername "Display Name" "My bio" "https://example.com/pfp.png"
```

Or programmatically:

```javascript
const { setupFullProfile } = require('{baseDir}/../src');

await setupFullProfile({
  privateKey: '0x...',
  signerPrivateKey: '...',
  fid: 123,
  fname: 'myusername',
  displayName: 'My Display Name',
  bio: 'I am an autonomous AI agent.',
  pfpUrl: 'https://api.dicebear.com/7.x/bottts/png?seed=myagent'
});
```

### Fname (Username) Requirements

- Lowercase letters, numbers, and hyphens only
- Cannot start with a hyphen
- 1-16 characters
- One fname per account
- Can only change once every 28 days

### Profile Picture Options

For PFP, use any publicly accessible HTTPS image URL:
- **DiceBear** (generated avatars): `https://api.dicebear.com/7.x/bottts/png?seed=yourname`
- IPFS-hosted images
- Any public image URL

## Cost Breakdown

| Operation | Cost |
|-----------|------|
| FID Registration | ~$0.20 |
| Add Signer | ~$0.05 |
| Bridging | ~$0.10-0.20 |
| Each API call | $0.001 |
| **Total minimum** | **~$0.50** |

Budget $1 to have buffer for retries and gas fluctuations.

## API Endpoints

### Neynar Hub API (`https://hub-api.neynar.com`)
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/v1/submitMessage` | POST | Submit casts, profile updates (requires x402 payment header) |
| `/v1/onChainIdRegistryEventByAddress?address=<addr>` | GET | Check if FID is synced for address |
| `/v1/onChainSignersByFid?fid=<fid>` | GET | Check if signer keys are synced |

### Neynar REST API (`https://api.neynar.com`)
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/v2/farcaster/cast?identifier=<hash>&type=hash` | GET | Verify cast exists on network |

### Farcaster Fname Registry (`https://fnames.farcaster.xyz`)
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/transfers` | POST | Register or transfer an fname (requires EIP-712 signature) |
| `/transfers/current?name=<fname>` | GET | Check fname availability (404 = available) |

### x402 Payment
- **Address:** `0xA6a8736f18f383f1cc2d938576933E5eA7Df01A1`
- **Cost:** 0.001 USDC per API call (on Base)
- **Header:** `X-PAYMENT` with base64-encoded EIP-3009 `transferWithAuthorization` signature

## Common Errors

### "invalid hash"
Cause: Old library version. Fix: Run `npm install @farcaster/hub-nodejs@latest`

### "unknown fid"
Cause: Hub hasn't synced your registration yet. Fix: Wait 30-60 seconds and retry.

### Transaction reverts when adding signer
Cause: Metadata encoding issue. Fix: The code already uses the correct `SignedKeyRequestValidator.encodeMetadata()` method.

### "fname is not registered for fid"
Cause: Hub hasn't synced your fname registration. Fix: Wait 30-60 seconds (the code handles this automatically).

## Manual Step-by-Step (If Auto-Setup Fails)

If auto-setup fails partway through, you can run individual steps:

```bash
cd {baseDir}/..

# 1. Register FID (on Optimism)
PRIVATE_KEY=0x... node src/register-fid.js

# 2. Add signer key (on Optimism)
PRIVATE_KEY=0x... node src/add-signer.js

# 3. Swap ETH to USDC (on Base, for x402 payments)
PRIVATE_KEY=0x... node src/swap-to-usdc.js

# 4. Post cast
PRIVATE_KEY=0x... SIGNER_PRIVATE_KEY=... FID=123 node src/post-cast.js "Hello!"

# 5. Set up profile
PRIVATE_KEY=0x... SIGNER_PRIVATE_KEY=... FID=123 npm run profile username "Name" "Bio" "pfp-url"
```

## Programmatic API

All functions are available for import:

```javascript
const {
  // Full autonomous setup
  autoSetup,
  checkAllBalances,

  // Core functions
  registerFid,
  addSigner,
  postCast,
  swapEthToUsdc,

  // Profile setup
  setProfileData,
  registerFname,
  setupFullProfile,

  // Credential management
  saveCredentials,
  loadCredentials,
  listCredentials,
  setActiveAccount,
  updateCredentials,
  getCredentialsPath,

  // Utilities
  checkFidSync,
  checkSignerSync,
  getCast
} = require('{baseDir}/../src');
```

## Example: Full Autonomous Flow

```javascript
const { Wallet } = require('ethers');
const { autoSetup, setupFullProfile } = require('{baseDir}/../src');

// 1. Generate wallet (or use existing)
const wallet = Wallet.createRandom();
console.log('Fund this address with $1 ETH or USDC:', wallet.address);

// 2. After human funds the wallet, run setup
const result = await autoSetup(wallet.privateKey, 'gm farcaster!');

console.log('FID:', result.fid);
console.log('Signer:', result.signerPrivateKey);
console.log('Cast:', result.castHash);

// 3. Set up profile
await setupFullProfile({
  privateKey: wallet.privateKey,
  signerPrivateKey: result.signerPrivateKey,
  fid: result.fid,
  fname: 'myagent',
  displayName: 'My AI Agent',
  bio: 'Autonomous agent on Farcaster',
  pfpUrl: 'https://api.dicebear.com/7.x/bottts/png?seed=myagent'
});

console.log('Profile: https://farcaster.xyz/myagent');
```

## Source Code

The complete implementation is at: https://github.com/rishavmukherji/farcaster-agent

For detailed technical documentation, see the AGENT_GUIDE.md in that repository.

「内容创作」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。