Cover photo

Hats Modules: Programmable Extensions for Roles

Hats Modules are programmable extensions for roles, unlocking a major upgrade for onchain organizing and a modular playground for builders


  • Hats Modules are programmable extensions for roles

  • Modules can be connected to hats to expand their functionality, such as automatic granting/revocation and activation/deactivation based on specific conditions

  • Any builder can create their own module, plug it into their own hats tree permissionlessly, and even make it available in any app that supports the Hats Modules Registry

  • Any app can also tap into the Hats Modules infrastructure to offer these same module options to their end-users

  • The Hats Modules Stack provides a Schelling point for ecosystem-wide coordination around programmable organizations

Today we are launching Hats Modules and a major upgrade to the Hats Protocol Stack.

From day one of Hats, we have been working toward four success criteria:

  1. Implement a roles primitive via a secure and unopinionated core protocol

  2. Empower developers to build their own extensions and automations on top of the protocol

  3. Make it easy for developers to distribute the modules they create to the users that find them valuable

  4. And most importantly: deliver all of this via a world-class user experience at the application layer that is simple, straightforward, and scalable

With the new Hats Protocol Stack, we believe the foundations are in place for all four of these goals. Building on the efforts of our predecessors, we see this as a significant advancement in the state of the art in open-source composability.

We anticipate that this release will create a new Schelling point for the ecosystem to discover and share highly-performant, onchain organizational structures. And by doing so, that we will begin to create organizations that are capable of outperforming any government or company in history.

This article assumes baseline familiarity with Hats Protocol. If you’re new to Hats, please check out this article for an introduction.

Let’s dive in.

Introducing Hats Modules

At its core, Hats Protocol is a way for onchain organizations to create and manage roles. Roles have always been an essential part of computers and the internet, and Hats brings this primitive into Ethereum.

One of the key design criteria of the protocol was to keep the core architecture as simple as possible, while allowing for extensibility and creative expression in key areas. We have a fundamental principle of modularity which makes it possible to maintain simplicity for users without sacrificing decentralization or being overly opinionated.

The first and foremost area of extensibility is hat granting and revocation. This is expressed via the eligibility and toggle properties of each hat.

Hat Eligibility and Toggle

Eligibility: A hat’s eligibility property is an address that determines which other addresses are eligible to wear that hat. It can also revoke the hat if the wearer is no longer eligible.

Toggle: A hat’s toggle property is an address that determines whether the hat is active or inactive for all wearers.

Eligibilities and Toggles can be set to any Ethereum (or L2) address, meaning that individuals, multisigs, DAOs, and even any arbitrary smart contract can be granted these permissions.

This gets especially interesting — and the main focus of this article — when you set a hat’s eligibility or toggle to a smart contract. This allows you to connect arbitrary logic about when the hat can be held by a given wearer, or when a hat is active or inactive. This is what we call a module.

A Major Upgrade for Onchain Organizing

You can think of Hats Modules as programmable extensions for roles. Modules can be connected to hats to expand their functionality, such as enabling automatic granting and revocation of hats (and their associated permissions) based on specific conditions.

With the modules coming out with this release, you can already automate the granting and revocation of roles and permissions based on:

  • Tokens, NFTs, and attestations, including ERC20 token balance, ERC721 NFTs, ERC1155 NFT tokenIDs, and EAS attestations

  • Elections and allowlists, including election results from JokeRace, Snapshot, or Tally, automatic term limits, and manually-created allowlists

  • Achievements and reputation, like badges, onchain points, Colinks, or Gitcoin passport score

  • Prerequisite actions, like staking, signing an agreement, holding other roles, or being a subscriber

  • And more: combine multiple criteria with and/or logic, introduce AI agents, or create granular onchain or offchain triggers

The list of modules currently available in the Hats app (with step-by-step guides found in the docs) is a starting place based on commonly requested patterns. But this is just the beginning.

What is truly powerful about the Hats Protocol Stack is that any builder can create their own module, plug it into their own hats tree permissionlessly, and even make it available to the broader ecosystem via the Hats Modules Registry and SDK.

For the first time, an entire ecosystem of brilliant DAO nerds, governance designers, and smart contract developers now have a way of building and sharing their best approaches to creating an onchain organization.

If you’re a governance facilitator, network coordinator, community manager, or DAO operator, the implications are massive:

  • Save time and money by automating time-consuming community management tasks

  • Increase security through automatic granting and revocation of permissions based on your specified eligibility criteria

  • Increase decentralization by minimizing trusted actions and disintermediating human managers

  • Reduce headaches and wasted motion by simplifying member onboarding and offboarding

  • Inspire contributors to deepen their engagement by unlocking new roles and permissions automatically based on their achievements

Dive into the world of modules and experience the magic of programmatic granting and revocation, or contact us for help getting started.

Ready to see how the magic happens?

Where Hats Modules fit into the The Hats Protocol Stack

To understand how this all works, let’s take a look at each level of the stack. Hats Modules have parallels at the four key layers of the Hats Protocol Stack:

  • 0: Smart Contracts

  • 1: Indexed Data

  • 2: Middleware

  • 3: Applications

How the Hats Modules system (pictured right) fits into the broader Hats Protocol Stack

0. Smart Contracts: Hats Modules and the Hats Module Factory

The lowest layer is smart contracts. All Hats Modules are smart contracts. Anybody can develop and deploy a Hats Module permissionlessly. To help make this easier, we’ve built a factory contract that makes deploying new instances of a module quick and cheap.

To be deployable via Hats Module Factory, a module needs to support some basic functionality. We’ve created a suite of dev tools to make this easy for builders: the HatsModule base contract contains everything necessary to be compatible with the factory, and the hats-module-template repo is the fastest way to get started developing a new module.

1. Indexed Data: Hats Module Registry

Getting a module onchain is just the start. The next question is how to attach it to a hat so it can do its job.

We’ve created a Hats Modules Registry to keep track of all the safe, quality modules that can be deployed by the factory and made available in any app that supports the registry. In addition to basic information like the ABI and implementation deployment addresses, each item on the registry also has additional metadata that describes how applications should display configuration and deployment options.

2. Middleware: Hats Modules SDK

Like the Hats Core SDK, the Hats Modules SDK gives app developers powerful tools to bring module functionality into their apps. The Modules SDK serves two main functions: it packages up the module data from the registry for easy consumption, and exposes useful functions for deploying and configuring instances of modules on the registry via the Hats Module Factory.

3. Applications

At the top of the stack, apps can use the Hats Modules SDK to enable users to discover available modules; configure, deploy, and attach them to hats; and view their parameters and criteria. All without having to write any code specific to a single module.

Think about what this means:

  • Module developers can build a module and have it be usable with Hats across all apps with no additional steps other than submitting it to the registry

  • App developers can support all current and future modules without writing any module-specific code

  • Users can access the same current and future modules across all apps

The Hats App makes heavy use of the Modules SDK to power all the module-related functionality described in earlier sections. And Sobol is working with the SDK and Registry to bring module capabilities to their Hats Composer.

The Hats Modules Stack provides an open platform where anyone can build and share their modules with the broader ecosystem through the official Hats Modules Registry. Every layer, from smart contracts to applications, is designed in the spirit of modularity, fostering an environment that's both developer-friendly and user-centric, providing simple UX for wearers without sacrificing decentralization.

Hats modules for all. 🧢

A Modular Playground for Builders

Hats Modules give builders the power to create programmable roles that users can bring with them across the internet.

With the Hats Modules Stack, builders can:

  • Create programmable extensions for roles and automate granting and revocation of permissions based on custom logic

  • Get fast distribution to all Hats users by listing your module on the Hats Modules Registry and see it come to life in any app that supports the registry.

  • Create adapters to other protocols that facilitate the connection between Hats and various protocols or apps.

  • Focus on the functionality you’re building; the protocol handles the rest

  • Get started quickly with the hats-modules-template repo

Some of the types of modules you can create include:

  • Eligibility modules that determine which addresses are eligible to wear a hat, and that can automatically revoke the hat the instant the wearer becomes ineligible

  • Toggle modules that determine whether a hat is active or inactive for all wearers

  • Hatter contracts that serve as the admin or one or more hats to implement specific logic, rules, or changes to hats (such as changing hat details or minting hats to new addresses based on custom logic)

Builders of other applications can also tap into the Hats Modules infrastructure to offer these same module options to their end-users. We’ve built the Hats Modules SDK to make this easy.

The Hats Modules Registry is now open for submissions. You can now build Hats modules, add them to the registry, see them get used in any app that supports the registry, and join the protoDAO to get recognized for your contributions.

Today, the registry is a github repo that is curated by the Hats protoDAO. Submissions can be made by opening a pull request. In the future, we anticipate moving the registry onchain and progressively decentralizing the curation mechanism.

Hats: The Onchain Roles Protocol

At the protocol level, Hats is a tool for structuring organizations and delegating authorities. With this release, you can now embed any logic, rules, and accountabilities into your hats – while still maintaining all the benefits of decentralization and capture-resistance that DAOs can offer.

Hats Modules pave the way for new automations that can drive higher levels of organizational performance. Whether you're a member of a community or an individual builder, it's time to grab a hat and dive into this new era of programmable organizations.

Hats Protocol logo
Subscribe to Hats Protocol and never miss a post.