Sismo Docs
Search…
⌃K
Links

Group Generators

Groups are a reusable tool used by Sismo to generate available groups for attesters.
You will find more information on what are groups in this section:
Generating groups and making them available for an attester require some infrastructures. We have developed a repository, the sismo-hub, to let anyone propose new groups, and make them available for the HydraS1Attester, with a simple PR.
You will be able to:
  • Create your own group of accounts (Ethereum addresses, Github accounts and Twitter accounts)
  • Deploy your own metadata/image for an associated ZK badge
=> Your ZK Badge will be available to mint on the Sismo UI.
Here is a complete tutorial describing all these steps:
The following documentation aims to describe the code in a more theoretical way, we strongly recommend doing the tutorial to understand what the code below is for, especially for newcomers.

Generate Function

const generator: GroupGenerator = {
generationFrequency: GenerationFrequency.Once,
generate: async (context: GenerationContext): Promise<GroupWithData[]> => {
// add you code here
return [];
},
};
export default generator;
A group generator is a tool that allows to easily generate groups and store them in scalable infrastructure.
The GroupGenerator object is made of a generate function which will be executed at a specific GenerationFrequency.
Here the GenerationFrequency is Once. That means it will be executed just one time. It is an Enum that accepts Daily, Weekly or Monthly value.
Let's improve our group generator to return a very simple group:
const generator: GroupGenerator = {
generationFrequency: GenerationFrequency.Once,
generate: async (context: GenerationContext): Promise<GroupWithData[]> => {
return [
{
name: "my-simple-group",
timestamp: context.timestamp,
data: {
"0xF61CabBa1e6FC166A66bcA0fcaa83762EdB6D4Bd": 1,
"0x8ab1760889f26cbbf33a75fd2cf1696bfccdc9e6": 1,
"dhadrien.sismo.eth" : 1,
"dhadrien.lens": 1,
"github:leosayous21": 2,
"github:dhadrien": 4,
"twitter:dhadrien_": 3
},
accountSources: [AccountSource.ETHEREUM,
AccountSource.GITHUB,
AccountSource.TWITTER],
valueType: ValueType.Info,
tags: [Tags.Mainnet, Tags.User],
},
];
},
};
export default generator;
In the above example, the group generator will create a group named my-simple-group. Its timestamp will corresponds to the execution of the generate function.
This group, my-simple-group, contains 7 accounts, four Ethereum addresses (two addresses as you know them, one ENS handle and one Lens handle) which all have a value of 1, two Github accounts with values of 2 and 4 and one Twitter account with a value of 3 as you can see in the data field.
  • AccountSource is used to track the type of accounts in the generated groups.
  • Tags are used to easily retrieve groups once they are generated.
ENS handles and Lens handles are supported in group creations. They need to be referenced as an ETHEREUM account source in accountSources (since you have ethereum addresses, GitHub accounts and Twitter accounts in my-simple-group, you can notice that we also reference GITHUB and TWITTER in accountSources).
Learn how to query data easily:
Learn how to combine groups easily:

Generate your group

You can find all the groups that can be generated in the group-generators/generators folder. This is where you need to reference your group to see it generated in the future.
import ensVoters from "./ens-voters";
import ethereumDevelopers from "./ethereum-developers";
import ethereumMostTransactions from "./ethereum-most-transactions";
import ethereumPowerUsers from "./ethereum-power-users";
...
import sismoLensFollowers from "./sismo-lens-followers";
import sismoMasqueradeLensFollowers from "./sismo-masquerade-lens-followers";
import { GroupGeneratorsLibrary } from "topics/group-generator";
export const groupGenerators: GroupGeneratorsLibrary = {
"ens-voters": ensVoters,
"ethereum-developers": ethereumDevelopers,
"ethereum-most-transactions": ethereumMostTransactions,
"ethereum-power-users": ethereumPowerUsers,
...
"sismo-lens-followers": sismoLensFollowers,
"sismo-masquerade-lens-followers": sismoMasqueradeLensFollowers,
};
For more information or help, Join us on discord.