Complete Guide to Ethereum Attestation Service (EAS)
A comprehensive guide to implementing and using the Ethereum Attestation Service (EAS) for creating, managing, and verifying on-chain attestations
1. Introduction to EAS
What is EAS?
Ethereum Attestation Service (EAS) is a decentralized protocol that allows users to create, verify, and manage attestations (verifiable claims) on the Ethereum blockchain. It provides a standardized way to make claims about data, identities, or events that can be independently verified by others.
Why Use EAS?
- Decentralization: No central authority is needed to verify claims.
- Interoperability: Standardized schemas allow for cross-platform compatibility.
- Security: Attestations are secured by the Ethereum blockchain.
- Transparency: All attestations are publicly verifiable.
2. Key Concepts
Core Components
-
SchemaRegistry:
- A smart contract that stores and manages schemas.
- Schemas define the structure and data types of attestations, ensuring that all attestations conform to a predefined format.
-
EAS Contract:
- The main contract that handles the creation and management of attestations.
- It interacts with the
SchemaRegistry
to ensure that attestations adhere to the defined schemas.
-
Attestations:
- Verifiable claims stored on the blockchain.
- Created and managed by the
EAS Contract
.
-
Resolvers:
- Optional contracts that provide additional validation logic for attestations.
3. How EAS Works
Workflow
- Schema Definition: Start by defining a schema using the SchemaRegistry contract.
- Attestation Creation: Use the EAS Contract to create attestations based on the schema.
- Optional Validation: Resolvers can be used for further validation logic.
- On-chain Storage: Attestations are securely stored and retrievable on-chain.
4. Contract Deployment
Before deploying the EAS contracts, you must add the smart contract set to your project.
Adding the Smart Contract Set
- Navigate to the Dev tools Section: Go to the application dashboard of the application where you want to deploy the EAS contracts, then navigate to the Dev tools section in the left sidebar.
- Select the Attestation Service Set: From there, click on Add a dev tool, choose Code Studio and then Smart Contract Set. Choose the Attestation Service template.
- Customize: Modify the set as needed for your specific project.
- Save: Save the configuration.
For detailed instructions, visit the Smart Contract Sets Documentation.
Deploying the Contracts
Once the contract set is ready, you can deploy it using either the Task Menu in the SettleMint IDE or via the Terminal.
5. Registering a Schema
Example Use Case
Imagine building a service where users prove ownership of their social media profiles. The schema might include:
- Username: A unique identifier for the user.
- Platform: The social media platform name (e.g., Twitter).
- Handle: The user's handle on that platform (e.g.,
@coolcoder123
).
Example
6. Creating Attestations
Example Use Case
Let's create an attestation that proves:
- Username:
awesome_developer
- Platform:
GitHub
- Handle:
@devmaster
Example
7. Verifying Attestations
Verification is essential to ensure the integrity and authenticity of attestations. You can verify attestations using one of the following methods:
- Using the EAS SDK: Perform lightweight, off-chain verification programmatically.
- Using a Custom Smart Contract Resolver: Add custom on-chain validation logic for attestations.
Choose Your Verification Method
When to Use Each Method?
- EAS SDK: Best for off-chain applications where simple validation suffices.
- Custom Resolver: Use for on-chain validation with additional rules, such as verifying trusted attesters or specific data formats.
8. Using the Attestation Indexer
Setup Attestation Indexer
- Go to your application's Middleware section
- Click "Add a middleware"
- Select "Attestation Indexer"
- Configure with your contract addresses:
- EAS Contract:
EAS contract address
- Schema Registry:
Schema Registry contract address
- EAS Contract:
Querying Attestations
Connection Details
After deployment:
- Go to your Attestation Indexer
- Click "Connections" tab
- You'll find your GraphQL endpoint URL
- Create an Application Access Token (Settings → Application Access Tokens)
Using the GraphQL UI
The indexer provides a built-in GraphQL UI where you can test queries. Click "GraphQL UI" in your indexer to access it.
Example Query Implementation
9. Integration Studio Implementation
For those using integration studio, we've created a complete flow implementation of the EAS interactions. This flow automates the entire process we covered in this guide.
Flow Overview
The flow includes:
- EAS Configuration Setup
- Schema Registration
- Attestation Creation
- Attestation Verification
- Debug nodes for monitoring results
Installation
- In Integration Studio, go to Import → Clipboard
- Paste the flow JSON below
- Click Import
Click to view/copy the complete Node-RED flow JSON
Configuration Steps:
- Update the setup inject node with your:
- RPC URL
- Registry Address
- EAS Address
- Private Key
- Customize the schema in the register function
- Deploy the flow
- Test each step sequentially using the inject nodes
The flow provides debug outputs at each step to monitor the process.