project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

AtQL (Attestation Query Language)

AtQL is a tool for developers to create complex conditions and query the attestations stored in EAS (Ethereum Attestation Service) schemas and the data stored alongside them. It enables developers to make decisions based on attestations, such as capabilities for voting, etc.

AtQL (Attestation Query Language)

Created At


Winner of


💫 Optimism — 🥉 Best App for RetroPGF, PG, or Impact

Project Description

The goal of AtQL (Attestation Query Language) library is to provide a simple DSL (domain-specific language) for building queries and then executing the queries on attestations recorded on EAS (Ethereum Attestation Service) schemas.

The library aims to provide options for creating complex queries based on the top-level fields recorder by EAS (such as "attester" and "time") and on the "data" field that a schema accepts. The "data" field is schema-specific and can contain multiple fields alongside the values that are stored.

The DSL is powerful and extensible and developers can combine queries across schemas if necessary.

The library also provides functionality to streamline the deployment of new schemas, making new attestations or revoking existing attestations, and avoid boilerplate code.

The project started in an effort to gate content based on attestation: but the created DSL is general and can be used for other purposes as well, for example, for analysing patterns in the attestations recorded by EAS.

Alongside the library, there is a "demo" web application to showcase some of the concepts and how the library can be used as an attestation-based content gating system. It's not meant to be a production website by any means and it's geared towards a simple demonstration.

How it's Made

The main component of the library is the "AttestationQueryBuilder". By chaining function calls, users can create complex queries for the attestation data. There are two types of "conditions":

  • database-level conditions: conditions for the fields recorded by EAS for each attestation, such as "recipient", "attester", "time", "revoked"
  • data-level conditions: conditions for the fields that are recorded as part of the "data" field stored for each EAS attestation (the conditions follow the naming pattern "data*" to be distinguishable)

This allows for powerful filtering of data which is important since anyone can create attestations on EAS and only trustworthy data need to be fetched for making decisions programmatically.

The query which is being built by "AttestationQueryBuilder" is only executed by specific functions which means that the details of how the query is executed can be abstracted and the query DSL can be extended to allow any kind of data backend that contains the attestation information. Currently the library has been tested to work with a local database index of the attestations.

In the future, support for remote database servers, REST APIs that have indexed data, GraphQL API that have indexed data, or a decentralised database like Ceramic, can be used without the need to change the DSL.

Currently, the library depends on a source of indexed attestation data. For this purpose the "eas-indexing-service" was used:

The EAS SDK and ethers.js is used to fetch data from or send data to the blockchain where necesary.

The library uses Prisma to connect to the Postgres database of the "eas-indexer" which is fetching the newly published attestations constantly through the Alchemy API for OP-goerli. During development the database was running through Docker and the library is connected to the DB externally.

Additional functionality is provided for creating schemas, creating attestations, and revoking them. This is done to provide a more powerful library and to avoid boilerplate code when possible.

Under the "demo/" directory there is a Next.js web application with React components. The demo showcases one of the use cases of the library which is attestation-based content gating which was inspired by the Optimism Ecosystem Project Idea:

In the web application the user connect their wallets (built with the "wagmi" library) and subsequently the web application sends requests to the Next.js backend API with the user information. The backend, utilised the AQB library to query the attestation database and returns a response to the frontend based on the data stored there. The React frontend of Next.js can reveal or hide content based on the responses.

The demo currently fetches attestation information based on the "role" that is published on a specific EAS schema, which emulates the roles that people usually have in organisations. The queries run are simple but can be extended for providing other gating systems such as attribute content gating. In that case a new schema needs to be deployed with the attributes that are relevant to the organisation.

For development purposes the library and demo are configured to interact with OP-goerli but can be configured to interact with any blockchain that EAS is deployed on.

background image mobile

Join the mailing list

Get the latest news and updates