In this guide, you’ll learn how to perform a full EIP-712-based Ethereum address verification for Farcaster using:Documentation Index
Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
Use this file to discover all available pages before exploring further.
- Privy RPC for secure off-chain signing
- Viem for EIP-712 hash computation and local signature verification
- Neynar API for submitting the verification to Farcaster
This tutorial is for advanced users who want to automate or deeply understand the Farcaster address verification process, including smart contract wallets.
Prerequisites
- Node.js ≥ 18
- A
.envfile with: - Install dependencies:
1. Setup & Imports
Start by importing dependencies and loading your environment variables:2. Environment Variables & Constants
Define your configuration and constants:3. EIP-712 Domain & Types
These are taken from Farcaster’s official EIP-712 spec:4. Compose the Typed Data
Build the EIP-712 message to be signed. Make sure to include the correctchainId and protocol fields as these are different for smart account verification:
5. Compute the EIP-712 Hash
Use Viem’shashTypedData to get the digest for signing:
hashTypedData directly due to an issue with privys typed data signers.
6. Sign via Privy RPC
Request a signature from Privy over the EIP-712 hash:secp256k1_sign due to the aforementioned issue with their typed signers.
7. Local Signature Verification
Double-check the signature locally before submitting:8. Submit to Neynar
Send the verification to Neynar for on-chain registration:9. Error Handling
If anything fails, log and exit:References & Further Reading
- EIP-712 Spec
- Farcaster Hub: validateVerificationAddEthAddressBody
- Farcaster Hub: verifyVerificationEthAddressClaimSignature
- Neynar Docs
- Privy Docs
Full Example Code: privy-validation-signer.ts
Full Example Code: privy-validation-signer.ts
privy-validation-signer.ts