This is the World ID Widget Module to demonstrate the integration of two powerful Web3 technologies:
- World ID: Worldcoin's privacy-preserving proof-of-personhood protocol
- Reown AppKit: Advanced wallet connection infrastructure for seamless dApp interactions
This application serves as a reference implementation for developers looking to build dApps that require both wallet connectivity and human verification, enabling use cases like sybil-resistant voting, fair airdrops, and authenticated user experiences.
NOTE:
- In this repo, the
WorldIDV3BadgeManagerForOffChainVerifiedProof.sol, which is deployed on World Chain mainnet / sepolia, would be used.- The deployed addresses of the
WorldIDV3BadgeManagerForOffChainVerifiedProof.solcan be seen here.
- The deployed addresses of the
- World ID Integration: Privacy-preserving human verification using Worldcoin's orb and phone verification methods
- Secure Wallet Connections: Connect to popular crypto wallets using Reown's advanced protocol
- Multi-Chain Support: Support for Ethereum, World Chain, Base, and other EVM-compatible networks through Wagmi
- User-Friendly Interface: Clean, intuitive UI for managing both identity verification and wallet connections
- Real-Time Verification: Instant World ID verification with detailed result display
- Cross-Platform Compatibility: Works seamlessly on desktop and mobile devices
- Frontend: React v19 with TypeScript and Next.js v15.3.3
- Identity: World ID (@worldcoin/idkit) for human verification
- Wallet Integration: Reown AppKit with Wagmi adapter for multi-wallet support
- State Management: React Query (@tanstack/react-query) for server state management
- Blockchain Interaction:
@wagmi/core (v2)Viemfor Ethereum interactions - Styling: CSS modules with responsive design
- Development: ESLint for code quality and TypeScript for type safety
-
Clone the repository:
git clone https://github.com/masaun/world-id-widget-module.git cd world-id-widget-module -
Install dependencies:
npm install
-
Configure environment variables:
cp .env.example .env
Update the following variables in
.env:NEXT_PUBLIC_WORLDCOIN_APP_ID: Your World ID'sapp IDfrom Worldcoin Developer PortalNEXT_PUBLIC_WORLDCOIN_ACTION: Your World ID'saction (ID)name from Worldcoin Developer PortalNEXT_PUBLIC_WORLDCOIN_RP_ID: Your World ID'sRP IDfrom Worldcoin Developer PortalNEXT_PUBLIC_WORLDCOIN_RP_SIGNING_KEY: Your World ID'sRP Signing key, which is aPrivate Keythat is downloaded from Worldcoin Developer PortalNEXT_PUBLIC_PROJECT_ID: Your Reown project ID from Reown Dashboard
-
Set the
"staging"or"production"to theenvironmentattribution in theWorldIdVerification.tsx:- NOTE: If you use the
World App simulator(https://simulator.worldcoin.org/), you should set the"staging"to theenvironmentattribution.
- NOTE: If you use the
<IDKitRequestWidget
...
// @dev - If you use the World App simulator (https://simulator.worldcoin.org/), you should set the "staging" to the environment:
environment="staging"
//environment="production"
...
/>- Set the
orbLegacy()orproofOfHuman()to thepresetattribution in theWorldIdVerification.tsx:orbLegacy()preset is for World ID Proof (Orb)v3.0proof generation.proofOfHuman()preset is for World ID Proof (Orb)v4.0proof generation
<IDKitRequestWidget
...
//preset={orbLegacy({ signal: callerAddress })} // World ID Proof (Orb) v3.0 preset
preset={proofOfHuman({ signal: callerAddress })} // World ID Proof (Orb) v4.0 preset
...
/>- Set the
passport()preset inWorldIdV4PassportVerification.tsxfor World ID v4 Passport (NFC credential) verification:passport()preset is for World ID v4 NFC Passport credential (credential ID:9303) verification.- It requests proof that the user holds a verified government-issued NFC passport credential.
- Set
allow_legacy_proofs: trueto also accept World ID 3.0 fallback (legacy Document verification) for users who do not yet have a World ID 4.0 credential. - The
signal(e.g. the connected wallet address) is bound into the proof to prevent replay attacks — your backend should enforce the same value.
<IDKitRequestWidget
...
allow_legacy_proofs={true}
preset={passport({ signal: callerAddress })} // World ID v4 NFC Passport credential (9303) preset
...
/>Reference: World ID Credentials — passport() preset | NFC Credential (9303)
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:3000
-
Launch the application
-
Click
"🌍 Verify with World ID"button to start the human verification process -
QR code modal for a
World ID v3 Proofverification (irisbased verification usingorb) would be displayed: (NOTE: Visit a Worldcoinorblocation in advance if you has not verified via the Orb yet) -
Once a user scan the QR code via their World App, the
World ID v3 Proofgeneration and verification would get started. -
Once a
World ID v3 Proofgeneration and verification would be completedoff-chain(backend), the proof data is stored into theon-chainstorage via thestoreVerifiedWorldIDV3ProofData()of theWorldIDV3BadgeManagerForOffChainVerifiedProof.sol. (NOTE: You can also use the source function to call it) -
View your verification status and details
-
You can check wether a user has a
World ID v3 Proofin the form ofWorld ID v3 Proofbadge by invoking thehasWorldIDV3Badge()of theWorldIDV3BadgeManagerForOffChainVerifiedProof.sol. (NOTE: You can also use the source function to call it)
NOTE:
-
Also, you can check a data of the verified
World ID v3 Proofby invoking thegetVerifiedWorldIDV3ProofData()of theWorldIDV3BadgeManagerForOffChainVerifiedProof.sol -
Where the files, which is for
World ID v3 Proofgeneration and verification would be completedoff-chain(backend), is stored:RP Signaturegeneration:app/api/world-id/rp-signature/route.tsWorld ID v3 Proofgeneration and verification:app/api/world-id/verify-proof/route.ts
-
Launch the application
-
Click
"🛂 Verify Passport with World ID"button to start the NFC passport credential verification process -
A QR code modal for World ID v4 Passport verification will be displayed. Scan it with the World App. (NOTE: Your passport must already be enrolled in the World App. The credential uses NFC chip data from a government-issued passport.)
-
Once a user scans the QR code via their World App, the
passport()preset triggers a World ID v4 NFC Passport credential proof (credential ID:9303). -
Once the credential proof is verified
off-chain(backend), the verification result is displayed on screen.
NOTE:
- The
passport()preset verifies that the user holds a unique government-issued NFC passport credential — each passport can only be linked to one World ID, providing document-level Sybil resistance. allow_legacy_proofs: trueenables fallback support for users with World ID 3.0 Document credentials.- Where the files for
World ID v4 Passportproof verification are stored:RP Signaturegeneration:app/api/world-id/rp-signature/route.ts- Proof verification:
app/api/world-id/verify-proof/route.ts
- The component is located at:
src/components/world-id/v4/nfc-credential/passport/WorldIdV4PassportVerification.tsx
- Click "Connect Wallet" to establish a wallet connection via Reown
- Scan the QR code with your preferred wallet app or select from available wallet options
- Approve the connection request in your wallet
- Start interacting with the dApp using your connected wallet
Once both World ID verification and wallet connection are complete, you can:
- Access features that require proven human identity
- Interact with smart contracts using your verified identity
- Participate in sybil-resistant activities
- The deployed addresses of the
WorldIDV3BadgeManagerForOffChainVerifiedProof.solcan be seen here.
- World ID Documentation
- World Developer Portal
- Reown Documentation
- Next.js Documentation
- Wagmi Documentation
This project is licensed under the MIT License - see the LICENSE file for details.
World ID Widget Module is a development project for demonstration purposes. Always verify transactions and use at your own risk. Never share your private keys, seed phrases, or personal verification information with untrusted parties.