| author | date |
|---|---|
Péter Garamvölgyi |
2024-08-29 |
2024-08-29
learn about EAS (Ethereum Attestation Service)
learn how Scroll Canvas works
get inspired to start building cool stuff
learn the ideas behind the Ethereum Attestation Service
EAS is an open-source public good for making attestations
it is a standard and a collection of tools
it's simple, permissionless, composable, and credibly neutral
--
attestation: someone claims something about someone else
signed data with well-defined structure
do I trust it?
how do I interpret it?
attestations are simply digital signatures on structured pieces of information
{
uid: '#123',
schema: 'FriendsWith',
attester: 'Alice',
recipient: 'Bob',
time: 1671219600,
revocable: true
}do I trust it? of course, why would I not believe Alice herself?
how do I interpret it? up to me, but the FiendsWith schema provides a default interpretation
--
EAS has 3 main building blocks: schemas, attestations, and tools
a schema is a blueprint for attestations, it defines its format and basic properties
anyone can create a schema, and (usually) anyone can attest with a schema
--
schemas are created through the global singleton schema registry contract:
ISchemaRegistry.register("bool isTrue", address(0), false)
{
"uid": "0xd57de4f41c3d3cc855eadef68f98c0d4edd22d57161d96b7c06d2f4336cc3b49",
"revocable": true,
"schema": "address badge, bytes payload",
"resolver": "0x4560FECd62B14A463bE44D40fE5Cfd595eEc0113"
}uid: universal unique identifier, a hash of the schema
revocable: can the attestations can be revoked or not? e.g. FriendsWith vs DaughterOf
schema: if the attestation carries additional data, how to parse it? e.g. Vote
resolver: a contract that executes additional actions/checks. e.g. CitizenOf
--
next up: attestations
The primary purpose of EAS is to serve as a protocol that facilitates the creation of digital signatures on structured information, enhancing both their composability and interoperability, trust, and validation.
a minimal but powerful standard data structure
attestations are created through the global singleton EAS contract:
EAS.attest({ schema: "0xd57de4f41c3d3cc855eadef68f98c0d4edd22d57161d96b7c06d2f4336cc3b49", data: ... })
see IEAS.sol
{
"uid": "0x5134f511e0533f997e569dac711952dde21daf14b316f3cce23835defc82c065",
"schema": "0x27d06e3659317e9a4f8154d1e849eb53d43d91fb4f219884d1684f86d797804a",
"attester": "0x1e3de6aE412cA218FD2ae3379750388D414532dc",
"recipient": "0xFD50b031E778fAb33DfD2Fc3Ca66a1EeF0652165",
"revocable": true,
"time": 1671219600,
"expirationTime": 0,
"revocationTime": 1671219636,
"data": "0x0000000000000000000000000000000000000000000000000000000000000000"
"refUID": "0x0000000000000000000000000000000000000000000000000000000000000000",
}--
next up: tools
the easiest way to browse attestations
collect all the attestations that you care about into a local database
flexible queries over attestations. examples:
- list all
FriendsWithattestations that a wallet received - list all
Likeattestations that a wallet issued
convenient js API to interact with attestations
a fun identity application build on EAS by Scroll
my colleague, Ming: "hey Peter, you know these pins that you can decorate your Crocs with? I want to build this, but on chain!"
--
users create a profile (aka Canvas), collect badges, and showcase them to others
users earn perks and benefits as a badge holder
projects have a new way to incentivize and reward users
--
product at https://scroll.io/canvas
code at https://github.com/scroll-tech/canvas-contracts
after 1 month, Canvas is now the #1 EAS schema in terms or number of attestations
Ethereum Year Badge: a digital trophy that shows off the year your wallet made its debut on Ethereum
Ambient Swapooor: for users who have made one or more single swaps on Ambient for $500
Proof of Humanity Badge: this badge serves as a testament to your authenticity as a human participant within the Scroll ecosystem
https://scroll.io/canvas-and-badges#discover
--
future use cases:
reward OG users of your DeFi protocol, offer discounts
┌─────┐ attest ┌─────────────────────┐ issueBadge ┌─────────────┐
│ EAS │ ───────▶ │ ScrollBadgeResolver │ ────────────▶ │ ScrollBadge │
└─────┘ └─────────────────────┘ └─────────────┘
a badge is a smart contract that adds custom functionality on top of attestations
standard interface:
onIssueBadge and onRevokeBadge: hooks for custom actions/checks
badgeTokenURI: NFT-like standard metadata containing name, description, and badge image
┌─────┐ attest ┌─────────────────────┐ issueBadge ┌─────────────┐
│ EAS │ ───────▶ │ ScrollBadgeResolver │ ────────────▶ │ ScrollBadge │
└─────┘ └─────────────────────┘ └─────────────┘
badge creation is fully permissionless, but badges must conform to certain standards
--
badge minting can be permissionless: the badge contract checks eligibility on-chain
it can also be backend-authorized: users submit a backend-issued signed permit
simple example: ScrollBadgeWhale, earn a badge by holding 1000 ETH or more
contract ScrollBadgeWhale is ScrollBadgePermissionless {
constructor(address resolver_) ScrollBadgePermissionless(resolver_) {
// empty
}
function onIssueBadge(Attestation attestation) internal override returns (bool) {
// ...
return attestation.recipient.balance >= 1000 ether;
}
}https://github.com/scroll-tech/canvas-contracts/blob/master/src/badge/examples/ScrollBadgeWhale.sol
┌─────┐ attest ┌─────────────────────┐ issueBadge ┌─────────────┐
│ EAS │ ───────▶ │ ScrollBadgeResolver │ ────────────▶ │ ScrollBadge │
└─────┘ └─────────────────────┘ └─────────────┘
the badge resolver is a global singleton contract
each canvas attestation goes through it; it executes some basic checks
e.g. does the badge contract exist? is the attestation payload well-formed?
https://github.com/scroll-tech/canvas-contracts/blob/master/src/resolver/ScrollBadgeResolver.sol
┌─────────────────┐ create ┌─────────┐
│ ProfileRegistry │ ───────▶ │ Profile │
└─────────────────┘ └─────────┘
user can mint a profile
a profile is an on-chain expression of preferences: what do you want to show to others?
configure an on-chain username and avatar
attach, detach, reorder badges
example: https://scroll.io/canvas/0x8ff5A977E3e6371928b47002c7f96fd7adEDE4BE
┌─────────────────┐ create ┌─────────┐
│ ProfileRegistry │ ───────▶ │ Profile │
└─────────────────┘ └─────────┘
profiles are managed in the profile registry global singleton contract
how EAS can become a new paradigm for building dapps
https://docs.attest.org/docs/idea--zone/thought-starters
digital identity & credentials
voting systems
content authenticity
social graphs
--
https://scroll.easscan.org/schemas/explore
Follow, Like, Username, Post
Sign a Document
example: social dapp
users can autonomously post their content using the client of their choice as standard attestations
different clients will index different subsets of this data, then interpret and display it in different ways
on-chain attestations are now cheap -- but not free!
need to sponsor through Account Abstraction or use off-chain attestations
off-chain attestations are harder to distribute
--
EAS is deployed on many chains
how to collect and order events from multiple chains?
go mint your profile at Scroll Canvas
build a Canvas badge
go check out the EAS documentation
get your hands dirty and build cool new dapps!
--
get in touch
twitter/telegram @thegaram33