Quickstart
⚠️ Forking the workshop repo is a great starting point for your project to integrate Self. It contains a basic working example that demonstrates how to integrate Self. From this, you can add your own logic/requirements as needed.
Before You Start
New to Self Protocol? We highly recommend watching our ETHGlobal Buenos Aires Workshop first. This essential workshop walks through the core concepts and provides a hands-on introduction to building with Self.
Examples
Working examples of Self Protocol integration are available to use as a foundation to build upon.
Overview
To use Self in your web app, you will display QR codes to request proofs from your front-end, then you have a choice to verify them in your own back-end or onchain. All apps must integrate:
Frontend:
The front-end SDK generates and displays QR codes containing information from your app and what you want users to disclose.
Verification:
Verify through the onchain smart contracts. The verification happens on chain in a completely trustless manner. A demo working example can be found here: https://github.com/selfxyz/workshop
Verify through your projects backend. The back-end SDK verifies proofs on a node server (as in this quickstart). The verification is done on the projects own backend, meaning their is a trust assumption the users must make about the verification being done correctly. A demo working example can be found here: https://github.com/selfxyz/workshop/tree/backend-verification

Installation
Install the required frontend packages:
Package purposes:
@selfxyz/qrcode: QR code generation and display components@selfxyz/core: Core utilities includinggetUniversalLinkfor deeplinksethers: Ethereum utilities for address handling
Basic Usage
Here's a complete Next.js component example based on the workshop:
Verification Flow
The QR code component displays the current verification status with an LED indicator and changes its appearance based on the verification state:
QR Code Display: Component shows QR code for users to scan
User Scans: User scans with Self app and provides proof
Verification:
Onchain Verification: Your smart contract receives the proof and verifies it on the Self VerificationHub contract.
Backend Verification: Your API endpoint receives and verifies the proof
Success Callback:
onSuccesscallback is triggered when verification completes
Add SelfBackendVerifier to your backend
SelfBackendVerifier to your backendIf you want to verify your proofs with the backend verifier, then you would implement the following.
Requirements
Node v16+
Install dependencies
Set Up SelfBackendVerifier
The endpoint must be publicly accessible (not localhost). For local development, use ngrok to tunnel your localhost endpoint.
Key Points
Configuration Matching
Your frontend and backend configurations must match exactly:
Last updated