Jack Xu I MAGA Make Attestations Gated Again using Sign Protocol I ETHGlobal Bangkok 2024
ETHGlobal·Thu, Oct 9, 2025, 12:00 AM
Speaker
Join us for a workshop with Jack Xu from Sign Protocol titled, "MAGA Make Attestations Gated Again using Sign Protocol." Join us for a closer look at Sign Protocol's schema hooks: what they are, how they can be used to gate attestations, and some other potential use cases ETHGlobal Bangkok 2024 was a 3-day hackathon that took place November 15 to 17, 2024, and brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] um so some of you guys I've seen before some of you are new um regardless welcome thank you for coming to uh the sign protocol Workshop um who here actually flew from a different continent where from which continent North America North America nice um well thanks for uh flying for like 17 hours and uh just to be in my workshop but obviously I know you guys are here because you're after the money which is fine I'm offering um just don't spend that money uh tonight okay uh so so we're uh sign protocol okay so we have 30 minutes I can mess around and talk a little bit of random stuff um so those of you who um who are just here for the money I can give you a little bit of little bit of introduction I I like the honesty you know if you're here just for the money then you know that it's good it's good you know it's like if you are a gold digger then just make it clear you know so which is fine you know that's that's valid um so sign protocol we are a um hello Megan and Zoe thanks for supporting me um sorry I refuse to wear your uh your merch okay our merch our merch okay um okay so sign protocol is an uh Omni atation protocol and exactly what that means I'll kind of go I'll get into it later um but you know before I get into n nitty-gritty I want to um talk about some of the the grand visions of of S so at sign protocol we envision a future where all ownership consent and identity will be registered and verified in one place which is a decentralized and Trust neutral onchain repository so fundamentally our vision is to encourage uh data um data reusability basically so right now you know on chain there's a lot especially you know in in a place where um in a place where it's stored valuable for example you know uh before the introduction of signing with Google or whatever if you had like 10 social media accounts or 10 accounts for 10 different web back when web forums was still a thing when I was in Middle School okay uh which is not that long ago a new username and password to establish a new identity right and that's really wasteful because you're just one person you're the same person right and when we moved our when Google sign in what and whatnot you know those ooth Solutions came along then you're able to kind of the graphic identity and that's like the new identity and you know for S protocol what we do is uh we try to facilitate an onchain data sharing repository where um the data that's being stored on chain um hopefully is Meaningful and we uh Force well to the extent that we can it's like forcing an ANF royalty it doesn't really work because you can just toally say oh I sold this for zero e and not pay anything but we to reuse data right to so to make other people uh to tell other people how to interpret your data correctly so that you know uh they can make use of it obviously and and there are more ways uh to uh to just um there's a lot of you know tricks I can play to monetize or share your data which we'll get into later if we have time um now I totally click baited everyone into this uh Workshop because but uh it's make attestations gated again now what do I exactly mean by that um it's it's what I mean is like a feature that we call schema Hooks and we'll get into it so today uh if you were with us uh during uh the San Francisco hackathon about a month ago then uh you'll remember my um my diversity higher white person Jordan I'm sorry um he was here that explained so no one no one likes that joke okay uh so um he explained the front end SDK and we walk kind of walk through that so uh today so uh again sign protocol with the onchain attestation framework um so to make attestations or to store data onchain for others to use it's really really simple so just three steps right the first step is to create a schema um the Second Step uh so the schema basically tells other people um how to interpret your data it's like a Json Json thing where uh it's like key value uh the key is the key in your data Val right we can't really enforce that because solity doesn't do like JSM parsing um but you know if you adhere to the rules you've got right and then the third step after you made a stations you can basically other people can actually query now I took this screenshot from our front in SDK a list of a stations based on various filters okay uh which we'll get into later um I'm not going to go over too much of the front- end stuff today I want to get more into the solidity stuff uh which I'm good at because I'm actually terrible at doing front end now this is just a diagram now you don't have to take notes Don't Panic on taking notes because in detail okay so I'm not going to zoom in too much here but basically this is an overview of how the entire system is structured and works I'll kind of skip over the white user on the uh on the left side so first uh and right now we're only looking at the onchain schema so as you can see from we actually support two different types of accusations one is an atation on the traditional blockchain which is like evm or uh sharket or or telegram or something um the second uh the second one through the API is actually stored on R weave and we actually index it now so it's a blockchain that's optimized with data storage which makes it quite cheap to store data um and the reason why we've provided that is basically to make it so that um if you're at the station is quite big um and it's financially not feasible to be stored on chain we also give you away Destro data and also on the also you know I I kind of want to talk about this so uh on a conceptual level if you're if your data if you don't need other smart contracts to read your data then you don't really have to put it onto like an evm blockchain or something because like if you just want your atti stations to be read by humans and if you just want a guarantee of like smart contracts humans can actually access the real internet right um so that's why we provide an API for you to store things on R weave um and we're actually going to roll out we didn't make it for this hackathon but uh within the month we we'll roll out a uh up and you can basically store data into our weave through us uh for uh it's extremely cheap it's something like 10 cents per gigabyte or something I forgot but it's like really cheap right um but today we're just we're just going to look at the left part okay so of the hierarchy between the schema and the attestation so um the schema actually is like this now this entire thing looks like some kind of like Intel presentation that their CPUs but uh the schema C contains atation one and atation two so Attis stations every single atation they must belong to some schema right to to to a single schema you can't have an at station that belongs to two of them right now what is this so this is this is the schema hook contract that I've been talking about and we're going to get into uh uh deeper today deeper into today right so as a schema Creator you can define an external smart contract as the schema hook contract the data will be well the request or the call data whatever like this thing will be routed through the external hook contract so that um that hook contract has a chance to inspect the data or do whatever right because it's a smart contract but the bottom line is if you if if the uh if the if the code reverts in the hook contract the the attest or the revoke uh the roke the revoke function call will also be reverted so you can basically use it as a way to gatekeep for example who can make attestation ZK proof in order for an attestation to be written into the schema so everything in the schema is basically hard G by ZK proofs right so um something like that so this is why this uh this clickbait title called uh make atation gated again because that's what we're going to talk about um I hope I don't look stupid leaning forward like this um okay so very briefly right I'm still going to cover it but just really really briefly um so Fe sensor front end so this is the installation that set up for our front n SDK which um you can use um but it's just not the focus of the workshop today uh so the front and SDK is mainly used to interact with either to query at the stations and schemas from s scan or or it's also used to um to uh to submit at the stations us using the sign pral API onto onto R weave um but uh it's not the focus of this Workshop so I just have this quick slide which you don't have to take pictures of don't worry I'm going to have a QR code that link to a slight later um and to make it even better I'm such a nice teacher right um there's even the SD walkthrough from the San Francisco hackathon it's a it's a YouTube video that uh eth Global folks recorded so you know don't panic um and you don't even have to scan this QR code right now because later you have you'll have the QR code for the whole slide okay so I'll skip through this real quickly so today what we're going to talk about mainly is the solidity SDK instead right so so to install is quite straightforward you just mpm install or who even uses mpm nowadays everyone uses bun right that's like the trendy thing um and then there are two Imports that's uh that are important the first one is uh the sign protocol interface present on each evm chain uh then that's how you do it so with that you can call the a test function you can revoke you can create a schema programmatically you very rare um and the second one that's uh that's quite important which is like the highlight of today is the uh the the the smart contract uh the sign protocol hook interface right um and uh this is basically how you can how you're able to implement a schema hook create your own schema hook okay so I'll get into that so the schema hook hook right a schema hook it it's it's nothing fancy it's literally just another smart contract that will be called uh if you set it as a schema hook of a certain schema then this this contract will just be called whenever someone attests or revokes right and we'll go over the interface in a bit after after the slides right um and we have like four different examples on our GitHub um so this is like a common pattern admin contract that dictates who can call your hook because if your hook contract actually interacts with some other uh like let's say you're using it as like a web hook to call some other service then you don't want anyone to just be able to randomly trigger it right you only want it to be triggered when someone attests something so the caller and in that case the caller will be I have this ownable thing so what you can do is you can set the sign protocol instance right in the admin contract and in the hook contract you can check if if the caller is actually the uh the scial instance and if it's not then you can re you can revert and say that well you know I can't just have random people calling my hook okay um and afterwards you know you implement the actual thing right which I'll show later uh function interfaces four four function prototypes um but it's really just two it's just like there's like there are two variants called did receive attestation and you notice that it's actually payable so you can actually you can even uh charge a fee for your Attis stations so you can kind of you know do a lot of interesting things and the other variant is basically charging fee via an erc20 so that's why the interface is kind of different but um but the point is right you can charge a fee and you get access to the attester the schema ID the ateis ID and any extra data so the extra data will actually not be saved anywhere it only it will only it will be discarded after uh after this entire attest or whatever function call so that makes it really convenient so if you have some really large data that you want to use for verification cough cough maybe something like a ZK you know verification data right you can pass it through the X-ray data because you don't have to save it right if your logic if if your hook logic verifies it and if it's correct then you know it's it's like we don't really have to store it we just have to verify it and then throw it away after two weeks it's the same logic here okay um so uh and and also you the message. sender here so on line 12 you can see that I'm casting message. sender into the uh sign protocol interface that's um but uh you get so if you get access to the sign protocol smart contract but then you'll just get access to like you can get the atation get the schema such as what I did here get atation and inside and you know you have the schema ID so you can also get the uh get the schema this way right so it's you can get all the information about the incoming atation um this way right and then you can do like your own logic you can check data you can do whatever right and what I just said a very Canadian about okay that's I'm sorry um so utilizing extra data so this is um this is also a part of the uh one of the examples that we have on our in our example repository which you will see in a bit okay so this is uh this is a ZK hook ZK uh hook contract right basically um online 1 extra data and on line 16 um we are actually verifying it and if it's false then we just revert right and that function verify proof is not showing in the screenshot but it's somewhere just know that it's it's somewhere and then it returns false um if it uh if it returns false if it's if the proof is invalid right so this is how you can uh save space but also utilize the ZK stuff if you're into it um yeah using Circ which I don't know how to do um so QR code for the full documentation okay look I'm I'm so this is have you seen another Workshop that does this I'm sorry okay so this is the full documentation we have I I just made an issue tracker repository so if you have any questions or you found a bug you have a general question you don't have to wait for like 20 minutes in line or something at a booth or whatever submit an issue on a on this in this repository I have two issue templates so that you know we can work async right because obviously I'm not going to be here at 12:00 a.m you know unlike you right I'll try to be here for as much as I can but if if I'm not here right and uh my colleague Jordan he's in the US so we have basically have full time zom coverage okay if you have any questions general questions bug reports your code's not working submit an issue and that also makes it a lot easier for for me when you come to booth and because then you know you don't have to slide deck QR code look at that right so you can get everything okay everything in this slide just from this QR code okay so that was the slide deck presentation let's get quickly get into the code part okay which is the interesting part and uh I'll put this back up after we go through a code for Q&A in our documentation you'll have basically code examples of everything but I've already opened it in my VSS code have four examples the first one is a good example um for how to make an atation um using ins solidity okay now this is called actually met in real life um it's basically where it's it's just like met in real life but I can claim that I met Kamala Harris you know laughing Kamala La an atation will only be made if the other party also confirms that they've met you okay so this is a more legit version of met in real life this is really simple logic here basically um if if if a schema utilizes this hook then basically in the Whit list manager you can wh list ATT testers and when people come and attest to contract interface there's did receive attestation with the payable okay and did CF fation without payable but then you know you have a fee erc20 fee token and fee amount so you can charge fees that way right and this the same thing for revocation so you can also get notified or verify stuff when uh when when when people try to like revoke stuff okay in this case it literally it's it literally just checks if someone's in the white list or not okay uh this one data tester okay I actually forgot what this one does um let me actually remind myself okay I forgot what this one does let's a ZK circuit circom okay I took this from somewhere on the internet from here okay I I I actually am not very good at writing writing circom but this is an interesting ZK circuit what it does is that um you can prove that you can prove to someone that you know the original data that resulted in hash without showing them the original data so that's pretty cool right so this works okay and we we actually have if you scan the QR code um and go to our Doc's website we actually have a full walkr of how this thing works but basically this circuit will generate and I have like a separate repository just dedicated to the circuit and the setup and the input and outputs can write any of this obviously you can't hand do it um but uh this is a generated verifier circuit which has a function called verifi proof it's the one that you kind of briefly saw in the presentation right right and returns a bullion true or false if it proves correct or not and we import it into a ZK hook okay and uh when we're when we're uh attesting something basically you can this schema could be a a circuit maybe something like that it's not very meaningful but it's just a you know demonstration of how you can incorporate uh the use of zero knowledge proofs into uh into sign protocol schema hooks okay and uh and and obviously feel free to come and find me at the booth or you know more efficiently probably create an issue on that GitHub repository [Music]
Automatic transcript — names and jargon may be misspelled.