Sismo Docs
  • Welcome to Sismo
    • What is Sismo?
  • Build with Sismo Connect
    • Overview
    • Installation
    • Sismo Connect Cheatsheet
    • Tutorials
      • Get Your appId - Create a Sismo Connect App
      • Onchain Tutorial (1/2): Code Your Airdrop Contract With Privately-Aggregated Data
      • Onchain Tutorial (2/2): Deploy Your Airdrop Contract
    • Technical Documentation
      • Sismo Connect Configuration
      • Auths
      • Claims
      • Signature
      • Packages
        • Sismo Connect Client: Request
        • Sismo Connect React: Request
        • Sismo Connect Server: Verify Offchain
        • Sismo Connect Solidity Library: Verify Onchain
    • FAQ
  • Data Groups
    • Overview
    • Tutorials
      • Factory Guide: Create a Data Group in 5 Minutes
      • Sismo Hub Guide: Create Data Groups Programmatically
      • Sismo Hub Guide: Add a Data Provider to the Sismo Factory
    • Sismo Hub
      • Sismo Hub Repository
        • Group Generators
        • Data Providers
        • Data Operators
        • Command Line Interface
      • Accounts Registry Tree
  • Data Vault
    • Overview
    • Vault Identifiers
    • Proving Schemes
      • Hydra-S1
      • Hydra-S2
    • Commitment Mapper
  • Resources
    • Deployed Contract Addresses
    • Sismo API
      • API Links
      • Query From a Client
      • Group
        • Get groups
        • Get group snapshots
      • Common Parameters
      • Advanced Filtering
      • Transaction
  • Links
    • Sismo Landing Page
    • Sismo Factory
    • Sismo App Store
    • Sismo Builder Resources
    • GitHub
    • Discord
    • Twitter
    • Blog
Powered by GitBook
On this page
  • Use a Data Provider
  • Create a new Data Provider
  • Setup the Data Provider
  • Make your Data Provider usable in the Sismo Factory
  1. Data Groups
  2. Sismo Hub
  3. Sismo Hub Repository

Data Providers

PreviousGroup GeneratorsNextData Operators

Last updated 1 year ago

Use a Data Provider

In a GroupGenerator, users can query data. We have developed dataProviders to facilitate querying. We currently support the following dataProviders:

  • AlchemyProvider: allows retrieving all holders of a specific NFT (ERC721 and ERC1155) on Ethereum mainnet

  • AnkrProvider: allows all holders of a specific token (ERC20 and ERC721) on specific network

  • AttestationStationProvider: allows you to query any attestation on Optimism's AttestationStation using a

  • BigQueryProvider: allows launching arbitrary BigQuery queries on the Ethereum mainnet and Polygon dataset

  • DegenScoreProvider: allows retrieving all holders of a beacon above a min score and with a specific trait

  • GithubProvider: allows you to quickly retrieve user information from GitHub (commiters, organization members, stargazers...)

  • GitPoapProvider: allows retrieving all Ethereum Addresses which have received a GitPoap with a given eventId

  • GraphQLProvider: allows launching arbitrary graphQL queries

  • GuildProvider: allows easily retrieving data from Guild.xyz

  • HiveProvider: allows you to easily retrieve data about Twitter influencers

  • LensProvider: allows retrieving social information on Lens Protocol (profiles, followers...)

  • PoapSubgraphProvider: allows retrieving all attendees of any events

  • RestProvider: allows launching arbitrary REST queries

  • SafeProvider: allows retrieving all owners of given Safe wallet on the Ethereum mainnet.

  • SnapshotProvider: allows querying all voters for a proposal or for an entire space

  • SubgraphHostedServiceProvider: allows launching arbitrary queries on any subGraph

  • TransposeProvider: allows you to launch arbitrary SQL requests on the Ethereum mainnet with (token holders, smart contracts interactions...)

  • WiwBadgeProvider: allows you to query WIW badge holders

Let's use the SnapshotProvider provider to create your group:


const generator: GroupGenerator = {
  generationFrequency: GenerationFrequency.Weekly,

  generate: async (context: GenerationContext): Promise<GroupWithData[]> => {
    // Instantiate your snapshot provider
    const snapshotProvider = new dataProviders.SnapshotProvider();
    // Query all voters
    const voters = await snapshotProvider.queryAllVoters({
      space: "ens.eth",
    });
    return [
      {
        name: "ens-voters",
        timestamp: context.timestamp,
        data: voters,
        valueType: ValueType.Info,
        tags: [Tags.Mainnet, Tags.Vote, Tags.User],
      },
    ];
  },
};

export default generator;

You can find here a complete tutorial describing all the Data Provider creation process steps:

Create a new Data Provider

If you want to create a group by fetching accounts from an API for example, you can of course do it manually and put the hardcoded list of addresses in your group. But now if you want your group to be regularly updated (monthly, weekly, ord daily), you'll also have to manually update the group monthly, weekly or daily.

This is where Data Providers come in, they will allow you to fetch data (addresses or web2 accounts) in order to update your group.

Moreover creating your own Data Provider allow you or anyone to use it in the future to create a group.

Setup the Data Provider

First, you'll need to create a new directory with the name of your data provider here: ./group-generators/helpers/data-providers/<DATA_PROVIDER_NAME>

In this directory, you will have to create 2 different files:

  • index.ts : It defines the API you want to use and the queries you want to add.

Here's where the different Data Providers elements will be displayed on the Factory:

And here is how to setup this:

  • First, create the interface-schema.json file with this format:

{
  "name": "<DATA_PROVIDER_NAME>", // the name displayed in the factory
  "iconUrl": "", // currently not implemented in the factory
  "providerClassName": "<DATA_PROVIDER_CLASS_NAME>", // the real name of the class
  "functions": [ // define all the functions
    {
      "name": "<FUNCTION_NAME>", // name displayed
      "functionName": "<FUNCTION_NAME>", // real name
      "countFunctionName": "<FUNCTION_COUNT_NAME>",
      "description": "<FUNCTION_DESCRIPTION>",
      "args": [ // define all the arguments
        {
          "name": "profile identifier", // name displayed
          "argName": "profileId", // real argument name
          "type": "string",
          "example": "sismo.lens | 0x26e5 | sismo.eth | 0xB0A179C459484885D1875009110F3cE3064867B9",
          "description": "A Lens profile identifier that could be either of a Lens handle, a Lens profile Id, an ENS or an Ethereum address"
        }
      ]
    },
    ...
  ]
}

Now, go to group-generators/helpers/data-providers/index.ts file:

  • Import your schema:

import <DATA_PROVIDER_NAME>InterfaceSchema from "./<DATA_PROVIDER_NAME>/interface-schema.json";
  • Add it to the dataProvidersInterfacesSchemas:

export const dataProvidersInterfacesSchemas = [
  ...
  <DATA_PROVIDER_NAME>InterfaceSchema,
];
  • Finally, as you can see, there is a black box at the bottom of the picture above. It allows users to see how many accounts your request will fetch (in real-time). It makes it easier for users to estimate their group size. So to set up this, add your Count Functions in the dataProvidersAPIEndpoints object :

export const dataProvidersAPIEndpoints = {
  ...
  <DATA_PROVIDER_CLASS_NAME>: {
    // add your count functions here
  },
};

You can explore the different Data Providers index.ts files to see some Count Functions examples.

Do not hesitate to explore the different existing Data Providers and consider them as models. It will surely help you with building yours! 🙌

In addition, if you want to create a Data Provider that uses a GraphQL or a REST API, you can use the already existing GraphQL and REST Data Providers.

The above information displays how to use data from external sources. Below, you can see how to combine groups with each other using .

interface-schema.json : This file is very important because it will allow you to make your Data Provider usable in the .

Make your Data Provider usable in the

Building a Data Provider is good, but making it usable for everyone in the is even better 🙌

Want to contribute but don't have any ideas of Data Providers to add? Check out the Sismo GitHub's current issues and our .

If you have any questions or you need help regarding Data Providers, do not hesitate to join our and ask us in #dev-support. We will be glad to answer you 🤗

Subgraph
Transpose
Data Operators
Sismo Hub Guide: Add a Data Provider to the Sismo Factory
Sismo Factory
Sismo Factory
Sismo Factory
https://github.com/sismo-core/sismo-hub/issues
Contributing guide
Discord