Related API: Fetch signers
Important Note
The Neynar Client Instantiation and API calls (fetchNonce and fetchSigners) should ideally be performed on the backend to protect your API key and maintain security.
Prerequisites
Ethereum-Enabled Browser
Browser Ensure you are using a browser with a wallet like MetaMask installed.
API Key
Obtain an API key from dev portal
Code Breakdown and Steps
Configure Neynar API Client
Set up the Neynar API client with your API key and base path. Note that this should ideally be done on the backend for security reasons:
Create the Wallet Client
The
createWalletClient function initializes a wallet client using the viem library. It uses window.ethereum to connect to the browser’s wallet:Create the SIWE Message
The
createSiweMessage function generates a SIWE message with details such as domain, address, and nonce:Sign and Verify the Message
The
fetchSigners function retrieves the user’s Ethereum address, generates a SIWE message, signs it, and verifies the signature using the Neynar API.Note:- Neynar API should ideally be accessed from the backend
- The
addressshould be thecustody_addressof the farcaster account (Check custody_address in User API)

