App Wallet created in developer portal - Setup Guide
Funded wallet with $5+ ETH on Optimism (covers initial account pre-registration on first call)
New to App Wallets? All onchain operations require a wallet_id. See Managing Onchain Wallets to create your app wallet in the developer portal (self-service!).Recommended Setup Steps:
To register a new user, you need to claim an account for that user.
Cold Start (First Call Only): The first time you call this endpoint with a new wallet_id, it will take approximately 1 minute to complete as it pre-registers a few FID accounts. Subsequent calls will be fast (< 1 second). Make sure your wallet has $5+ ETH on Optimism before the first call.
Wallet Consistency Required: The same wallet_id used here must also be used in Step 5 when calling POST /v2/farcaster/user/. Using different wallets will result in an error.
Step 2: Ask the user to sign a message accepting their new Farcaster account
To create a Farcaster account, users must sign a message proving they’re willing to accept the account using a particular wallet address. The user needs to sign a message containing
fid (fetched in the previous step)
the address that will custody the Farcaster account (connected address on the client/app developer)
and a deadline until which their signature is valid. (generated by the client/app developer)
Usually, client or application developers must implement this step by constructing a message and asking the user to sign it in their connected web3 wallet.However, for the sake of testing out the flow, here’s a script that effectively produces the equivalent signatures you would get back from eth.sign
Create a file named generate-required-parameters.js
Copy
Ask AI
touch generate-required-parameters.js
Paste the following script in it. This script generates certain parameters that you’ll need to make the next API call.Replace FID_TO_COLLECT_SIGNATURE_FOR with fid returned from GET - /v2/farcaster/user/fid and NEW_ACCOUNT_MNEMONIC with a new account MNEMONIC.
Run the script to generate the necessary parameters for user registration. Get the FID i.e UNIQUE_FID from Step 1 and pass it on in the following command
Step 3: Add a managed signer to new account (optional)
If you want to add a managed signer to the new account during registration, you can include signer details in the registration request. This allows your application to manage the account on behalf of the user.
This script will output the signed_key_request_metadata_signature along with the signer_uuid, app_fid, and deadline that you’ll include in the registration request.
Step 4: Ask the user to pick their fname (optional)
Client applications should ask users to pick a username for their Farcaster account. The fname availability API should be used to check if their chosen username is available. The fname should match the following regex - /^[a-z0-9][a-z0-9-]{0,15}$/. Official regex defined in the farcaster/core library
Using the approved signer_uuid from the response in Step 5, you can ask the user to update their profile by picking a profile photo, display name, bio, and more.