self-xyzIntegrate Self (self.xyz) — a privacy-first identity protocol using zero-knowledge proofs to verify passports and ID cards. Use when the user mentions Self protocol, Self identity, self.xyz, passport verification, zero-knowledge identity verification, SelfAppBuilder, SelfBackendVerifier, SelfVerificationRoot, or wants to add privacy-preserving KYC, age verification, nationality checks, OFAC screening, or Sybil resistance using real-world identity documents. Covers frontend QR code integration, backend proof verification, and on-chain smart contract verification on Celo.
Install via ClawdBot CLI:
clawdbot install 0xturboblitz/self-xyzSelf lets users prove identity attributes (age, nationality, humanity) from passports/ID cards using zero-knowledge proofs — no personal data exposed. Users scan their document's NFC chip in the Self mobile app and share a zk proof with your app.
npm install @selfxyz/qrcode @selfxyz/core
"use client";
import { SelfQRcodeWrapper, SelfAppBuilder } from "@selfxyz/qrcode";
export default function VerifyIdentity({ userId }: { userId: string }) {
const selfApp = new SelfAppBuilder({
appName: "My App",
scope: "my-app-scope",
endpoint: "https://yourapp.com/api/verify",
endpointType: "https",
userId,
userIdType: "hex",
disclosures: {
minimumAge: 18,
},
}).build();
return (
<SelfQRcodeWrapper
selfApp={selfApp}
onSuccess={() => console.log("Verified")}
type="websocket"
darkMode={false}
/>
);
}
// app/api/verify/route.ts
import { SelfBackendVerifier, DefaultConfigStore } from "@selfxyz/core";
export async function POST(req: Request) {
const { proof, publicSignals } = await req.json();
const verifier = new SelfBackendVerifier(
"my-app-scope", // must match frontend scope
"https://yourapp.com/api/verify", // must match frontend endpoint
true, // true = accept mock passports (dev only)
null, // allowedIds (null = all)
new DefaultConfigStore({ // must match frontend disclosures
minimumAge: 18,
})
);
const result = await verifier.verify(proof, publicSignals);
return Response.json({
verified: result.isValid,
nationality: result.credentialSubject?.nationality,
});
}
| Pattern | When to Use | endpoint | endpointType |
|---------|------------|------------|----------------|
| Off-chain (backend) | Web apps, APIs, most cases | Your API URL | "https" or "https-staging" |
| On-chain (contract) | DeFi, token gating, airdrops | Contract address (lowercase) | "celo" or "celo-staging" |
| Deep linking | Mobile-first flows | Your API URL | "https" |
SelfVerificationRoot. Use for trustless/permissionless scenarios.references/frontend.md.disclosures must EXACTLY match backend/contract verification config. Mismatched age thresholds, country lists, or OFAC settings cause silent failures.endpoint. Use .toLowerCase()."USA", "IRN", "PRK". Max 40 countries in exclusion lists.mockPassport: true in backend / use "celo-staging" endpoint type. Real passports require mainnet. To create a mock passport: open Self app, tap the Passport button 5 times. Mock testing requires OFAC disabled.@selfxyz/core >= 1.1.0-beta.1.1 = Passport, 2 = Biometric ID Card. Must explicitly allow via allowedIds map.ScopeMismatch = scope/address mismatch or non-lowercase address. Invalid 'to' Address = wrong endpointType (celo vs https). InvalidIdentityCommitmentRoot = real passport on testnet (use mainnet). Invalid Config ID = mock passport on mainnet (use testnet).| Network | Address |
|---------|---------|
| Mainnet Hub V2 | 0xe57F4773bd9c9d8b6Cd70431117d353298B9f5BF |
| Sepolia Hub V2 | 0x16ECBA51e18a4a7e61fdC417f0d47AFEeDfbed74 |
| Sepolia Staging Hub V2 | 0x68c931C9a534D37aa78094877F46fE46a49F1A51 |
Load these for deeper integration details:
references/frontend.md — SelfAppBuilder full config, SelfQRcodeWrapper props, deep linking with getUniversalLink, disclosure optionsreferences/backend.md — SelfBackendVerifier constructor details, DefaultConfigStore vs InMemoryConfigStore, verification result schema, dynamic configsreferences/contracts.md — SelfVerificationRoot inheritance pattern, Hub V2 interaction, setVerificationConfigV2, customVerificationHook, getConfigId, userDefinedData patternsGenerated Mar 1, 2026
DeFi platforms can use Self protocol for permissionless KYC and anti-Sybil measures without exposing user data. By integrating on-chain verification on Celo, they enable token gating, airdrop eligibility, and regulatory compliance like OFAC screening through zero-knowledge proofs from passports. This ensures only verified, non-sanctioned users access services while maintaining privacy.
Online platforms such as streaming services or social media can verify user age without collecting personal details. Using off-chain backend verification, they set minimum age disclosures (e.g., 18+) and allow users to prove eligibility via Self app scans, enabling privacy-preserving age gates for restricted content or features.
Airlines or hotel booking systems can integrate Self for nationality checks and identity verification during reservations. By configuring disclosures for specific countries and using backend verification, they streamline check-ins and comply with travel regulations without storing sensitive passport data, reducing fraud risk.
Event organizers can implement token-gated entry using on-chain verification to ensure attendees are real humans and meet criteria like nationality or age. By deploying smart contracts on Celo, they issue tickets as NFTs that require valid zk proofs from Self, preventing scalping and enhancing security at venues.
Healthcare providers can use Self protocol to verify patient identity and age for accessing medical records or telemedicine services. With off-chain backend integration, they enable secure, privacy-first authentication that meets regulatory requirements like HIPAA without exposing personal information, improving trust and efficiency.
Offer a hosted API service that handles Self protocol integration for clients, charging monthly fees based on verification volume. This model reduces development overhead for businesses by providing managed backend verification, configurable disclosures, and support for compliance needs like OFAC screening.
Provide specialized consulting to help enterprises implement Self protocol for specific use cases, such as DeFi or travel. Revenue comes from project-based fees for designing and deploying custom frontend components, backend systems, or smart contracts tailored to client requirements.
Develop and sell premium tools or plugins that simplify Self integration, such as advanced config managers or analytics dashboards. Offer a free tier for basic usage and charge for advanced features like dynamic disclosure settings or multi-chain support, targeting developers building privacy-focused apps.
💬 Integration Tip
Ensure frontend disclosures exactly match backend or contract configs to avoid silent failures, and use lowercase addresses for on-chain endpoints to prevent ScopeMismatch errors.
Connect Claude to Clawdbot instantly and keep it connected 24/7. Run after setup to link your subscription, then auto-refreshes tokens forever.
ERC-8004 Trustless Agents - Register, discover, and build reputation for AI agents on Ethereum. Use when registering agents on-chain, querying agent registries, giving/receiving reputation feedback, or interacting with the AI agent trust layer.
Autonomous crypto trading on Base via Bankr. Use for trading tokens, monitoring launches, executing strategies, or managing a trading portfolio. Triggers on "trade", "buy", "sell", "launch", "snipe", "profit", "PnL", "portfolio balance", or any crypto trading task on Base.
Deploy ERC20 tokens on Base using Clanker SDK. Create tokens with built-in Uniswap V4 liquidity pools. Supports Base mainnet and Sepolia testnet. Requires PRIVATE_KEY in config.
Query DeFi portfolio data across 50+ chains via Zapper's GraphQL API. Use when the user wants to check wallet balances, DeFi positions, NFT holdings, token prices, or transaction history. Supports Base, Ethereum, Polygon, Arbitrum, Optimism, and more. Requires ZAPPER_API_KEY.
Interact with Solana blockchain via Helius APIs. Create/manage wallets, check balances (SOL + tokens), send transactions, swap tokens via Jupiter, and monitor addresses. Use for any Solana blockchain operation, crypto wallet management, token transfers, DeFi swaps, or portfolio tracking.