Integration with Farcaster
When building a social dApp, you face a dilemma: use a centralized API or a blockchain with high fees. Farcaster offers a third path—a decentralized protocol with off-chain messages and on-chain identity. Farcaster is a protocol where every action requires no gas, and identity is tied to Ethereum via FID. We have integrated it into more than 30 projects over the years, and now your project can join this ecosystem.
Farcaster is a decentralized social protocol with on-chain identity (Ethereum) and off-chain messages (Hubs). Unlike Lens, Farcaster prioritizes speed and developer experience: no gas per action, no blockchain latency for messages. A rapidly growing ecosystem with Warpcast as the main client. Authentication via SIWF takes 2 seconds, and Frames allow creating interactive posts without page reload.
Why Farcaster is Better Than Lens
| Criteria | Farcaster | Lens Protocol |
|---|---|---|
| Gas per action | None (off-chain messages) | Yes, per transaction |
| Developer experience | High (Neynar API, Frog) | Medium (Polygon signatures) |
| Message speed | Instant | Depends on blockchain |
| Frames (interactive) | Built-in support | Requires external solutions |
| Authentication | SIWF (Sign In With Farcaster) | SIWE (Sign In With Ethereum) |
Farcaster provides 10x lower latency for messages and requires no gas fees per action, which is critical for social applications. In a real project—an NFT marketplace—we reduced authentication time to 2 seconds, and cast publishing is instantaneous.
How to Integrate Farcaster into Your Project
The integration process consists of four stages:
- Analytics — Determine required features: authentication, Frames, channels, data reading. Choose a Hubs provider: Neynar (managed, fast startup) or Pinata (self-hosted).
- Design — Set up Ed25519 signer keys, choose stack: Frog for Frames, @farcaster/auth-kit for SIWF, Neynar API for data.
- Implementation — Write smart contracts (if needed), server handlers, client hooks. Optimize gas for on-chain transactions via EIP-1559.
- Testing and Deployment — Test in Warpcast and other clients, use Frog emulator for local debugging, run load testing.
Key Components of Integration
- FID (Farcaster ID): On-chain identifier on Optimism. Registered once, costs gas. We assist with registration and management.
- Frames: Interactive elements directly in the feed—mini-apps within posts. Stack: Frog (TypeScript), Open Graph images.
- Sign In With Farcaster (SIWF): Authentication via Farcaster account—analogous to SIWE. Use @farcaster/auth-kit for React.
- Neynar API: Managed Hub API, eliminates the need to run your own Hub. Provides cast publishing, feed reading, user search.
Real Case: Farcaster Integration for a P2P Platform
A client wanted to add social features to their P2P token exchange platform. The main tasks were authentication via Farcaster and publishing deals into channels. We implemented SIWF with @farcaster/auth-kit in 3 days, configured Neynar API to read follower feeds, and created custom Frames for deal confirmation right in the feed. Users could complete exchanges without leaving Warpcast. Result: authentication time reduced by 5x, completed deals increased by 40%.
Example Frame Implementation
import { Frog } from "frog";
import { Button, FrameContext } from "frog";
const app = new Frog({ basePath: "/api" });
// Simple frame with NFT minting
app.frame("/mint-nft", async (c: FrameContext) => {
const { buttonValue, frameData } = c;
let status = "ready";
let txHash = "";
if (buttonValue === "mint") {
// Initiate mint transaction
try {
txHash = await mintNFT(frameData?.fid?.toString() ?? "");
status = "minted";
} catch {
status = "error";
}
}
return c.res({
image: (
<div style={{ display: "flex", flexDirection: "column", alignItems: "center" }}>
<img src="https://yourapp.com/nft-preview.png" width="400" height="300" />
{status === "minted" && <p>Minted! TX: {txHash.slice(0, 10)}...</p>}
{status === "error" && <p>Error minting. Try again.</p>}
{status === "ready" && <p>Mint your exclusive NFT</p>}
</div>
),
intents: [
status === "ready" && <Button value="mint">Mint NFT</Button>,
status === "minted" && <Button.Link href={`https://etherscan.io/tx/${txHash}`}>View TX</Button.Link>,
],
});
});
Example Working with Neynar API
import { NeynarAPIClient } from "@neynar/nodejs-sdk";
const neynar = new NeynarAPIClient({ apiKey: process.env.NEYNAR_API_KEY! });
// Publish a cast (post)
const cast = await neynar.publishCast(
signerUUID, // UUID of signer registered via Neynar
"Hello Farcaster! #web3",
{
embeds: [{ url: "https://yourapp.com/post/123" }],
channelId: "dev", // publish in /dev channel
}
);
// Get feed by FID
const feed = await neynar.fetchFeed("following", {
fid: 12345,
limit: 25,
cursor: nextCursor,
});
// Get followers
const followers = await neynar.fetchUserFollowers({ fid: 12345 });
// Search users
const users = await neynar.searchUser("alice", { viewerFid: myFid });
Authentication via SIWF
import { createAppClient, viemConnector } from "@farcaster/auth-client";
const appClient = createAppClient({
ethereum: viemConnector(),
});
// Create channel for auth
const { channelToken, url, nonce } = await appClient.createChannel({
siweUri: "https://yourapp.com/login",
domain: "yourapp.com",
});
// User scans QR code or follows link in Warpcast
// After confirmation — get status
const status = await appClient.watchStatus({ channelToken });
if (status.data.state === "completed") {
const { fid, displayName, pfpUrl, username } = status.data;
// User authenticated
await createUserSession(fid, username);
}
React Hooks for Farcaster
import { AuthKitProvider, useSignIn } from "@farcaster/auth-kit";
function LoginButton() {
const { signIn, isLoading, isSuccess, profile } = useSignIn({
onSuccess: (res) => {
console.log(`Logged in as ${res.username} (FID: ${res.fid})`);
},
});
return (
<button onClick={signIn} disabled={isLoading}>
{isLoading ? "Connecting..." : "Sign In with Farcaster"}
</button>
);
}
function App() {
return (
<AuthKitProvider
config={{
rpcUrl: "https://mainnet.optimism.io",
domain: "yourapp.com",
siweUri: "https://yourapp.com/login",
}}
>
<LoginButton />
</AuthKitProvider>
);
}
Common Issues During Farcaster Integration
- Signer key expiration: Ed25519 keys have a limited lifespan. We use TTL logic with automatic renewal via Neynar.
- Cast publishing error: Often due to incorrect signerUUID. We verify signer registration through the Neynar Dashboard.
- Gas for Frames with transactions: Optimize smart contract calls, use EIP-1559 for predictable costs.
- Frames incompatibility across clients: Test in Warpcast, Supercast, and through the Frog emulator.
What's Included in the Work
- Development of smart contracts (if custom logic is required)
- Configuration of Neynar API and signer keys
- Implementation of SIWF with @farcaster/auth-kit
- Creation of Frames using Frog
- Integration of channels and feed reading
- Code documentation and deployment instructions
- Technical support for 2 weeks after deployment
- Credential handover and training for your team
Get your Farcaster integration started so your dApp becomes part of a rapidly growing ecosystem.
Timeline and Cost
| Stage | Duration | Result |
|---|---|---|
| SIWF + basic social feed | from 1 week | Ready authentication, follower feed |
| Frames with transactions | from 1 week | Interactive posts with minting/voting |
| Full package (SIWF + Frames + channels + custom contracts) | from 3 weeks | Full-fledged social dApp on Farcaster |
Cost is calculated individually after project evaluation. Get a consultation from our engineer—contact us, and we'll provide an initial estimate within a day.
We guarantee code quality and adherence to security standards. Trust the integration to professionals with 30+ projects of experience.







