Verifying Identity with EAS on Maroo
A complete walkthrough of creating an attestation using Hardhat and verifying it using the Maroo CLI.
What You Will Learn
- ✓How to deploy an EAS Schema on Maroo
- ✓How to create an on-chain attestation
- ✓How to query the attestation using `marood`
Prerequisites
- Maroo Testnet Account with OKRW
- Basic Solidity/Ethers.js knowledge
Tools Needed
HardhatmaroodNode.js
In this tutorial, we will simulate a KYC provider issuing an 'IsVerified' attestation to a user. We will then use the Maroo CLI to read this attestation, simulating how a dApp or backend service would verify a user's status.
1
1. Define the Schema
First, we need to register a schema. For this tutorial, our schema is simple:
bool isVerified. We will use a script to register this with the global EAS Schema Registry. scripts/register.js javascript
const { SchemaRegistry } = require("@ethereum-attestation-service/eas-sdk");
// ... setup provider/signer ...
const schemaRegistry = new SchemaRegistry(SCHEMA_REGISTRY_ADDRESS);
const schema = "bool isVerified";
const resolverAddress = "0x0000000000000000000000000000000000000000"; // No resolver
const revocable = true;
const tx = await schemaRegistry.register({ schema, resolverAddress, revocable });
const uid = await tx.wait();
console.log("Schema UID:", uid); 2
2. Create an Attestation
Now, act as the issuer. We will attest that a specific recipient address is verified.
scripts/attest.js javascript
const { EAS, SchemaEncoder } = require("@ethereum-attestation-service/eas-sdk");
const eas = new EAS(EAS_CONTRACT_ADDRESS);
eas.connect(signer);
const schemaEncoder = new SchemaEncoder("bool isVerified");
const encodedData = schemaEncoder.encodeData([{ name: "isVerified", value: true, type: "bool" }]);
const tx = await eas.attest({
schema: SCHEMA_UID,
data: {
recipient: "0xRecipientAddress...",
expirationTime: 0,
revocable: true,
data: encodedData,
},
});
const newAttestationUID = await tx.wait();
console.log("Attestation UID:", newAttestationUID); 3
3. Verify via CLI
Finally, verify the attestation exists and is valid using the Maroo CLI. This confirms the data is accessible to the Cosmos layer.
terminal bash
marood query eas get-attestation \
0xEASContractAddress... \
0xYourAttestationUID... Tip: Check the 'revocation_time' field in the output. If it is 0, the attestation is still valid.
Conclusion
You have successfully bridged the gap between EVM tooling and Cosmos infrastructure. You created an attestation using standard Ethereum tools and verified it using Maroo's native CLI.