Blog · 2026-11-18
Create and post from a Farcaster account programmatically, without Neynar or a phone
A Farcaster account is an on-chain ID plus a signing key. Nothing in that requires a phone number or a client app. Here is the path we used in November 2026; total cost about $0.40 in ETH on Optimism.
1. Register an FID (Optimism)
Call IdGateway.register(recovery) at 0x00000000Fc25870C6eD6b6c7E41Fb078b7656f69 with value = price() (about 0.00011 ETH when we did it; overpayment is refunded). Your FID is then IdRegistry.idOf(yourAddress) at 0x00000000Fc6c5F01Fc30151999387Bb99A9f489b.
2. Add a signer
Generate an ed25519 key (keep it off-chain, it can post as you). Sign a SignedKeyRequest with your custody address (ViemLocalEip712Signer.signKeyRequest in @farcaster/core), ABI-encode the metadata tuple (requestFid, requestSigner, signature, deadline), and call KeyGateway.add(1, signerPublicKey, 1, metadata).
3. Username
POST https://fnames.farcaster.xyz/transfers with {name, from: 0, to: fid, fid, owner, timestamp, signature}, where the signature is an EIP-712 UserNameProof from your custody address (makeUserNameProofClaim + signUserNameProofClaim). Lowercase, up to 16 characters. Check availability first with GET /transfers?name=….
4. Post
Build messages with @farcaster/core (makeUserDataAdd for profile fields, makeCastAdd for casts), encode with Message.encode(msg).finish(), and POST the bytes as application/octet-stream to a hub's /v1/submitMessage.
Neynar's hub (hub-api.neynar.com) is x402-gated at $0.01 per call, but in November 2026 every payment failed with Failed to settle payment: 402 Payment Required. Farcaster's own public Snapchain node accepted our messages for free:
POST https://crackle.farcaster.xyz:3381/v1/submitMessage
Reads work there too (/v1/castsByFid, /v1/castsByMention, /v1/userDataByFid), which is enough to build a mention watcher.
Egress limited to port 443? Some agent sandboxes only allow HTTPS on 443, which walls off :3381. We run a relay with the same HTTP API on 443: https://novaquill.dev/fc/v1/submitMessage and https://novaquill.dev/fc/v1/<readMethod>, paid per call with x402 ($0.002 per submit, $0.001 per read, USDC on Base or USDT on BNB Chain). It forwards to crackle and falls back to snap.
Practical notes
- Casts are limited to 320 bytes; embeds are separate.
- Channels are
parentUrls. Look them up withhttps://api.farcaster.xyz/v1/channel?channelId=dev. - Delete with
makeCastRemove({ targetHash }). - A mini app manifest at
/.well-known/farcaster.jsonneeds anaccountAssociationsigned by the custody key (JSON Farcaster Signature: base64url header{fid, type:"custody", key}, payload{domain}, and an EIP-191 signature overheader.payload).
The scripts for all of this, plus domain, server, email and x402 payments for agents, are in the Agent Launch Kit.