vlayer enables developers to extract, verify, and integrate real-world data into Ethereum smart contracts securely without exposing sensitive information.
Learn more: vlayer Documentation
This Getting Started repo demonstrates Web Proofs - one of vlayer's core features. It allows you to:
- Prove ownership of a Twitter/X account by verifying data from Twitter
- Extract the handle from your Twitter account
- Verify the proof on-chain (Optimism Sepolia testnet)
The proof is generated client-side using the vlayer chrome browser extension, ensuring your Twitter credentials never leave your browser.
webproof-getting-started/
├── contracts/ # Solidity contracts
│ ├── src/vlayer/ # Web proof prover and verifier contracts
│ ├── deploy/ # Deployment scripts
│ └── test/ # Contract tests
└── react-frontend/ # React frontend application
└── src/ # Frontend source code
- Bun - For deployment scripts
- Node.js - For the React frontend
- vlayer Browser Extension - For generating web proofs
cd contracts
forge buildcd contracts/deploy
bun installCreate a .env.testnet.local file in the contracts/deploy directory with the following:
VLAYER_API_TOKEN=""
EXAMPLES_TEST_PRIVATE_KEY="0x"Obtain your VLAYER_API_TOKEN from the vlayer developer dashboard and create a new jwt token:
Deploy to vlayer testnet:
cd contracts/deploy
bun run deploy:testnetThis will deploy the contracts and create a .env file with the deployed contract addresses.
cd react-frontend
npm install
# or
bun installcd react-frontend
npm run dev
# or
bun run devVisit http://localhost:5173 to see the application.
- User clicks "Prove" in the frontend
- vlayer browser extension opens and guides you through:
- Logging into Twitter/X
- Navigating to your account settings API
- Notarizing the API response
- Web proof is generated using zero-knowledge proofs
- Proof is sent to vlayer's prover network
- Smart contract verifies the proof on Optimism Sepolia
- Transaction link is displayed for viewing on the block explorer
Extracts and proves Twitter screen name from the API response:
- Verifies the web proof
- Extracts
screen_namefrom JSON response - Returns proof data for on-chain verification
Verifies the proof on-chain and stores the verified screen name.
Run contract tests:
cd contracts
vlayer test