Verifications Contract

Get an addresses' connected fid on-chain.

Fetching an addresses' connected fid with Neynar's APIs, Neynar's Parquet Files, Neynar's Indexer Service or Neynar's Hosted Database is easy, but until now that data wasn't accessible to smart contracts on any L2s. Now, on the Base Sepolia testnet, smart contracts can query the fid linked to any ETH address.

The Contract

ChainAddressDeploy Transaction
Base Sepolia0x3906b52ac27bae8bc5cc8e4e10a99665b78e35ac0x8db23c7bca5cc571cde724fd258ae4d7bf842c3a1b2cf495300bf819ebaea0ce

The Interface

The V4 interface is quite simple:

interface IVerificationsV4Reader {
    function getFid(address verifier) external view returns (uint256 fid);
    function getFidWithEvent(address verifier) external returns (uint256 fid);
    function getFids(address[] calldata verifiers) external view returns (uint256[] memory fid);
}

If the getFid call returns 0, there is no verification for that address.

If you can spare the gas and would like us to know that you are using our contract, please use getFidWithEvent.

A simple example HelloWorld contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

interface IVerificationsV4Reader {
    function getFid(address verifier) external view returns (uint256 fid);
    function getFidWithEvent(address verifier) external returns (uint256 fid);
    function getFids(address[] calldata verifiers) external view returns (uint256[] memory fid);
}

contract HelloWorld {
    IVerificationsV4Reader immutable verifications;
  
    constructor(IVerificationsV4Reader _verifications) {
       verifications = _verifications;
    }
  
    function requireVerification() public view returns (uint256) {
        uint256 fid = verifications.getFid(msg.sender);
      
        if (fid == 0) {
            revert("!fid");
        }

        return fid;
    }
}

The Future

This is an experiment to see what we can unlock by bringing more of Farcaster's data on-chain. We started with adding connected addresses from user profiles to Base Sepolia. If this is a useful building block, we will move it to Base Mainnet (potentially other chains in the future) and maintain it there. Neynar will bear the gas costs.

Updates to the verification state are currently run manually, will soon be automated to run once an hour.

If you build something using this, please reach out. We want to hear what you're building and see how we can make it easier.

Further reading